1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00
Commit Graph

51726 Commits

Author SHA1 Message Date
Yu Watanabe
ab486ef4eb network: restart DHCP server on carrier gain 2021-06-08 06:33:27 +09:00
Yu Watanabe
b27e5d53f3 sd-dhcp-server: make sd_dhcp_server_start() no-op if it is already running 2021-06-08 06:33:27 +09:00
Yu Watanabe
1d28a3cf6c network: use request queue to configure DHCP server 2021-06-08 06:33:27 +09:00
Ondrej Kozina
1319c7e044 cryptsetup-pkcs11: use erase_and_free for decrypted key cleanup.
It's hard to hit but it could leave decrypted key in memory on error
path.
2021-06-07 23:09:00 +02:00
Ondrej Kozina
26fbc5aa05 cryptsetup: Fix misplaced assert.
Seems the assert should be placed in-before decrypted_key
pointer is passed to libcryptsetup API.

Original placement would trigger abort in case tpm2
hw was not present in the system while required
to activate crypt devices.
2021-06-07 22:40:32 +02:00
Yu Watanabe
b6fce22a67
Merge pull request #19839 from yuwata/network-address-fix-flags-handling
network: fix address flag handling
2021-06-08 03:38:15 +09:00
Zbigniew Jędrzejewski-Szmek
b0ec372a96 install: allow adding plain templates to .wants/ or .requires/
Fixes #19437.

As reported in the bug:

> # drkonqi-coredump-processor@.service
>  ...
> [Install]
> WantedBy=systemd-coredump@.service
>
> The plan here is to have a systemd-coredump@ instance start the same %i for
> drkonqi-coredump-processor@. Works perfectly when creating the symlink manually
> ln -sv /usr/lib/systemd/system/drkonqi-coredump-processor@.service
> /etc/systemd/system/systemd-coredump@.service.wants/.

When DefaultInstance is set, we replace template references with
template@default-inst. But in this case we want to create a symlink for the
template name, so that systemd will fill in the instance from the
wanting/requiring unit. This is only possible for those units that actually
have an instance set, so we create the symlink only from .requires/ or .wants
of an instantiated unit (then this specific instance will be used), or a
template (than some instance will be inherited later).

Specifically:
...
[Install]
WantedBy=other@.service, fixed.service
DefaultInstance=inst

→ enable foo@.service creates other@.service.wants/foo@inst.service, and
other@a.service will want foo@inst.service, and other@b.service will want foo@inst.service,
and fixed.service will want foo@inst.service.

Without DefaultInstance,
→ enable foo@.service creates other@.service.wants/foo@.service, and
other@a.service would want foo@a.service, and other@b.service would want foo@b.service,
but enablement fails because no dependency can be created for fixed.service:

  Failed to enable unit, unit fixed.service is a non-template unit.
2021-06-08 01:58:27 +09:00
Yu Watanabe
6260e85fc8
Merge pull request #19835 from keszybz/user-manager-bpf-errors
Silence errors about BPF object permissions in user manager
2021-06-08 01:50:57 +09:00
Lennart Poettering
d27e6aee50 udevadm: fix --tag-match help + description 2021-06-08 01:47:01 +09:00
Yu Watanabe
0718266017
Merge pull request #19837 from keszybz/disable-more-units
Disable more units
2021-06-08 01:46:15 +09:00
Yu Watanabe
a066dc9c18
Merge pull request #19815 from yuwata/sd-device-clone
sd-device: make cloned sd_device object can read udev database without uevent file
2021-06-08 01:45:45 +09:00
Lennart Poettering
be45211388
Merge pull request #19820 from yuwata/udev-node-fix-hashed-path
udev: fix conflict of hashed string
2021-06-07 17:19:38 +02:00
Yu Watanabe
0828a38605 network: address: always read address flag from IFA_FLAGS attribute
Otherwise, update flag become incomplete and the IFA_F_MANAGETEMPADDR flag
will not be stored, thus no temporary addresses will be removed when
networkd requests to remove the main address.

Follow-up for a8481354f0.
Fixes #13218.
Fixes #19838.
2021-06-08 00:13:25 +09:00
Yu Watanabe
a23624846f network: show address flag in debugging logs 2021-06-07 23:02:56 +09:00
Franck Bui
b2c7d1bbc2 pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes
We support that tmp.mount being masked, and this should not be considered an
error.
2021-06-07 14:10:56 +02:00
Zbigniew Jędrzejewski-Szmek
294eace024 core: disable "update" units in the initramfs
Initially I wanted to add ConditionPathExists=!/etc/initrd-release in various
units (ldconfig.service, systemd-sysusers.service, systemd-hwdb-update.service,
systemd-journal-catalog-update, systemd-update-done.service), but I think it's
better to just disable the mechanism in the initrd altogether. Initrd images
are put together in a very particular way, and there is not need to do
post-update steps on them. If a unit from some other package winds up in the
initrd, we wouldn't want to invoke it either.

