1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-08 05:57:26 +03:00

63131 Commits

Author SHA1 Message Date
Martin Wilck
6d5eba0814 units: modprobe@.service: don't unescape instance name
modprobe treats "-" and "_" interchangeably, thereby avoiding frequent
errors because some module names contain dashes and others underscores.

Because modprobe@.service unescapes the instance name, an attempt to
start "modprobe@dm-crypt.service" will run "modprobe -abq dm/crypt",
which is doomed to fail. "modprobe@dm_crypt.service" will work as
expected. Thus unescaping the instance name has surprising side effects.
Use "%i" instead.

(cherry picked from commit bf25cf6c49253e922524dfa0e7960f554838f18b)
(cherry picked from commit c98d0130dc8efd826cd85020337353cdbe644bb4)
2023-11-09 21:05:51 +00:00
Franck Bui
0a48f8ac7b test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.

(cherry picked from commit a1af99df8e29ffb55b0c698eeda2c9bf795fc0e1)
(cherry picked from commit db2193609e554732c0288ccf27d5e58083f9219c)
2023-11-09 21:05:51 +00:00
Yu Watanabe
be72aa0bf2 fuzz: include library headers first
(cherry picked from commit f3d84e20c9f1d8892f4f8d336041cacf0b6936c7)
(cherry picked from commit 2fedbd12768f32a5b081258fbeb00003b02edd42)
2023-11-09 21:05:51 +00:00
Joerg Behrmann
e31805d26a credentials: document that their path is stable for system services
(cherry picked from commit cf37171890bdaec1dc0cd56828047f4eb899fc3a)
(cherry picked from commit 823216d61f6291d7fc13c271bfda368513440a4c)
2023-11-09 21:05:51 +00:00
Lennart Poettering
b5e10fd566 man: document the order in which we talk to DNS servers
(cherry picked from commit 612a91c11ae2c3183cb27fa0841a997eefb71fbb)
(cherry picked from commit 259a6a3f51f425c08688c56c2cf23d37bb0aa2df)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
e483b89165 test-recurse-dir: work around nftw() ignoring symlinks()
We have a test where we compare the results from nftw() and our own
resurce_dit_at(). nftw() skips a dangling symlink when running under mkosi and
the test fails. I don't understand why nftw() does that, but in our code we
don't need to test and care about the details of nftw(), which we don't use,
outside of the one test, so let's just skip symlinks in the test.

Closes #29603.

(cherry picked from commit 974959e6f6352b76355b76ab550c0e729b2a8c21)
(cherry picked from commit 7db0b4c8df422fafa245f7ab0833b0ec764174ad)
2023-11-09 21:05:51 +00:00
Lennart Poettering
45931776bf test-cgroup: make test case a bit more robust towards previous aborted runs
(cherry picked from commit d0547385d9da980ca752e1f5df959280a053fdb4)
(cherry picked from commit bcc8f8a96431ef51591a08f78d4e2b365241c36a)
2023-11-09 21:05:51 +00:00
Lennart Poettering
4cf18fce15 run: pin the unit we invoke continously while we are running
We read properties of the unit, hence it shouldn't be GC'ed as long as
we run. Hence, let's just set AddRef unconditionally for the units we
create.

