]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agoTEST-13-NSPAWN: re-enable KILL test 34776/head
Yu Watanabe [Tue, 15 Oct 2024 08:28:17 +0000 (17:28 +0900)] 
TEST-13-NSPAWN: re-enable KILL test

7 months agonspawn: introduce --cleanup option to clear propagation and unix-export directories
Yu Watanabe [Tue, 15 Oct 2024 08:25:09 +0000 (17:25 +0900)] 
nspawn: introduce --cleanup option to clear propagation and unix-export directories

This is useful when the previous invocation is unexpectedly killed.

Otherwise, if systemd-nspawn is killed forcibly, then unix-export
directory is not cleared and unmounted, and the subsequent invocation
will fail. E.g.
===
[   18.895515] TEST-13-NSPAWN.sh[645]: + machinectl start long-running
[   18.945703] systemd-nspawn[1387]: Mount point '/run/systemd/nspawn/unix-export/long-running' exists already, refusing.
[   18.949236] systemd[1]: systemd-nspawn@long-running.service: Failed with result 'exit-code'.
[   18.949743] systemd[1]: Failed to start systemd-nspawn@long-running.service.
===

7 months agoFix bootctl status to not print strange glyphs in logs (#36745)
Yu Watanabe [Sat, 15 Mar 2025 20:56:55 +0000 (05:56 +0900)] 
Fix bootctl status to not print strange glyphs in logs (#36745)

7 months agonetwork: fix unexpected removal of routes on restart even when KeepConfiguration...
Yu Watanabe [Sat, 15 Mar 2025 14:19:49 +0000 (23:19 +0900)] 
network: fix unexpected removal of routes on restart even when KeepConfiguration=yes (#36756)

7 months agobootctl: do not print special glyphs to the log 36745/head
Zbigniew Jędrzejewski-Szmek [Sun, 9 Mar 2025 09:50:04 +0000 (10:50 +0100)] 
bootctl: do not print special glyphs to the log

The log line looked like this:
  bootctl[1457]: ! Mount point '/efi' which backs the random seed file is world accessible, which is a security hole! !
which doesn't look nice.

Also upgrade the message to error. This is something to fix.

7 months agobasic/glyph-util: introduce optional_glyph() to wrap emoji_enabled()
Zbigniew Jędrzejewski-Szmek [Sun, 9 Mar 2025 09:43:25 +0000 (10:43 +0100)] 
basic/glyph-util: introduce optional_glyph() to wrap emoji_enabled()

7 months agobasic/glyph-util: rename "special glyph" to just "glyph"
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 09:42:04 +0000 (10:42 +0100)] 
basic/glyph-util: rename "special glyph" to just "glyph"

Admittedly, some of our glyphs _are_ special, e.g. "O=" for SPECIAL_GLYPH_TOUCH ;)
But we don't need this in the name. The very long names make some invocations
very wordy, e.g. special_glyph(SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY).
Also, I want to add GLYPH_SPACE, which is not special at all.

7 months agoseveral fixes for Coverity (#36753)
Luca Boccassi [Sat, 15 Mar 2025 11:46:14 +0000 (11:46 +0000)] 
several fixes for Coverity (#36753)

7 months agotest-cgroup-util: allow ESRCH in cg_pidref_get_path() and friends 36753/head
Yu Watanabe [Sat, 15 Mar 2025 01:46:36 +0000 (10:46 +0900)] 
test-cgroup-util: allow ESRCH in cg_pidref_get_path() and friends

As the process may be already dead.

Follow-ups for ca82f0cbe2db096bc7ff81280b5683ea1beae534.

7 months agotest-network: check that network configuration is stable with KeepConfiguration=yes 36756/head
Matteo Croce [Wed, 12 Mar 2025 13:36:14 +0000 (14:36 +0100)] 
test-network: check that network configuration is stable with KeepConfiguration=yes

Check that when networkd restarts, and the network configures
KeepConfiguration=yes, the network configuration is never changed.

Ensure this by dumping the `ip monitor` output when networkd is restarting.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
7 months agonetwork: do not remove static routes on other interfaces that are currently in the...
Yu Watanabe [Sat, 15 Mar 2025 00:38:09 +0000 (09:38 +0900)] 
network: do not remove static routes on other interfaces that are currently in the pending state

Otherwise, even if .network file has KeepConfiguration=yes, routes on
an interfaces may be removed on restart.

Fixes a bug introduced by 8d01e44c1f0e00b414d36bd1b46ecff548242208.

7 months agotest: drop redundant parentheses in ASSERT_OK() and friends
Yu Watanabe [Sat, 15 Mar 2025 00:04:25 +0000 (09:04 +0900)] 
test: drop redundant parentheses in ASSERT_OK() and friends

This reverts 278e3adf50e36518c5a5dd798ca998e7eac5436e, and drop more
redundant parentheses, as they unfortunately does not suppress the
false-positive warnings by coverity.

7 months agomeson: handle bool-compare warning as error
Yu Watanabe [Fri, 14 Mar 2025 22:21:33 +0000 (07:21 +0900)] 
meson: handle bool-compare warning as error

Then we can detect the error fixed by the previous commit like the following:

../src/libsystemd/sd-device/test-sd-device.c: In function ‘test_sd_device_enumerator_add_all_parents’:
../src/shared/tests.h:225:51: error: comparison of constant ‘0’ with boolean expression is always true [-Werror=bool-compare]
  225 | #define ASSERT_OK(expr) __coverity_check__((expr) >= 0)
      |                                                   ^~
../src/libsystemd/sd-device/test-sd-device.c:547:9: note: in expansion of macro ‘ASSERT_OK’
  547 |         ASSERT_OK(sd_device_enumerator_add_all_parents(e) >= 0);
      |         ^~~~~~~~~

7 months agotest: fix wrong use of ASSERT_OK() and friends
Yu Watanabe [Fri, 14 Mar 2025 22:20:45 +0000 (07:20 +0900)] 
test: fix wrong use of ASSERT_OK() and friends

7 months agotests: replace ASSERT_OK() and friends with coverity firendy function
Yu Watanabe [Fri, 14 Mar 2025 21:51:18 +0000 (06:51 +0900)] 
tests: replace ASSERT_OK() and friends with coverity firendy function

We already have done the same for assert_se() since
d9fb7afb4890a93db478616e7bfc639b2129b466.

Hopefully this makes coverity silent about the false-positive side-effect
warnings.

7 months agotest-macro: CONST_MAX() and friends may return (void*)0 when built under coverity
Yu Watanabe [Fri, 14 Mar 2025 21:48:37 +0000 (06:48 +0900)] 
test-macro: CONST_MAX() and friends may return (void*)0 when built under coverity

See 963c6c90af87fdf8b7dcb942991fb018b87fea07.

7 months agojournal-remote: added custom headers support
Andrii Chubatiuk [Wed, 16 Oct 2024 12:06:19 +0000 (15:06 +0300)] 
journal-remote: added custom headers support

7 months agoudevadm: check number of passed arguments
Lennart Poettering [Fri, 14 Mar 2025 10:43:07 +0000 (11:43 +0100)] 
udevadm: check number of passed arguments

We didn't check the number of arguments first, hence ended up outputting
some ugly complaints with `(null)` in a format string. And what's worse
accepted any number of arguments, where we'd ignore all but the first
two though.

7 months agofirstboot: welcome user with emoji in firstboot wizard 🧙
Lennart Poettering [Fri, 14 Mar 2025 14:44:31 +0000 (15:44 +0100)] 
firstboot: welcome user with emoji in firstboot wizard 🧙

7 months agoRestore docs/PAX_CONTROL_GROUPS
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 10:33:55 +0000 (11:33 +0100)] 
Restore docs/PAX_CONTROL_GROUPS

This partially reverts 8d04b8198d4c0cca0118f731369ad7156f0726b6.
If we completely drop the file, users will get a 404. But this document
has been in place for a long time and is referred to in many other places,
incl. our old wiki at https://www.freedesktop.org/wiki/Software/.
The page already says that it's been replaced
("… Please consult this document only as a historical reference. …").
We should only remove it from the index (which
8d04b8198d4c0cca0118f731369ad7156f0726b6 did).

In general, let's be more careful about preserving link stability.
When we change something in a way that breaks URLs, we're creating
pain for users.

7 months agodocs/ROOTFS_DISCOVERY: removed doubled dot
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 10:06:37 +0000 (11:06 +0100)] 
docs/ROOTFS_DISCOVERY: removed doubled dot

Inadvertent change in 487b95d9b6eb42c5213f413308b915e8be17d509.

7 months agomkosi: update debian commit reference
Luca Boccassi [Thu, 13 Mar 2025 13:12:42 +0000 (13:12 +0000)] 
mkosi: update debian commit reference

d8c7f8f7f4 Update changelog for 257.4-2 release
f74cf88300 Split bootctl to new systemd-boot-tools package
10a8764966 Update changelog for 257.4-1 release

7 months agoanalyze: don't connect to bus from analyze test run (#36719)
Lennart Poettering [Thu, 13 Mar 2025 16:51:45 +0000 (17:51 +0100)] 
analyze: don't connect to bus from analyze test run (#36719)

This thing should not be "live", hence don't try to connect to the bus,
or bind the private bus socket.

Fixes: #36540
7 months agoemergency-action: sleep 5s before rebooting in various cases
Lennart Poettering [Wed, 12 Mar 2025 10:17:29 +0000 (11:17 +0100)] 
emergency-action: sleep 5s before rebooting in various cases

This adds a new EMERGENCY_ACTION_SLEEP_5S flag, which when set will
delay the emergency action for 5s. This is supposed to be used together
with EMERGENCY_ACTION_WARN so that users can actually read the message
we output.

We enable this with all emergency action requests that already set
EMERGENCY_ACTION_WARN, except for the 7x ctrl-alt-del burst reboot,
where the user knows what they do and there's no real reason to wait,
they don't need to be informed.

This also enables both EMERGENCY_ACTION_WARN + EMERGENCY_ACTION_SLEEP_5S
for FailureAction= processing of regular units, where these were so far
off. (it leaves this off for SuccessAction= however!). This is a good
thing to make things more debuggable: if something fails and we reboot
this really deserves notification of the user.

(For SuccessAction= this logic does not apply, since the shutdown action
induced here is apparently intended part of the codeflow, for example in
systemd-reboot.service or a similar unit, where the shutdown is goal and
not exception and derserves no additional noisy reporting).

Inspired by: https://github.com/systemd/systemd/pull/36705#issuecomment-2717014120

7 months agodocs/ROOTFS_DISCOVERY: minor wording and syntactic improvements
Zbigniew Jędrzejewski-Szmek [Thu, 13 Mar 2025 13:29:17 +0000 (14:29 +0100)] 
docs/ROOTFS_DISCOVERY: minor wording and syntactic improvements

7 months agotest-execute: prominently show which test we are about to enter 36719/head
Lennart Poettering [Thu, 13 Mar 2025 10:49:13 +0000 (11:49 +0100)] 
test-execute: prominently show which test we are about to enter

7 months agoexecute: add some minor debug logging
Lennart Poettering [Thu, 13 Mar 2025 10:43:08 +0000 (11:43 +0100)] 
execute: add some minor debug logging

7 months agopid1: don't connect to oomd in test runs
Lennart Poettering [Thu, 13 Mar 2025 10:13:44 +0000 (11:13 +0100)] 
pid1: don't connect to oomd in test runs

7 months agoanalyze: don't connect to bus from analyze test run
Lennart Poettering [Wed, 12 Mar 2025 17:19:34 +0000 (18:19 +0100)] 
analyze: don't connect to bus from analyze test run

This thing should not be "live", hence don't try to connect to the bus,
or bind the private bus socket.

Fixes: #36540
7 months agomanager: explicitly create our private runtime directory
Lennart Poettering [Thu, 13 Mar 2025 10:43:46 +0000 (11:43 +0100)] 
manager: explicitly create our private runtime directory

So far /run/systemd/ was created as side-effect of initializing the
D-Bus client/server. But in one of the next commits we'll suppress
connecting to D-Bus in test runs, hence let's move the logic our of the
D-Bus code and into manager_startup().

Then, also drop creating it again and again in PID 1 at various places,
and just rely on it to exist.

7 months agocoredump,analyze: use read_full_file() for reading various top-level /proc/ files
Lennart Poettering [Thu, 13 Mar 2025 08:30:23 +0000 (09:30 +0100)] 
coredump,analyze: use read_full_file() for reading various top-level /proc/ files

Kernel API file systems typically use either "raw" or "seq_file" to
implement their various interface files. The former are really simple
(to point I'd call them broken), in that they have no understanding of
file offsets, and return their contents again and again on every read(),
and thus EOF is indicated by a short read, not by a zero read. The
latter otoh works like a typical file: you read until you get a
zero-sized read back.

We have read_virtual_file() to read the "raw" files, and can use regular
read_full_file() to read the "seq_file" ones.

Apparently all files in the top-level /proc/ directory use 'seq_file'.
but we accidentally used read_virtual_file() for them. Fix that.

Also clarify in a comment what the rules are.

Fixes: #36131
7 months agobootctl: make sure bootctl --image= works on image with /usr/ but without / (#36727)
Lennart Poettering [Thu, 13 Mar 2025 13:14:56 +0000 (14:14 +0100)] 
bootctl: make sure bootctl --image= works on image with /usr/ but without / (#36727)

```
Let's make sure we can use the tool on ParticleOS images. They have no
root fs by default (until they are instantiated), but always have /usr/.
Hence add DISSECT_IMAGE_USR_NO_ROOT which has the desired effect.
```

7 months agobootctl: tweak status output when operating on --image= files 36727/head
Lennart Poettering [Wed, 12 Mar 2025 20:59:49 +0000 (21:59 +0100)] 
bootctl: tweak status output when operating on --image= files

Let's not claim the system was not booted with UEFI if we use --image=.
The system wasn't booted at all, after all. Hence supress the whole
section altogether in this case.

7 months agobootctl: make sure bootctl --image= works on image with /usr/ but without /
Lennart Poettering [Wed, 12 Mar 2025 20:56:36 +0000 (21:56 +0100)] 
bootctl: make sure bootctl --image= works on image with /usr/ but without /

Let's make sure we can use the tool on ParticleOS images. They have no
root fs by default (until they are instantiated), but always have /usr/.
Hence add DISSECT_IMAGE_USR_NO_ROOT which has the desired effect.

7 months agoupdate TODO
Lennart Poettering [Thu, 13 Mar 2025 09:35:17 +0000 (10:35 +0100)] 
update TODO

7 months agoupdate TODO
Lennart Poettering [Thu, 13 Mar 2025 08:55:59 +0000 (09:55 +0100)] 
update TODO

7 months agotest-localed-util: use ASSERT_OK() and friends
Yu Watanabe [Thu, 13 Mar 2025 03:49:02 +0000 (12:49 +0900)] 
test-localed-util: use ASSERT_OK() and friends

7 months agoTEST-73-LOCALE: do not unnecessarily restart systemd-localed
Yu Watanabe [Thu, 13 Mar 2025 03:11:40 +0000 (12:11 +0900)] 
TEST-73-LOCALE: do not unnecessarily restart systemd-localed

It is not necessary to clear previous keymap assignment, as
`localectl set-keymap` will anyway overwrite the previous assignment.

This drops the unnecessary restart of systemd-localed in the loop.
The mkosi test image contains about 500~700 keymaps. The test
performance is greatly improved by reducing the number of restarts,
especially when the test is running with sanitizers.

On Fedora 41 with sanitizers,
Before:
1/1 systemd:integration-tests / TEST-73-LOCALE OK             1157.50s
After:
1/1 systemd:integration-tests / TEST-73-LOCALE OK              104.43s

7 months agoFix several issues found by Coverity (#36726)
Yu Watanabe [Wed, 12 Mar 2025 22:54:06 +0000 (07:54 +0900)] 
Fix several issues found by Coverity (#36726)

7 months agocopy: Bubble up ENOSPC immediately in fd_copy_directory()
Daan De Meyer [Wed, 12 Mar 2025 16:07:55 +0000 (17:07 +0100)] 
copy: Bubble up ENOSPC immediately in fd_copy_directory()

It doesn't really make sense to continue once we start getting ENOSPC.

7 months agoman: document how Restart= reacts to oom kill
Lennart Poettering [Wed, 12 Mar 2025 21:08:46 +0000 (22:08 +0100)] 
man: document how Restart= reacts to oom kill

Fixes: #36529
7 months agonsresource: fix GID check in io.systemd.UserDatabase.GetGroupRecord method
Yu Watanabe [Wed, 12 Mar 2025 18:27:31 +0000 (03:27 +0900)] 
nsresource: fix GID check in io.systemd.UserDatabase.GetGroupRecord method

Fixes a bug in 8aee931e7ae1adb01eeac0e1e4c0aef6ed3969ec (v256).

7 months agogetty-generator: don't use "3270!tty1" when instantiating serial-getty@.service on...
Franck Bui [Wed, 12 Mar 2025 16:51:39 +0000 (17:51 +0100)] 
getty-generator: don't use "3270!tty1" when instantiating serial-getty@.service on s390x

Path of the 3270 console in /sys is "/sys/class/tty/3270!tty1" but its device
node is "/dev/3270/tty1".

7 months agonsresource: fix error handling
Yu Watanabe [Wed, 12 Mar 2025 18:21:01 +0000 (03:21 +0900)] 
nsresource: fix error handling

7 months agoboot: several follow-ups for reboot-on-error feature (#36721)
Yu Watanabe [Wed, 12 Mar 2025 20:26:47 +0000 (05:26 +0900)] 
boot: several follow-ups for reboot-on-error feature (#36721)

7 months agoudev/net: enable new [EnergyEfficientEthernet] section
Yu Watanabe [Wed, 12 Mar 2025 15:56:28 +0000 (00:56 +0900)] 
udev/net: enable new [EnergyEfficientEthernet] section

Also fixes a typo in setting name.

Follow-up for cdc9be29b1f4eefd5d384b0a9fed25675c66def5.
Addresses post-merge comments for #36302.

7 months agounits: order oomd after swap.target
Lennart Poettering [Wed, 12 Mar 2025 16:13:24 +0000 (17:13 +0100)] 
units: order oomd after swap.target

oomd only works well if we have swap, hence we should not start it
before swaps are up, in particular as we will print an annoying message
otherwise.

Fixes: #36704
7 months agotest: wrap assignments in ASSERT_OK() and friends with parentheses 36726/head
Yu Watanabe [Wed, 12 Mar 2025 20:07:54 +0000 (05:07 +0900)] 
test: wrap assignments in ASSERT_OK() and friends with parentheses

Hopefully fixes many CID reports.

7 months agotest-netlink: fix use of ASSERT_OK()
Yu Watanabe [Wed, 12 Mar 2025 20:11:11 +0000 (05:11 +0900)] 
test-netlink: fix use of ASSERT_OK()

Follow-up for 3841288e5f8583208550f8215443bf8da6080fd1.

7 months agohomed: fix OOM check
Yu Watanabe [Wed, 12 Mar 2025 19:55:34 +0000 (04:55 +0900)] 
homed: fix OOM check

Follow-up for f1b6417fea8ea1fb9a57f45b845ab1db944eca23.
Fixes CID#1593167.

7 months agohomectl: insert missing 'else'
Yu Watanabe [Wed, 12 Mar 2025 19:52:48 +0000 (04:52 +0900)] 
homectl: insert missing 'else'

Follow-up for cc14c14782d542b35fa12bfdadfd64ffa700cedf.
Fixes CID#1593168 and CID#1593166.

7 months agoboot: fallback to unrestricted allocation if initrd allocation doesn't fit below...
Lennart Poettering [Wed, 12 Mar 2025 19:14:40 +0000 (20:14 +0100)] 
boot: fallback to unrestricted allocation if initrd allocation doesn't fit below 4g (#36715)

Fixes: #36706
7 months agoudev: use INTERFACE property rather than sysname when processing network interface...
Yu Watanabe [Wed, 12 Mar 2025 19:12:57 +0000 (04:12 +0900)] 
udev: use INTERFACE property rather than sysname when processing network interface (#36627)

sd-device replaces '!' in sysname with '/', hence sysname may be
different from ifname.
Let's use INTERFACE property when we need network interface name.

This fixes the following unexpected renaming of network interfaces
created with '!' in their name, e.g. 'hoge!foo' -> 'hoge_foo':
```
$ run0 ip link add 'hoge!foo' type dummy
$ ip link show 'hoge!foo'
Device "hoge!foo" does not exist.
$ ip link show 'hoge_foo'
410: hoge_foo: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ee:54:4a:dd:c4:c7 brd ff:ff:ff:ff:ff:ff
```

Closes #26156.

7 months agoresolve: add warning comment to config file
Michael Catanzaro [Mon, 10 Mar 2025 18:11:54 +0000 (13:11 -0500)] 
resolve: add warning comment to config file

There are way too many users configuring the DNS= setting by mistake,
because what it seems to do is different from what it actually does. We
do not have consensus to change its behavior, so let's at least add a
warning comment.

Fixes #33973

7 months agoboot: introduce string tables for RebootOnError and sucure_boot_enroll 36721/head
Yu Watanabe [Wed, 12 Mar 2025 17:37:03 +0000 (02:37 +0900)] 
boot: introduce string tables for RebootOnError and sucure_boot_enroll

7 months agoboot: fix use of uninitialized value on error
Yu Watanabe [Wed, 12 Mar 2025 17:00:25 +0000 (02:00 +0900)] 
boot: fix use of uninitialized value on error

Follow-up for 0bdf94e588c8d781a91e5738525d673c0966a510.

7 months agonetlink-util: move several function prototypes 36627/head
Yu Watanabe [Wed, 5 Mar 2025 21:35:45 +0000 (06:35 +0900)] 
netlink-util: move several function prototypes

7 months agonetlink-util: allow to call rtnl_set_link_name() and friends with NULL rtnl
Yu Watanabe [Sun, 9 Mar 2025 00:24:52 +0000 (09:24 +0900)] 
netlink-util: allow to call rtnl_set_link_name() and friends with NULL rtnl

7 months agonetlink-util: merge rtnl_get_link_info() and rtnl_get_ifname_full() into rtnl_get_lin...
Yu Watanabe [Wed, 5 Mar 2025 21:30:15 +0000 (06:30 +0900)] 
netlink-util: merge rtnl_get_link_info() and rtnl_get_ifname_full() into rtnl_get_link_info_full()

Then, this makes rtnl_get_ifname_full() and friends as inline wrappers of
rtnl_get_link_info_full().

7 months agotest-netlink: use ASSERT_OK() and friends
Yu Watanabe [Thu, 6 Mar 2025 02:48:54 +0000 (11:48 +0900)] 
test-netlink: use ASSERT_OK() and friends

7 months agotests: introduce ASSERT_PTR_EQ()
Yu Watanabe [Thu, 6 Mar 2025 03:11:43 +0000 (12:11 +0900)] 
tests: introduce ASSERT_PTR_EQ()

7 months agoudev/net: replace device_unsigned_attribute() with device_get_sysattr_unsigned()
Yu Watanabe [Wed, 5 Mar 2025 21:53:37 +0000 (06:53 +0900)] 
udev/net: replace device_unsigned_attribute() with device_get_sysattr_unsigned()

They are completely equivalent, except for logging.
This also drops duplicated log messages on failure paths.

7 months agoudev/net: fix assignment of ID_NET_NAME=
Yu Watanabe [Wed, 5 Mar 2025 22:25:28 +0000 (07:25 +0900)] 
udev/net: fix assignment of ID_NET_NAME=

E.g. sd_device object of network interface 'hoge!foo' has sysname 'hoge/foo'.
So, previously udevd assigned 'hoge/foo' rather than 'hoge!foo' to ID_NET_NAME,
hence even when renaming is not requested, such interface was renamed to 'hoge_foo'
(note '/' cannot be used in network interface name, hence escaped to underbar).

7 months agoudev-event: fix filtering logic of renaming network interface
Yu Watanabe [Wed, 5 Mar 2025 23:22:54 +0000 (08:22 +0900)] 
udev-event: fix filtering logic of renaming network interface

The device sysname may be different from the network interface name.

7 months agoudev-event: set INTERFACE/INTERFACE_OLD property on rename only when the device is...
Yu Watanabe [Wed, 5 Mar 2025 23:19:45 +0000 (08:19 +0900)] 
udev-event: set INTERFACE/INTERFACE_OLD property on rename only when the device is a network interface

This does not change any behavior, as currently udevd only supports
renaming for network interfaces.

Closes #26156.

7 months agoudev-builtin-net_driver: use correct interface name
Yu Watanabe [Wed, 5 Mar 2025 23:16:10 +0000 (08:16 +0900)] 
udev-builtin-net_driver: use correct interface name

Previously, when the interface name contains '!', the builtin command
failed to get the driver of the interface.

7 months agosd_device: introduce device_get_ifname()
Yu Watanabe [Wed, 5 Mar 2025 22:03:45 +0000 (07:03 +0900)] 
sd_device: introduce device_get_ifname()

sd-device replaces '!' in sysname with '/'. Hence, sysname and ifname
may be different. Let's get network interface name through INTERFACE
property.

7 months agotest: do not pass return value to log_error_errno() on success
Yu Watanabe [Sun, 9 Mar 2025 02:00:37 +0000 (11:00 +0900)] 
test: do not pass return value to log_error_errno() on success

7 months agotest-sd-device: use ASSERT_OK() and friends
Yu Watanabe [Sun, 9 Mar 2025 01:15:29 +0000 (10:15 +0900)] 
test-sd-device: use ASSERT_OK() and friends

7 months agosd-device: reorder elements in sd_device object
Yu Watanabe [Wed, 5 Mar 2025 18:47:56 +0000 (03:47 +0900)] 
sd-device: reorder elements in sd_device object

No functional change, just refactoring.

7 months agosd-device: protect more properties often set by kernel and internally used by udevd
Yu Watanabe [Wed, 5 Mar 2025 18:26:04 +0000 (03:26 +0900)] 
sd-device: protect more properties often set by kernel and internally used by udevd

7 months agohostname: several follow-ups for wildcard hostname support (#36707)
Yu Watanabe [Wed, 12 Mar 2025 15:46:00 +0000 (00:46 +0900)] 
hostname: several follow-ups for wildcard hostname support (#36707)

7 months agotest-cgroup-util: Check return values (#36024)
Lennart Poettering [Wed, 12 Mar 2025 14:50:33 +0000 (15:50 +0100)] 
test-cgroup-util: Check return values (#36024)

Reported by Coverity and
Fixes CID#1587767

7 months agoboot: add reboot-on-error config option
nkraetzschmar [Tue, 11 Mar 2025 12:23:14 +0000 (13:23 +0100)] 
boot: add reboot-on-error config option

Enabling this option will cause the system to reboot in case the selected
entry fails to load.

7 months agoFixes several recent CI issues (#36691)
Lennart Poettering [Wed, 12 Mar 2025 14:32:58 +0000 (15:32 +0100)] 
Fixes several recent CI issues (#36691)

- Fixes a race in systemd-run caused by
b7ba8d55b8e413ff326abc4814b92d42b8d3c3c3, which causes issue #36679.
- Skip verifying masked units in TEST-23.
- Avoid false-positive ASan warning by switching sanitizer run from
Fedora rawhide to Fedora 41, caused by recent update from
llvm-19.1.7-11.fc43 to llvm-20.1.0-1.fc43. Hopefully issue #36678 should
be fixed.

Closes #36678.
Closes #36679.

7 months agomeson: drop split-usr, rootlibdir, and rootprefix from meson_options.txt
Yu Watanabe [Sun, 9 Mar 2025 02:45:00 +0000 (11:45 +0900)] 
meson: drop split-usr, rootlibdir, and rootprefix from meson_options.txt

These options were deprecated by b0d3095fd6cc1791a38f57a1982116b4475244ba (v255).
Let's remove them completely.

7 months agoupdate TODO
Lennart Poettering [Wed, 12 Mar 2025 12:34:47 +0000 (13:34 +0100)] 
update TODO

7 months agoupdate TODO
Lennart Poettering [Wed, 12 Mar 2025 10:11:33 +0000 (11:11 +0100)] 
update TODO

7 months agotest-cgroup-util: Ignore LXC group 36024/head
Michal Koutný [Mon, 3 Feb 2025 16:02:09 +0000 (17:02 +0100)] 
test-cgroup-util: Ignore LXC group

LXC helper processes hide themselve in .lxc cgroup, we don't have to
deal with the inside tests (and the error in conversion to unit is handled).
Skip those but keep iterating over remaining processes to detect what
can be created around us.

7 months agotest-cgroup-util: Skip procs analysis without cgroupfs
Michal Koutný [Fri, 17 Jan 2025 17:00:25 +0000 (18:00 +0100)] 
test-cgroup-util: Skip procs analysis without cgroupfs

cg_pidref_get_path() cannot work (current implementaion) without
cgroupfs (when it checks unified or not setup). Similarly,
cg_pidref_get_unit() assumes all processes are part of a unit. So carry
out the test only when running on a systemd setup.

7 months agotest-cgroup-util: Check return values
Michal Koutný [Wed, 15 Jan 2025 15:36:28 +0000 (16:36 +0100)] 
test-cgroup-util: Check return values

The test is supposed to check a battery of cgroup helpers on each
process found but it doesn't literally check anything besides presence
of procfs. (One can visually check printed output only. Introduction in
aff38e74bd ("nspawn: suffix the nspawn cgroups with ".nspawn"").)

Make some assumptions about visible processes and turn the test into
testing that systemd helpers can deal with whatever process they find on
the SUT.

Reported by Coverity and
Fixes CID#1587767

7 months agohostname-setup: use strchr() to find wildcard character 36707/head
Yu Watanabe [Tue, 11 Mar 2025 21:46:36 +0000 (06:46 +0900)] 
hostname-setup: use strchr() to find wildcard character

Addresses https://github.com/systemd/systemd/pull/36647#discussion_r1990048751.

7 months agotest: add test cases for hostname_substitute_wildcards()
Yu Watanabe [Tue, 11 Mar 2025 21:44:21 +0000 (06:44 +0900)] 
test: add test cases for hostname_substitute_wildcards()

The function is indirectly tested through read_etc_hostname(), but let's
also test it directly.

7 months agohostname: fix typo
Yu Watanabe [Tue, 11 Mar 2025 21:26:45 +0000 (06:26 +0900)] 
hostname: fix typo

Follow-up for af9c45d5b6c1b1962731dffc638a2320e5eef095.

7 months agoresolve question marks in /etc/hostname to characters hashed from machine ID (#36647)
Yu Watanabe [Tue, 11 Mar 2025 19:50:33 +0000 (04:50 +0900)] 
resolve question marks in /etc/hostname to characters hashed from machine ID (#36647)

So I have a bunch of particle os instances around, that I frequently
factory reset. and it's confusing, since they all have the same name.
Let's do something about this, and extend the hostname setup logic a bit
to deal better with "cattle" rather than "pet" deployments.
Specifically: if a hostname in /etc/hostname contains a bunch of
question marks we'll replace it with hex chars hashed from the machine
id.

This allows us to do something like this:

hostnamectl set-hostname --static 'funky-????-????-???'

and we'll end up with a hostname like `funky-baf4-b653-e230`

7 months agomountfsd: add complete varlink introspection comments (#36703)
Yu Watanabe [Tue, 11 Mar 2025 19:48:12 +0000 (04:48 +0900)] 
mountfsd: add complete varlink introspection comments (#36703)

7 months agorun: check if the start job is finished on PropertiesChanged signal and so on 36691/head
Yu Watanabe [Mon, 10 Mar 2025 20:15:11 +0000 (05:15 +0900)] 
run: check if the start job is finished on PropertiesChanged signal and so on

Otherwise, if systemd-run is disconnected from bus before JobRemoved
signal, then c->start_job will never freed, thus run_context_check_done()
will never call sd_event_exit() even after the service is finished.

This drops monitoring JobRemoved signal, and make systemd-run check if
the start job is started when PropertiesChanged signal is received.

Follow-up for b7ba8d55b8e413ff326abc4814b92d42b8d3c3c3.

Fixes #36679.

7 months agoTEST-74-AUX-UTILS: fail earlier when systemd-run fail to reconnect to bus
Yu Watanabe [Mon, 10 Mar 2025 19:27:18 +0000 (04:27 +0900)] 
TEST-74-AUX-UTILS: fail earlier when systemd-run fail to reconnect to bus

Note, the default timeout for systemctl daemon-reload is 270 seconds.
Hence, 300 seconds should be enough.

7 months agoci/mkosi: enable sanitizers on Fedora 41
Yu Watanabe [Mon, 10 Mar 2025 16:54:28 +0000 (01:54 +0900)] 
ci/mkosi: enable sanitizers on Fedora 41

It seems the recent update of LLVM package in Fedora rawhide breaks
sanitizers, and udevd freezes after false-positive (I guess) issue is
detected:

systemd-udevd[2646]: =================================================================
systemd-udevd[2646]: ==2646==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7ffc3a642660 at pc 0x555627ac022b bp 0x7ffc3a6422b0 sp 0x7ffc3a6422a8
systemd-udevd[2646]: READ of size 8 at 0x7ffc3a642660 thread T0 ((udev-worker))

llvm-19.1.7-11.fc43 worked fine, but llvm-20.1.0-1.fc43 does not.
To avoid the issue, let's enable sanitizer on Fedora 41, and disable it
on Fedora rawhide.

Closes #36678.

7 months agoTEST-23-UNIT-FILE: skip verifying masked unit
Yu Watanabe [Mon, 10 Mar 2025 19:21:11 +0000 (04:21 +0900)] 
TEST-23-UNIT-FILE: skip verifying masked unit

This fixes the following failure:
TEST-23-UNIT-FILE.sh[2408]: + systemd-analyze --recursive-errors=no --man=no verify /usr/lib/systemd/system/sysinit.target.wants/systemd-hwdb-update.service
systemd-analyze[2737]: sys-kernel-config.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: proc-sys-fs-binfmt_misc.automount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-hugepages.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-tracing.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-kernel-debug.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: sys-fs-fuse-connections.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: dev-mqueue.mount: symlinks are not allowed for units of this type, rejecting.
systemd-analyze[2737]: Unit systemd-hwdb-update.service is masked.
TEST-23-UNIT-FILE.sh[166]: + :
TEST-23-UNIT-FILE.sh[166]: + kill -0 2408
TEST-23-UNIT-FILE.sh[166]: + wait 2408
TEST-23-UNIT-FILE.sh[166]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed'
TEST-23-UNIT-FILE.sh[166]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-23-UNIT-FILE.verify-unit-files.sh failed

7 months agoupdate TODO 36703/head
Lennart Poettering [Tue, 11 Mar 2025 10:58:49 +0000 (11:58 +0100)] 
update TODO

7 months agomountfsd: also return suggested mount point paths for the returned partitions
Lennart Poettering [Tue, 11 Mar 2025 10:43:17 +0000 (11:43 +0100)] 
mountfsd: also return suggested mount point paths for the returned partitions

When mounting a disk image we return a bunch of mount fds referencing
the various partitions in the disk, along with some metadata about them.
One key metadata field is the "designator" which is supposed to tell
clients what is what, and where to mount it.

Let's make this more explicit: let's also include the literal relative
path where each mount shall be placed, to simplify implementations of
clients that do not care about the concept of designators.

7 months agomountfsd: complete varlink introspection comments
Lennart Poettering [Tue, 11 Mar 2025 10:14:15 +0000 (11:14 +0100)] 
mountfsd: complete varlink introspection comments

7 months agoupdate TODO
Lennart Poettering [Tue, 11 Mar 2025 17:19:24 +0000 (18:19 +0100)] 
update TODO

7 months agoupdate TODO 36647/head
Lennart Poettering [Thu, 6 Mar 2025 22:11:08 +0000 (23:11 +0100)] 
update TODO

7 months agotest: add test checking if pattern based hostnames work
Lennart Poettering [Fri, 7 Mar 2025 08:32:58 +0000 (09:32 +0100)] 
test: add test checking if pattern based hostnames work

7 months agohostname: support that /etc/hostname contains ??? as wildcards to be replaced by...
Lennart Poettering [Thu, 6 Mar 2025 17:31:12 +0000 (18:31 +0100)] 
hostname: support that /etc/hostname contains ??? as wildcards to be replaced by hash value from /etc/machine-id

7 months agobasic: move gethostname_full() from basic/hostname-util.c → shared/hostname-setup.c
Lennart Poettering [Thu, 6 Mar 2025 17:28:44 +0000 (18:28 +0100)] 
basic: move gethostname_full() from basic/hostname-util.c → shared/hostname-setup.c

In one of the next commits we'd like to introduce a concept of
optionally hashing the hostname from the machine ID. For that we we need
to optionally back gethostname_full() by code involving sd-id128, hence
let's move it from src/basic/ to src/shared/, since only there we are
allowed to use our public APIs.

7 months agoupdate TODO
Lennart Poettering [Tue, 11 Mar 2025 16:19:25 +0000 (17:19 +0100)] 
update TODO

7 months agobus-polkit: shortcut auth. after first denial
David Tardon [Fri, 7 Mar 2025 15:22:00 +0000 (16:22 +0100)] 
bus-polkit: shortcut auth. after first denial

A D-Bus/Varlink method can issue PolicyKit auth. requests for multiple
actions; in this case the method is expected to fail on the first one
that is not allowed. This is enforced by asserts in
async_polkit_read_reply(), but that's a wrong place for the check for
two reasons:

1. it doesn't allow to get a meaningful stack trace;
2. sending the query to polkit is already a pointless exercise.

Let's do the check in *_verify_polkit_async_full() and don't send
anything to PolicyKit in that case.

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=2349594 .