Commit Graph
6317 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 689391f8c8 TEST-46-HOMED: fix 2 minute timeout in cleanup
The test passes but for two minutes the cleanup function just logs:
Failed to inspect home: No home for user homedsshtest known
Failed to inspect home: No home for user homedsshtest known
Failed to inspect home: No home for user homedsshtest known
...

Do not wait for the user to become inactive or remove the user if 'homectl
inspect' doesn't find the user. This brings a successfull run from 176 s
to 58 s here.
2026-01-04 16:04:54 +01:00
Yu Watanabe fd2cdadc14 integration-test: check tools distribution rather than image distribution
The tools and image distributions may be different.

This also fixes invalid escape sequence.

Follow-up for 9b42cc3b12.
2025-12-15 23:11:47 +09:00
Yu Watanabe 82e3f6c5f9 sysext: Fix config file section docs and --root= (#40063) 2025-12-15 09:45:29 +09:00
Daan De Meyer 2cee5c22b6 TEST-50-DISSECT: Make sure RootDirectoryFileDescriptor= can be reused 2025-12-14 11:32:08 +01:00
Kai Lueke f351668cbe sysext: Fix config file support with --root=
Config files for --root= weren't picked up as expected because the
--root= flag got parsed after the config file.
Switch the order of config file and CLI flag parsing while letting the
CLI flags overwrite things set by the config files by tracking state
during parsing.
2025-12-12 21:50:45 +09:00
Luca Boccassi 7c0afcdde2 core: gracefully skip unknown policy designators in RootImagePolicy et al (#40060)
Usually we gracefully ignore unknown configuration parameters, so that
service files can be written by upstreams and used across a variegated
range of distributions with various versions of systemd, to avoid
forcing users to the minimum common denominator and only adding settings
that are supported by the oldest distro supported.

Image policies do not behave like this, and any unknown partition or
policy designator causes the whole unit to fail to parse and a hard
error.

Change it so that parsing RootImagePolicy and friends via unit file or
D-Bus logs but otherwise ignores unknown specifiers, like other options
do.

This allows us to add new specifiers in the future, and users to adopt
them immediately.

Follow-up for d452335aa4
2025-12-11 14:38:26 +09:00
Yu Watanabe 72711b76e0 TEST-85-NETWORK: enable NetworkdSysctlTest
Note, each test case must be prefixed with 'test_'.

This also adds one more log check for issue #40051.

Follow-up for c78bcda461.
2025-12-11 14:37:04 +09:00
Daan De MeyerandYu Watanabe ee6b3d1aa2 test: Stop using grep -q in integration test
When a TTY is attached to the test unit, grep -q will generate SIGPIPE
for the previous command in the pipeline which in combo with `pipefail`
will cause the command to fail with exit status 141 which will fail the
test.

Replace with >/dev/null to avoid this from happening.

See also https://www.gnu.org/software/grep/manual/html_node/Usage.html
> There is a related problem with Bash’s set -e -o pipefail. Since grep
> does not always read all its input, a command outputting to a pipe read
> by grep can fail when grep exits before reading all its input, and the
> command’s failure can cause Bash to exit.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-12-10 12:09:10 +01:00
Luca Boccassi af80c9c224 test: use -force with unsquashfs for test reruns
In case a test is reran or a directory reused, overwrite it
instead of failing
2025-12-09 14:41:59 +09:00
Luca Boccassi 9b42cc3b12 tests: also add qemu shutdown trace debug logs to integration script
Again to chase https://github.com/systemd/systemd/issues/38240
as suggested on QEMU's matrix channel
2025-12-08 21:29:36 +01:00
Luca Boccassi afcc0ca509 test-network: drop unused variable
Follow-up for e2fbcee030
2025-12-09 03:30:57 +09:00
Luca Boccassi b169c7512c tests: run qemu with cpu_reset,guest_errors debug messages
Attempt to gather more information to debug https://github.com/systemd/systemd/issues/38240
2025-12-08 12:08:40 +00:00
Luca Boccassi e66f6d3b23 tests: log when qemu crashed and the test is re-ran
Follow-up for 0d7f5a9ae6
2025-12-08 12:08:40 +00:00
Yu Watanabe f0feff731c mkosi: RuntimeScratch=/--runtime-scratch= are deprecated
See https://github.com/systemd/mkosi/commit/054d0690b08afa6163b53ad2dca0e1374e9069f7
2025-12-07 11:15:34 +09:00
Yu Watanabe 80cfe9abf2 test: several fixlets/workarounds for supporting postmarketOS (#39905) 2025-12-07 10:16:58 +09:00
Luca Boccassi e2fbcee030 test-network: fix invalid captive portal URL with dnsmasq 2.92 (#40011)
dnsmasq 2.92 started converting binary content to ascii so the previous
invalid URL is no longer invalid as it's escaped.

So the test started failing: https://bugs.debian.org/1122015

Use a '|' character instead, which is not a valid URL character but it's
also not escaped by dnsmasq.

Follow-up for 1219391c9f
2025-12-07 09:43:47 +09:00
Yu Watanabe e7e3c23bbb test-execute: support case that the games user in multiple groups
On Alpine/postmarketOS,
```
$ id -nG games
games users
```
2025-12-07 09:10:32 +09:00
Yu Watanabe d5932060ed integration-test: skip several test cases when nss module is not supported 2025-12-07 09:10:29 +09:00
Yu Watanabe f117629f28 test: skip several test cases when built with musl 2025-12-07 09:09:03 +09:00
Yu Watanabe 9fafe89bcc integration-test: skip several test cases on Alpine/postmarketOS 2025-12-07 09:09:03 +09:00
Yu Watanabe 355bcc243c test: support coreutils built with --enable-single-binary=symlinks
Alpine/postmarketOS build coreutils with --enable-single-binary=symlinks.
In that case, all commands provided by coreutils are symlink to
/usr/bin/coreutils, and it calls prctl(PR_SET_NAME, argv[0]), hence the comm
will be the path to the symlink.

This also makes not kill sleep command with SIGKILL in TEST-17-UDEV, that is
totally unnecessary.
2025-12-07 09:09:03 +09:00
Yu Watanabe 8374085f22 test-network: IPv4-mapped-IPv6 addresses may be shown as pure IPv6 address
It seems ip command built with musl always shows IPv6 addresses in the same way.
2025-12-07 09:09:03 +09:00
Yu Watanabe 193626bd8b test-network: also stop nftables.service
It is a firewall service used in postmarketOS.
When it is active, then e.g. DHCP packets are filtered, and many
tests will be failed.
2025-12-07 09:09:03 +09:00
Yu Watanabe 43588dd63d TEST-75-RESOLVED: move test cases for NFTSet= to TEST-07-PID1
The test cases are not related to systemd-resolved.

While moving the test cases, now userdbctl is used for obtaining UID/GID
for the dynamic user, as musl does not support nss module, hence getent
does not provide information about the dynamic user.
2025-12-07 09:09:03 +09:00
Yu Watanabe f5f96d44fd TEST-46-HOMED: split into small testcases
This also replace long IDENTITY= line with pretty json string.
2025-12-07 09:09:03 +09:00
Yu Watanabe ae2ccf9d6e TEST-35-LOGIN: fix bus path when the session does not have corresponding audit session
If there is no corresponding audit session, then the session ID is
prefixed with 'c', and in that case the session ID should be used as is
in bus path.
2025-12-07 09:09:03 +09:00
Yu Watanabe 4722619c4b TEST-35-LOGIN: show remaining sessions in cleanup_session()
Otherwise it is hard to see which session is still active.
2025-12-07 09:09:03 +09:00
Yu Watanabe 45014d97dd TEST-13-NSPAWN: the host kernel may not support /proc/kcore 2025-12-07 09:09:03 +09:00
Yu Watanabe b49a4696c4 test: always use bash
If sh is not bash, some builtin command behave slightly differently.
E.g. if sh is provided by busybox, its builtin test command does not check if
the path is a mount point or not, and 'test -w' only checks the access mode of
the inode. So, even if a readonly filesystem is mounted on a directory,
the test command may succeed.

To avoid such confusion, let's unconditionally use bash.
2025-12-07 09:09:03 +09:00
Lennart Poettering 1ceba02ad9 ci: split out nvpcr test, so that it runs before rest of pcrextend (#39915)
in pcrextend we destroy pcr 11, and if we are booted in a kernel that
has pcr11 sigs, we cannot use that signature anymore. hence, let's do
the nvpcr test first, before doing the pcrextend stuff.

Fixes: #39582
2025-11-26 12:24:57 +00:00
Yu Watanabe 1defd69d69 TEST-02-UNITTESTS: drop outdated comment
Follow-up for 741d59b326.
2025-11-25 22:52:10 +09:00
Daan De Meyer 32b10d0d28 TEST-88-UPGRADE: Stop resolved hook socket before downgrading
Otherwise it'll remain active and cause networkd to get started again
during the downgrade.
2025-11-25 11:49:31 +01:00
Lennart Poettering 77a1e2dec6 Revert "nspawn: Fix broken host links for container journals" 2025-11-24 16:34:00 +01:00
Daan De Meyer d60206c49a meson: Still build libshared even if libmount is disabled (#39871)
Currently, if the libmount feature is disabled, we don't build libshared
and as a result skip building every other executable as well. Among
other things, this makes our nodeps CI builds kind of pointless since
hardly any code will be compiled.

Let's improve on the situation by making libmount properly optional in
libshared. Then, we only skip building the executables that actually
need libmount.
2025-11-24 14:05:29 +01:00
Daan De Meyer 7336f2c748 meson: Still build libshared even if libmount is disabled
Currently, if the libmount feature is disabled, we don't build
libshared and as a result skip building every other executable as
well. Among other things, this makes our nodeps CI builds kind of
pointless since hardly any code will be compiled.

Let's improve on the situation by making libmount properly optional
in libshared. Then, we only skip building the executables that
actually need libmount.
2025-11-24 13:09:41 +01:00
Yu Watanabe f866ff3df8 tree-wide: replace tab with space, adjust missing or duplicated space 2025-11-24 12:45:06 +01:00
Chris Down 887f54adce nspawn: Add integration test for --link-journal 2025-11-21 21:04:34 +08:00
Frantisek Sumsal 3605b3ba87 timer: rebase last_trigger timestamp if needed
After bdb8e584f4 we stopped rebasing the
next elapse timestamp unconditionally and the only case where we'd do
that was when both last trigger and last inactive timestamps were empty.
This covered timer units during boot just fine, since they would have
neither of those timestamps set. However, persistent timers
(Persistent=yes) store their last trigger timestamp on a persistent
storage and load it back after reboot, so the rebasing was skipped in
this case.

To mitigate this, check the last_trigger timestamp is older than the
current machine boot - if so, that means that it came from a stamp file
of a persistent timer unit and we need to rebase it to make
RandomizedDelaySec= work properly.

Follow-up for bdb8e584f4.

Resolves: #39739
2025-11-20 09:47:11 +01:00
Quentin Deslandes 5b0e262f45 network: clear existing routes if Gateway= is empty in [Network]
Add support for an empty Gateway= in [Network] to clear the existing
routes. This change will allow users to remove the default route from a
drop-in file.
2025-11-20 07:16:26 +09:00
Zbigniew Jędrzejewski-Szmek 8d50438ba5 test/TEST-74-AUX-UTILS: fix racy check
We were getting a list of invocation IDs, picking one at random,
and then querying the unit. This is obviously racy.

TEST-74-AUX-UTILS.sh[2873]: + varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List
                              '{"invocationID": "2052c9a5-7983-4f72-9910-c49e38c91dab"}'
TEST-74-AUX-UTILS.sh[3707]: Method call io.systemd.Unit.List() failed: io.systemd.Unit.NoSuchUnit

The complicated varlink + jq callout is replaced by a simple systemctl call.
I think that's better to avoid a complicated jq expression.

Fixes https://github.com/systemd/systemd/issues/38647.
2025-11-19 17:09:02 +00:00
Zbigniew Jędrzejewski-Szmek c7c457b2fb User and group error messages (#39783)
I'm using separate commit here because this changes are a bit finicky.
2025-11-18 19:39:57 +01:00
Zbigniew Jędrzejewski-Szmek 6e6e96f628 udev: define a generic helper to print messages about unknown users and groups
We cannot just use %m, because strerror returns a confusing error message
for ESRCH or ENOEXEC. udev code was doing a good job, but the error handling
was very verbose. Let's encapsulate the customized error messages in a
helper.

No functional change, except that the error messages have a slightly different
form now. The old messages were a bit better, but we don't have as much
flexibility in the new scheme. "Failed to resolve user 'foo': Unknown user"
should be good enough.
2025-11-18 16:23:29 +01:00
Frantisek Sumsal c3d432a3d2 test: wait for a process ID instead of job ID
Since depending on job control turned out to be flaky [0], let's just
explicitly wait for a process ID instead.

Follow-up for 3849b0701a.
Resolves: #39543

[0] https://github.com/systemd/systemd/issues/39543#issuecomment-3529418583
2025-11-18 15:18:00 +00:00
Zbigniew Jędrzejewski-Szmek 4a3d57a47a network: gracefully disable resolve hook when socket is disabled
systemd-networkd cannot create the directory /run/systemd/resolve.hook/. Even
if the directory exists, it is not owned by systemd-network user/group, so
systemd-networkd cannot create socket file in the directory. Hence, if the
systemd-networkd-resolve-hook.socket unit is disabled, networkd fails to open
the varlink socket, and fail to start:

  systemd-networkd[1304645]: Failed to bind to systemd-resolved hook Varlink socket: Permission denied
  systemd-networkd[1304645]: Could not set up manager: Permission denied
  systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE
  systemd[1]: systemd-networkd.service: Failed with result 'exit-code'.
  systemd[1]: Failed to start systemd-networkd.service - Network Management.

If the socket unit is disabled, that should mean the system administrator wants
to disable the feature. Let's not try to setup the varlink socket in that case.

Now the resolve hook feature can be toggled by enabling/disabling the socket
unit, let's drop the $SYSTEMD_NETWORK_RESOLVE_HOOK environment variable.

Follow-up for a7fa29b1b5.
Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2025-11-18 12:26:07 +01:00
Luca Boccassi 00ed239a7b repart: prefix LUKS superblock label with "luks-" by default, and add explicit VolumeLabel= setting to control it (#39713)
Alternative-to: #39536
2025-11-17 17:46:39 +00:00
Zbigniew Jędrzejewski-Szmek 93470f0451 Various comment and whitespace cleanups (#39740) 2025-11-17 16:52:38 +01:00
Zbigniew Jędrzejewski-Szmek 01100f15ad tree-wide: drop space after shell redirection ops
Those are all unary operators.
2025-11-17 16:50:50 +01:00
Lennart Poettering 0d24626631 test: add testcase for VolumeLabel= 2025-11-17 16:43:21 +01:00
Luca Boccassi bc154d4c3e test: skip TEST-64-UDEV-STORAGE-simultaneous_events on Debian
It consistently fails with the new 6.17 kernel and nobody can
figure out why, so just disable it for now as it's just noise

Fixes https://github.com/systemd/systemd/issues/39552
2025-11-17 12:17:24 +00:00
Yu Watanabe d7cf08b735 test-network: drop two overly verbose outputs
Follow-up for 7f9c0c31d2.
2025-11-16 22:15:44 +09:00