(cherry picked from commit 49a510eba29c78f4b7dc1c39391314a48eb8833b)
(cherry picked from commit 8326f9e378333ae01f686086bb1fd4d300d7c99b)
2023-11-09 21:05:51 +00:00
Priit Laes
3ac8834559 systemd-journal-upload: Increase failure tolerance (#19426, #2877)
As systemd-journal-upload deals mostly with remote servers, add
some failsafes to its unit to restart on failures.

```
[Service]
Restart=on-failure
RestartSteps=10
RestartMaxDelaySec=60
```

(cherry picked from commit c08bec1587e102dd0435969e422288d69431e92c)
(cherry picked from commit fe0bf9f61913d70739359268134cbd10e375fe93)
2023-11-09 21:05:51 +00:00
Yu Watanabe
9033f481f2 network: do not trigger assertion by forcerenew command
When DHCP server is not running, sending force-renew command triggers
assertion.

(cherry picked from commit d311f5e277ae3609e661415b6c429fe3cd25e40b)
(cherry picked from commit 2cd9de1bbd76fc8a4f8cc0b10ea7cbb78fe0db1d)
2023-11-09 21:05:51 +00:00
Yu Watanabe
1da2d9301c sd-dhcp-server: make sd_dhcp_server_is_running() silently work with NULL
We already do in the same way for sd-dhcp-client and friends.

(cherry picked from commit 39ba10f19e7d384ad48aaad9ff6c0b3c3e6bbef1)
(cherry picked from commit a7117e29f59fa6a81eb7025ec446b95c6b35f91a)
2023-11-09 21:05:51 +00:00
Yu Watanabe
073d2db589 network: restart dhcp4 client when renewing lease is requested but the client is stopped
Follow-up for fc35a9f8d1632c4e7a279228f869bfc77d8f5b9c.

Fixes the issue https://github.com/systemd/systemd/pull/29472#issuecomment-1759092138.

(cherry picked from commit 9bd91e34aaf7c759617d4763853e55f419c06ffe)
(cherry picked from commit f453cbc5162eca42c415b8dc2325a7d734aca3e5)
2023-11-09 21:05:51 +00:00
Yu Watanabe
ca1a43c56b core/execute: suppress logs if LogLevelMax= is specified
Fixes #29532.

(cherry picked from commit 3bb424c837eca2d8041f9e000a268a6a2b582981)
(cherry picked from commit 053e120636f031e0b7d185b4136ad3e10c13d8de)
2023-11-09 21:05:51 +00:00
Lennart Poettering
f7022ac612 bpf-lsm: suppress noisy debug log message if we remove a unit from the bpf-lsm table where it was never added
There's really no point in logging about one of the most common cases we
have: that no BPF-LSM policy was installed for a specific unit.

(cherry picked from commit 58f1bd9b4ab889d0378a236d759649d4b45395f9)
(cherry picked from commit 86a85cb2b56f582c3a1e09d17a7f544bad0c23a7)
2023-11-09 21:05:51 +00:00
Lennart Poettering
062e3032e2 fdset: improve debug logging for left-over fds
Let's show which fds are closed as part of the left-over fd set logic on
daemon reload/reexec cycles.

This is useful to debug accidentally unclaimed fds.

(cherry picked from commit 91a6447607635802ac2278b7997cde687e2549a4)
(cherry picked from commit b4cdf320554f122700e9d12c81dccf2c7565860b)
2023-11-09 21:05:51 +00:00
Lennart Poettering
44e3e23013 limits-util: suppress noisy debug message when reading tasks in top-level cgroup
We have the "tasks.max" cgroup attribute only if we run in a cgroup
namespace, but not on the host. Hence let's handle ENODATA silently
simply to reduce the debug noise generated.

(cherry picked from commit bde7e12255a82f9b714fb3e44c291a79f7647cc9)
(cherry picked from commit d3a5c9f0bc030d8ba0ef8abb190afacb9cd06682)
2023-11-09 21:05:51 +00:00
Roland Hieber
5cacdfdb20 sd-gpt: add defines for big-endian MIPS/MIPS64
According to the respective change in the DPS:
<https://github.com/uapi-group/specifications/pull/86>

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
(cherry picked from commit 7c6dd200468f88c189d042c7ee25547032e296cd)
(cherry picked from commit 9f415a6347f6dbe725da5ef632b33e422a2845e8)
2023-11-09 21:05:51 +00:00
Lennart Poettering
50e8f0efc9 dissect: don't show non-JSON arch + sector size in JSON mode
(cherry picked from commit 66cd3537f9c27818993de4cd9360283cbdb8293c)
(cherry picked from commit 8cd7bdadc89c8c7c5e86a5482694a3075860e6f3)
2023-11-09 21:05:51 +00:00
Luca Boccassi
39a3d759a8 dissect: avoid clobbering device-mapper error when activating verity
The device-mapper driver can return a wild variety of errors when trying
to activate the same dm-verity volume concurrently, as it might happen
with an image. There is a fallback logic in place, but the original
return code was clobbered when userspace signature check was added.
Add it back.

Follow-up for c2fa92e7e8907d9

(cherry picked from commit ace07128ac014d5e7d7d1664beb58e5f3700d59c)
(cherry picked from commit c2155c19c06dfe5dd086f7b62c30762e3e5aad92)
2023-11-09 21:05:51 +00:00
Yu Watanabe
f1bf7d766c tree-wide: add missing sigbus handling
(cherry picked from commit 955fc5d8ab153ce144d05f0e98120eb9c14bc86c)
(cherry picked from commit 318441e342870c57ec8173532d6781579f99a76a)
2023-11-09 21:05:51 +00:00
Luca Boccassi
a9f38811bb core: improve debug logs when failing to create symlinks in namespaces
I am seeing some failures and I don't know what is failing and why even
with debug logs, so add more details

(cherry picked from commit 15461b7f19272d39e59e4c6d87dfe9d48f4d1f99)
(cherry picked from commit 31f64d0bc81d5e40a03478206c7d805ce8595366)
2023-11-09 21:05:51 +00:00
Yu Watanabe
ec9a8acd8e fuzz: suppress log messages
(cherry picked from commit 042c91459aa234c9ce3b3ece0fdad8ba568018f2)
(cherry picked from commit 51bbd1e6bad8857d549092d9afb69e9585bd1c7c)
2023-11-09 21:05:51 +00:00
felixdoerre
e140c1d10b journalctl: verify that old entries are not sealed with too recent key (#28885)
When verifying seals produced with forward secure sealing, the verification
currently does not check that old entries are only sealed with the key for
their epoch and not a more recent one. This missing check allows an attacker
to remove seals, and create new ones with the currently available key, and
verify will claim everything is in order, although all entries could have
been modified.

This resolves CVE-2023-31439.

Co-authored-by: Felix Dörre <felix.doerre@kit.edu>
(cherry picked from commit 3846d3aa292a6daa1916f667bdd79ebee9cb4ac4)
(cherry picked from commit ea67d4755b5d81a42a9013d6ce72c9cf7adb56b9)
2023-11-09 21:05:51 +00:00
Lennart Poettering
282e359e73 machinectl: align UID shift status field properly
(cherry picked from commit 3fe418a5713798112d19bfd689d33e39c60de927)
(cherry picked from commit 4252deebe741b6f5bb15f325e511bdeb351e2f71)
2023-11-09 21:05:51 +00:00
Mike Yuan
c145e530c0 systemctl-show: align "Cntrl PID" correctly
(cherry picked from commit 4146960ee95462dc98722e00041b2e77316e6036)
(cherry picked from commit ef816a5a4fe5530bab0f5e8420aa2a6180d445f5)
2023-11-09 21:05:51 +00:00
Daan De Meyer
61c5e3715d repart: Mention that xattrs are not copied when populating XFS with protofile
(cherry picked from commit 0e70150be31dbd748c7d2c66b2098998cea66c53)
(cherry picked from commit 8998892badd1d96cba2d52d8b5f87564b2d37ce0)
2023-11-09 21:05:51 +00:00
Emil Velikov
15ff497a72 bootctl: remove all our non-volatile variables on uninstall
Grepping around showed a few extra entries that are not listed in the
remove_loader_variables() function. Namely:
 - BootNext
 - OsIndications
 - LoaderConfigConsoleMode
 - LoaderEntryLastBooted

Of which the latter two are systemd specific, even though they are
undocumented. Ensure they're removed - follow-up commits will add
documentation references.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 976904bf26957e75dbed467334592badf108beee)
(cherry picked from commit c6540a35ab6913ccdc57720d2a9d4e3d86e9178e)
2023-11-09 21:05:51 +00:00
Emil Velikov
9163d0a4e7 sd-boot: introduce and use efivar_unset()
Currently some of the code base check for the variable presence before
removing it, and some do not.

More so, in all cases (being updated) we're dealing with non-volatile
variables where changing those attribute to NVRAM wear out.

From what information I could find, there is no definitive answer if the
UEFI implementation will write to the NVRAM even when the variable is
missing.

So add a simple helper that checks for the variable presence before
removing it. While also having a bit cleaner API than the current
efivar_set(..., NULL, ...);

efivar_unset() follows the design from efivar_set*() where it returns an
EFI_STATUS even though its (presently) unused.

v2:
 - add inline comment, use early return

v3:
 - typos? typos!

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 5ee3c914a4e904567e66654177b07777dde0d100)
(cherry picked from commit 917569e3c1e1361d2c7bac584b99e075a4cb0b0d)
2023-11-09 21:05:51 +00:00
Mike Yuan
a8b7bf4e3d man/systemd.exec: document that API fs are required to setup namespacing
Closes #27997