Also, any modifications are ephemeral, so any update would happen on every
use. And finally, initrd images are all about speed, and we shouldn't invoke
any unneeded services.
2021-06-07 13:40:08 +02:00
Zbigniew Jędrzejewski-Szmek
dc16846c26 units: stop automount unit when shutting down
This is currently our only .automount unit. We wouldn't want to trigger it
accidentally during shutdown, so let's stop it too.
2021-06-07 13:38:28 +02:00
Sebastian Blunt
2cbca51a71 Rename crypttab opt silent to password-echo
Use the option name 'password-echo' instead of the generic term
'silent'.

Make the option take an argument for better control over echoing
behavior.

Related discussion in https://github.com/systemd/systemd/pull/19619
2021-06-07 10:35:28 +02:00
Zbigniew Jędrzejewski-Szmek
1a9e33aee3 core: downgrade errors about BPF loading when called from socket_bind_supported()
prepare_socket_bind_bpf() is called from two sites: socket_bind_supported() and
socket_bind_install_impl(). For the latter, when errors occur we certainly want
to log, since they'll be fatal for the unit.  But for the former, we should be
quiet, at least on the "expected" errors like lack of permissions. I kept error
on map resizing and such, which should not fail, at log_warning(). They are not
fatal when called from socket_bind_suppported(), but still a sign that
something is off.

Currently BPF filters can only be used by privileged users. Thus each systemd
--user will fail in socket_bind_supported(). With the patch, we only log this
at debug level.

https://lwn.net/ml/bpf/cover.1620499942.git.yifeifz2@illinois.edu/ gives some
hope that unprivileged access will be possible, so let's keep the code trying.
We might get lucky and get support for filters in user mode without any changes
on our side.
2021-06-07 10:28:46 +02:00
Zbigniew Jędrzejewski-Szmek
5b35b56eae core/bpf: add forgotten %m 2021-06-07 10:28:46 +02:00
Luca Boccassi
3745355764
Merge pull request #19793 from keszybz/tmpfiles-autofs-and-globs
tmpfiles: better handling of autofs and globs
2021-06-07 09:14:27 +01:00
Yu Watanabe
381f6d4ba5 sd-device: make cloned sd_device object can read udev database without uevent file
Some devices sent CHANGE and REMOVE uevent simultaneously.
To support that such device read udev database, let's copy minimal set of
properties which requires to read the database.

Fixes #19788.
2021-06-05 18:05:26 +09:00
Yu Watanabe
c7d6ebb13e sd-device: do not try to read uevent file multiple times 2021-06-05 17:58:53 +09:00
Yu Watanabe
e5ca293fcd sd-device: set driver subsystem if the sd_device object is generated from nulstr
Otherwise, the sd_device object cannot read correct udev database file.
2021-06-05 17:58:53 +09:00
Yu Watanabe
33f2de7b64 conf-parser: make config_parse_tristate() accept an empty string
Fixes #19822.
2021-06-04 22:51:26 +02:00
Yu Watanabe
2bb0227165 udev: always use last 11 chars for hash string
This makes the last 11 chars are always preserved for hashed string.
So, it is hard to generate a path which conflicts to another path.

Fixes an issue demonstrated in the previous commit.
2021-06-04 22:31:24 +09:00
Yu Watanabe
0192864da7 test: add a testcase that demonstrates a conflict of hashed filename
The commit e64943363a introduces hashed
path at the end of the filename. But we can easily generate the path
which conflicts another path. The issue will be fixed in later commit.
2021-06-04 22:28:52 +09:00
Yu Watanabe
efe76b273a shell-completion: udevadm: support --uuid option
Follow-up for 730b9c1e14.
2021-06-04 15:00:11 +02:00
Yu Watanabe
16f9036471
Merge pull request #19796 from yuwata/udev-node-cleanups
udev: several cleanups about creating device symlink
2021-06-04 21:46:43 +09:00
Kai-Heng Feng
a7161e0288 hwdb: Add ProBook to use micmute hotkey
Like HP EliteBooks and ZBooks, all ProBooks use the same micmute
scancode.
2021-06-04 14:00:25 +02:00
Lennart Poettering
d414f41535 test: don't expect that clone() always makes it to the kernel
We might get EPERM on certain clone() flag combinations. Apparently in
Docker for example.

Prompted by: https://github.com/systemd/systemd/pull/19800#issuecomment-854196491
2021-06-04 13:38:00 +02:00
Zbigniew Jędrzejewski-Szmek
ba405b2200 TODO: coalesce entries for tmpfiles 2021-06-04 12:21:19 +02:00
Zbigniew Jędrzejewski-Szmek
bd6d28f21a tmpfiles: do not check if unresolved globs are autofs paths
With the previous commit, we would not complain about the not-found path, but
the check is still not useful. We use a libc function to resolve the glob, and
it has no notion of treating autofs specially. So we can't avoid touching
autofs when resolving globs. But usually the glob is found in the last
component of the path, so if we strip the glob part, we can still do a useful
check in many cases. (E.g. if /var/tmp is on autofs, something like
"/var/tmp/<glob>" is much more likely than "/var/<glob-that-matches-tmp>/<something>".)