(cherry picked from commit 723c3cd03ce38235df948147150054ce95cb41df)
(cherry picked from commit c371368887611016f9171148f1b0c0b4fc582122)
2023-11-09 21:05:51 +00:00
Mike Yuan
e378c3360a man/systemd.exec: suffix one more directory with /
(cherry picked from commit 6460a89a1be7c11bc7b66a134701a07773869849)
(cherry picked from commit 188f7c043a077a7a01a7bc7bcb0bc34ffe89bfc8)
2023-11-09 21:05:51 +00:00
NRK
2b408a6220 macro: use __builtin_unreachable on NDEBUG
note that this slightly changes the semantic of assert when NDEBUG is
defined. if there's an extern function call (without attribute pure or
similar) then the compiler has to assume it has side effects and still
emit the function call.

whereas the old assert guaranteed that nothing will be evaluated on
NDEBUG.

Closes: https://github.com/systemd/systemd/issues/29408
(cherry picked from commit be1666886b3f4355ab33f571187e3de8aae3ad40)
(cherry picked from commit a9b83fc26ccdb6ef83c8eb2b505ee4c25a320276)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
e1baefbb1f test-loopback: suppress warning about ignored unused result
(cherry picked from commit db5d86f5b9fd86231e841df5dc8d0fd993e00761)
(cherry picked from commit accda51ef6ffaee074662df5b28014c9babae543)
2023-11-09 21:05:51 +00:00
Yu Watanabe
ee58332333 man: update the list of ignored options by Anonymize=yes
Closes #29362.

(cherry picked from commit fcf17d693c063733addad26115271baf4b433857)
(cherry picked from commit 065725aba3d7931c7c262716ee716b7631c2dabd)
2023-11-09 21:05:51 +00:00
Max Kellermann
227dc1149a test/test-chown-rec: skip ACL tests if kernel has no ACL support
The second half of `chown_recursive` works only if the kernel has ACL support.

(cherry picked from commit ec757e920c9f57a89a4378c10cd96264b058f418)
(cherry picked from commit 756a42cd1ea7d66d93337791fbe03e0f648bfb36)
2023-11-09 21:05:51 +00:00
Luca Boccassi
5b900490f9 test: fix check in test unit in TEST-50-DISSECT
'[[ not found'

(cherry picked from commit c7986bc9b64e095399c3e380441b4de26d1276a1)
(cherry picked from commit 52d4f5ec539c746c9a61a3bb4607f965a36675fe)
2023-11-09 21:05:51 +00:00
Daan De Meyer
f6732ab3d9 mount: Log when we can't create the mount point
Debugging mount unit failures caused by systemd not being able to
create the mount point is currently rather hard. Let's log about
failures to create mount points to simplify debugging.

(cherry picked from commit ce427d0e73667e1b125c82c5c77f98dd9fbe561d)
(cherry picked from commit 915f25da9ebbe93d9768eca3b82897bb9fddc42b)
2023-11-09 21:05:51 +00:00
Maanya Goenka
3f5729a51a fix: do not check/verify slice units if recursive errors are to be ignored
Before this fix, when recursive-errors was set to 'no' during a systemd-analyze
verification, the parent slice was checked regardless. The 'no' setting means that,
only the specified unit should be looked at and verified and errors in the slices should be
ignored. This commit fixes that issue.

Example:

Say we have a sample.service file:

[Unit]
Description=Sample Service

[Service]
ExecStart=/bin/echo "a"
Slice=support.slice

Before Change:

systemd-analyze verify --recursive-errors=no maanya/sample.service
Assertion 'u' failed at src/core/unit.c:153, function unit_has_name(). Aborting.
Aborted (core dumped)

After Change:
systemd-analyze verify --recursive-errors=no maanya/sample.service
{No errors}

(cherry picked from commit f660c7fa56b247c278fdb2ebcfea37912f249524)
(cherry picked from commit e48c57c5c2f6af3601f6e0f66d77e548efe14f93)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
6064d89dc6 exec-util: print executed commands in do_execute()
kernel-install uses do_execute(). We would log whenever a spawned child
finished, but we would not log anything when the child is launched. When the
children log output without a prefix (as the kernel-install plugins do), it
is hard to see where that output is coming from.

(cherry picked from commit 9ec4f7c7a4f4d56de6d00adbfe5d316edd0ec314)
(cherry picked from commit da0536a111605666b3ef165d494d5bacb262076b)
2023-11-09 21:05:51 +00:00
Lennart Poettering
6218be1a7f bootctl: highlight SecureBoot enabled state in green
(cherry picked from commit 4ed9e2619c630679b2fac1fc0eb4ab4b55f02871)
(cherry picked from commit 97712df9c8b69e0bde261096b0540a063490efbe)
2023-11-09 21:05:51 +00:00
Lennart Poettering
a4d0fe64fa bootctl: if we can't access the ESP, show this in regular status output
(cherry picked from commit a730a8f608a3a8dbef4ce1a6e939ced47c63063c)
(cherry picked from commit 50df52593c151b015a4b65989e4d5f3d4b28b00a)
2023-11-09 21:05:51 +00:00
Mike Yuan
964b43566c systemctl: reflect that statically enabled units can be in .upholds/
Follow-up for 38f901791f3c4b1cbd04b71323bbef2fdab65f83