With the system config in F34, we check the following prefixes:

/var/tmp/abrt/* → /var/tmp/abrt/
/run/log/journal/08a5690a2eed47cf92ac0a5d2e3cf6b0/*.journal* → /run/log/journal/08a5690a2eed47cf92ac0a5d2e3cf6b0/
/var/lib/systemd/coredump/.#core*.21e5c6c28c5747e6a4c7c28af9560a3d* → /var/lib/systemd/coredump/
/tmp/podman-run-* → /tmp/
/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-*/tmp → /tmp/
/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-* → /tmp/
/tmp/containers-user-* → /tmp/
/var/tmp/beakerlib-* → /var/tmp/
/var/tmp/dnf*/locks/* → /var/tmp/
/var/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-*/tmp → /var/tmp/
/var/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-* → /var/tmp/
/var/tmp/abrt/* → /var/tmp/abrt/
/var/tmp/beakerlib-* → /var/tmp/
/var/tmp/dnf*/locks/* → /var/tmp/
/tmp/podman-run-* → /tmp/
/tmp/containers-user-* → /tmp/
/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-* → /tmp/
/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-*/tmp → /tmp/
/var/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-* → /var/tmp/
/var/tmp/systemd-private-21e5c6c28c5747e6a4c7c28af9560a3d-*/tmp → /var/tmp/
/var/lib/systemd/coredump/.#core*.21e5c6c28c5747e6a4c7c28af9560a3d* → /var/lib/systemd/coredump/
/run/log/journal/08a5690a2eed47cf92ac0a5d2e3cf6b0/*.journal* → /run/log/journal/08a5690a2eed47cf92ac0a5d2e3cf6b0/
2021-06-04 12:21:19 +02:00
Zbigniew Jędrzejewski-Szmek
1e472a6ce4 basic/glob-util: add helper to strip the glob part from a glob 2021-06-04 12:21:19 +02:00
Zbigniew Jędrzejewski-Szmek
19c79550b4 tools/analyze-dump-sort: a helper to compare two 'systemd-analyze dump' outputs
Lines in the dumps are ordered by some pseudo-random hashmap entry order, which
makes it hard to diff two outputs. This sort the entries alphabetically, and
also sorts items within the entries, and supresses timestamps and other fields
which always vary.

We could sort the output inside of systemd itself, but it'd make things more
complex, and we probably don't need output to be sorted in most cases. It also
wouldn't be enough, because timestamps and such would still need to be ignored
to do a nice diff. So I think doing the sorting and suppression in a python
helper is a better approach.
2021-06-04 12:09:58 +02:00
Zbigniew Jędrzejewski-Szmek
771bdb6aae docs/ARCHITECTURE: more markup and unicode 2021-06-04 10:51:19 +02:00
Zbigniew Jędrzejewski-Szmek
287079696c NEWS: adjust grammar and other small changes 2021-06-04 10:51:19 +02:00
Yu Watanabe
4076ad9daf fix typo 2021-06-04 10:37:40 +02:00
Lennart Poettering
00d06c996d docs: use uppercase letters in title
We usually do it that way, do so here, too.
2021-06-04 10:34:56 +02:00
Lennart Poettering
99c2a9552b more 249 NEWS work 2021-06-04 10:34:02 +02:00
Yu Watanabe
78d8eae9a5 util: drop DEV_NUM_PATH_MAX and xsprintf_dev_num_path() 2021-06-04 15:51:39 +09:00
Yu Watanabe
902b4c677e util: move device-node.[ch] to shared 2021-06-04 15:51:39 +09:00
Yu Watanabe
ebb0a0155d udev: warn and propagate error in creating device symlink
Also, this makes the file in /run/udev/links/ is kept on failure, as the
target of the symbolic link may be belonging to another device.
2021-06-04 15:51:39 +09:00
Yu Watanabe
c891389a16 udev: try to create device symlink directly only when the link does not exist yet 2021-06-04 15:51:39 +09:00
Yu Watanabe
5802d4ea03 udev: extract same logic of creating device symlink
This also limits the number of trial.
2021-06-04 15:51:39 +09:00
Yu Watanabe
1ddfb6cf29 udev: use path_extract_directory() and path_equal() 2021-06-04 15:51:39 +09:00
Yu Watanabe
f3b393e951 udev: refuse to create device symlink when a non-symlink file already exists 2021-06-04 15:51:39 +09:00
Yu Watanabe
d2b50631fb udev: make link_find_prioritized() return 0, 1, or negative errno 2021-06-04 15:51:39 +09:00
Yu Watanabe
e7f3b33e70 udev: slightly update log message and adjust log level 2021-06-04 15:51:39 +09:00
Yu Watanabe
a33dc87e42 udev: logs if failed to remove devlink 2021-06-04 15:51:39 +09:00