(cherry picked from commit 1f998158a988fcf4cd182d9de27e1d8b16cfe474)
(cherry picked from commit 839117de6c93fcdac201f38e84c0cc1a4b2db638)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
522ebdcfd4 man/crypttab: fix indentation
(cherry picked from commit 5f5f1ba169b12cb342fb939a02bd8336eb9be69e)
(cherry picked from commit e78fdc8ae99a4e2e0f0ee040c4ae7969d46671ec)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
bf19ea3fb9 man/cryptenroll: link to crypttab(5) for examples
I was missing an example of how to use cryptenroll. We have that, but in
another page. Instead of repeating, let's just direct the user to the right
place.

Also, reformat synopsis to the "official" non-nested syntax.

(cherry picked from commit 38e3c61dbb1ad69e7df910d07fa8b47f3d97f660)
(cherry picked from commit ddfbdad6bbbad1b92f8cad64582edba93bfd3221)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
109168ee2d basic/path-util: change 'char *func' to 'char* func'
Both styles were mixed in the file, but I find the latter much nicer,
because it's not the func that is the pointer, but the return type.

(cherry picked from commit 00d811a5482fda1a6c2b9362d047da2dcd1d7418)
(cherry picked from commit 3fec10d500a48aefc88beaa02ea6e623641125b5)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
3cbdcfda5f basic/path-util: do not say that /dev and /sys are device paths
"/dev" or "/dev/" is the mount point, not a device path. In particular,
'systemctl status /dev' clearly does not refer to a device, so let's tweak
the code a bit to say that those are not device paths.

(Treating "/../dev" same as "/dev" would be also be reasonable, but that
requires chase(), which requires disk access, which we don't want to do from
this lightweight function.)

(cherry picked from commit 8f1998b8d3a5bfe61ee4d6d6aa6bb2efb94074c0)
(cherry picked from commit fc13a268128c25e9da18f7dd11c5b524cc8ae1c2)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
7cf55c8424 test-path-util: add simple test for is_path() and is_device_path()
I think that those functions should be adjusted, but let's first add a test to
establish current behaviour.

(cherry picked from commit bf9a49a5534316353b9fdda1c40026781bc6bda8)
(cherry picked from commit 1025ef21a2aae52ff9a71547f8faa728e0477557)
2023-11-09 21:05:51 +00:00
Yu Watanabe
10397b6487 network: fix json format for SIP servers
Fixes a bug introduced by 0843ec6c44c7b41b14f6f32d3ee7039e5e615296.

Fixes https://github.com/systemd/systemd/issues/29145.

(In upstream, the issue is fixed by 8d3c5b39b9bbc89953d1da3e9fbff1524c952ac6).
2023-10-04 09:50:16 +01:00
Zbigniew Jędrzejewski-Szmek
1575f1d9e7 shared/creds-util: return 0 for missing creds in read_credential_strings_many
Realistically, the only thing that the caller can do is ignore failures related
to missing credentials. If the caller requires some credentials to be present,
they should just check which output variables are not NULL. One of the callers
was already doing that, and the other wanted to, but missed -ENOENT. By
suppressing -ENOENT and -ENXIO, both callers are simplified.

Fixes a warning at boot:
systemd-vconsole-setup[221]: Failed to import credentials, ignoring: No such file or directory

(cherry picked from commit 55ace8e5c58441d1a2c64b297a38b232ef0c0e28)
2023-10-03 13:33:09 +02:00
Zbigniew Jędrzejewski-Szmek
f9593abaf4 hwdb: update to git main from today
(cherry picked from commit ef6c2daf9947d23e2ba6d50c42e4a0d79fe8d32c)
v253.12
2023-09-28 14:40:43 +01:00
Daan De Meyer
ce0e97e3a8 journal: Stop trying to open runtime journal once flushed
Once we've flushed the runtime journal to /var, stop trying to open
it since that will just fail with ENOENT all the time.

(cherry picked from commit 418a4987775280adef4e6ac4e474937ea89f0f5c)
(cherry picked from commit 01469405c7b9ef175a16c89c4a518798d2c8f65d)
2023-09-28 14:40:43 +01:00