Commit graph

4387 commits

Author SHA1 Message Date
Yu Watanabe 4e22097489
Merge pull request #30541 from yuwata/network-address-empty
network/address: make Address= in [Network] support an empty string
2023-12-22 11:50:44 +09:00
Lennart Poettering 66f3da245b
Merge pull request #30284 from YHNdnzj/fstab-wantedby-defaultdeps
fstab-generator: disable default deps if x-systemd.{wanted,required}-by= is used
2023-12-21 22:47:54 +01:00
Lennart Poettering dc6522b18f
Merge pull request #28658 from H5117/enroll_with_ec
cryptsetup: Add support for EC keys in PKCS#11 tokens
2023-12-21 22:45:40 +01:00
Lennart Poettering aafd495af8
Merge pull request #30547 from poettering/uid0
add new "uid0" command as alternative multi-call interface for systemd-run, as sudo replacement
2023-12-21 22:45:15 +01:00
Lennart Poettering 1760716959 test: add simple creds/varlink integration test 2023-12-21 19:19:12 +01:00
Lennart Poettering dd25a95763 test: add minimal integration test coverage for uid0 tool 2023-12-21 19:15:01 +01:00
Yu Watanabe 3a2ef59d2e test-network: add test case of an empty string assignment for Address= 2023-12-21 04:13:19 +09:00
Yu Watanabe 67150a7bd4 test-network: use the main .network file
These tests are not interested in most addresses specified in the .network file.
As 10-many-address.conf drop-in config for the .network file contains so
many addresses, hopefully this improves test performance.
2023-12-21 04:10:19 +09:00
Yu Watanabe b993e7e72e network: also log drop-in config files
We have already show used drop-in config files in networkctl, but
also showing that in log may be useful.

Closes #30483.
2023-12-21 03:37:17 +09:00
Yu Watanabe abf0ccc1c6 analyze-verify: verify all executables
ExecStart= and friends for .service and .socket can be specified
multiple times.
This also checks all commands for .mount and .swap, not only for the
current control command.
2023-12-20 23:56:16 +09:00
Yu Watanabe 5183976cea TEST-65-ANALYZE: only mount /usr if necessary
Follow-up for 8f764b32ea.

Otherwise, we fail to umount several directories on shutdown.
---
[   15.684430] systemd[1]: Failed unmounting tmp-root-proc.mount.
[   15.689379] systemd[1]: Failed unmounting tmp-root-run.mount.
[   15.710572] systemd[1]: Failed unmounting tmp-root-sys-fs-cgroup.mount.
[   15.913953] systemd[1]: Failed unmounting tmp-root-dev.mount.
[   15.924603] systemd[1]: Failed unmounting tmp-root-sys.mount.
[   15.938207] systemd[1]: Failed unmounting tmp-root.mount.
[   15.952395] systemd[1]: Failed unmounting tmp.mount.
2023-12-20 23:56:16 +09:00
Yu Watanabe 8f876e8d98
Merge pull request #30525 from YHNdnzj/networkctl-mask
networkctl: introduce verb mask and unmask
2023-12-20 21:00:36 +09:00
Frantisek Sumsal 92ee875a31 test: trigger /boot mount if it's an automount
If the target mount point is an automount, checking it for writeability
without triggering it first is iffy and yields different results based
on kernel version:

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot'
Running as unit: run-u36.service; invocation ID: f948ff4f3c8e4bcfba364ead94bd0ad9
+ uname -r
4.18.0-529.el8.x86_64
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=43,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=356096)
+ test '!' -w /boot
Finished with result: exit-code
Main processes terminated with: code=exited/status=1

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot'
Running as unit: run-u274.service; invocation ID: ccc53ed63c3249348cf714f97a3a7026
+ uname -r
6.6.7-arch1-1
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
+ test '!' -w /boot
Finished with result: success
Main processes terminated with: code=exited/status=0

One solution would be to use /boot/ instead of just /boot, which triggers
the automount during the check, but in that case the mount would happen
_after_ we apply the ProtectSystem= stuff, so the mount point would
be unexpectedly writable:

~# systemd-run --wait --pipe -p ProtectSystem=yes bash -xec 'uname -r; mount -l | grep boot; test ! -w /boot/ || mount -l | grep boot'
Running as unit: run-u282.service; invocation ID: 2154f6b4cbd34ddeb3e246cb7c991918
+ uname -r
6.6.7-arch1-1
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
+ test '!' -w /boot/
+ mount -l
+ grep boot
systemd-1 on /boot type autofs (rw,relatime,fd=95,pgrp=1,timeout=120,minproto=5,maxproto=5,direct,pipe_ino=730583)
/dev/vda2 on /boot type vfat (rw,nosuid,nodev,noexec,relatime,nosymfollow,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)

Let's just trigger the (possible) automounts explicitly before we do any
checks to avoid all this stuff.

Also, when at it, check that ProtectSystem=yes|full correctly protects
the ESP mount as well.

Follow-up for 97bbb9cfbd.
2023-12-20 18:15:35 +09:00
Vladimir Stoiakin a3c1b0d74c TEST-24-CRYPTSETUP: add test for PKCS#11 tokens
Introduces new dependencies on SoftHSM, OpenSC and GnuTLS for the test.
2023-12-20 11:52:18 +03:00
Mike Yuan 28bb29cbb4
networkctl: introduce verb mask and unmask
Suggested in https://github.com/systemd/systemd/pull/29928#discussion_r1386626565
2023-12-20 12:46:46 +08:00
Frantisek Sumsal 68785c7d6a test: reset systemd-resolved.service's restart counter
Otherwise we might occasionally hit the start rate limit, as we restart
the service a bunch of times:

[ 3702.280886] testsuite-75.sh[1135]: + tee /tmp/tmp.wUL8bkJwrt
[ 3702.283684] testsuite-75.sh[1135]: {}
[ 3702.284254] testsuite-75.sh[46]: + restart_resolved
[ 3702.284302] testsuite-75.sh[46]: + systemctl stop systemd-resolved.service
[ 3702.310678] testsuite-75.sh[1140]: + systemctl is-failed systemd-resolved.service
[ 3702.316766] testsuite-75.sh[1141]: inactive
[ 3702.316998] testsuite-75.sh[46]: + systemctl start systemd-resolved.service
[ 3702.322315] systemd[1]: systemd-resolved.service: Start request repeated too quickly.
[ 3702.322343] systemd[1]: systemd-resolved.service: Failed with result 'start-limit-hit'.
[ 3702.322609] systemd[1]: Failed to start systemd-resolved.service - Network Name Resolution.
[ 3702.323619] systemctl[1142]: Job for systemd-resolved.service failed.
[ 3702.323839] systemctl[1142]: See "systemctl status systemd-resolved.service" and "journalctl -xeu systemd-resolved.service" for details.
[ 3702.325035] systemd[1]: testsuite-75.service: Failed with result 'exit-code'.
[ 3702.325391] systemd[1]: Failed to start testsuite-75.service - Tests for systemd-resolved.

Follow-up for b1384db11b and 6ef512c0bb.
2023-12-20 13:42:08 +09:00
Daan De Meyer 79f44fb8a1 test: Make sure SYSTEMD_HWDB_UPDATE_BYPASS is disabled in the hwdb test
Let's make this test independent on what's in the environment.
2023-12-19 16:01:54 +01:00
Frantisek Sumsal 32c376a46c test: add missing operators
Without them only the last expression's return value is honored, causing
unexpected CI fails:

[   26.006721] testsuite-04.sh[1191]: + for _ in {0..9}
[   26.007672] testsuite-04.sh[1191]: + setterm --term linux --dump --file /tmp/console.dump
[   26.008871] testsuite-04.sh[1233]: + SYSTEMD_COLORS=256
[   26.009606] testsuite-04.sh[1233]: + /usr/lib/systemd/systemd-bsod
[   26.063296] systemd[1]: session-1.scope: Deactivated successfully.
[   26.124789] testsuite-04.sh[1191]: + grep -aq 'Press any key to exit' /tmp/console.dump
[   26.131509] testsuite-04.sh[1191]: + grep -aq 'Root emergency message' /tmp/console.dump
[   26.137882] testsuite-04.sh[1191]: + grep -aq 'The current boot has failed' /tmp/console.dump
[   26.141650] testsuite-04.sh[1191]: + return 0
[   26.144816] testsuite-04.sh[1191]: + grep -aq 'Scan the QR code' /tmp/console.dump
[   26.153591] testsuite-04.sh[1191]: + at_exit
[   26.154744] testsuite-04.sh[1191]: + local EC=1
[   26.155697] testsuite-04.sh[1191]: + [[ 1 -ne 0 ]]
[   26.156787] testsuite-04.sh[1191]: + [[ -e /tmp/console.dump ]]
[   26.157799] testsuite-04.sh[1191]: + cat /tmp/console.dump
[   26.158858] testsuite-04.sh[1244]:    The current boot has failed!
[   26.159858] testsuite-04.sh[1244]:    Root emergency message

I'm genuinely impressed that this worked at all.
2023-12-19 11:47:17 +09:00
Luca Boccassi c2d5d8c401
Merge pull request #30464 from CodethinkLabs/misc-integration-test-fixes
Misc integration test fixes
2023-12-18 16:11:16 +01:00
Luca Boccassi e7bfce0d0a
Merge pull request #30492 from mrc0mmand/skip-TEST-08-without-systemd-in-initrd
test: skip TEST-08-INITRD if systemd didn't run in the initrd
2023-12-18 16:10:33 +01:00
Frantisek Sumsal 6277e47127
Merge pull request #30508 from topimiettinen/fix-flaky-test-address-static
test-network: fix racy test for address_static
2023-12-18 14:43:26 +00:00
Topi Miettinen 0e808f622b test-network: accept kernel versions like 1.2.3+ (self-built) 2023-12-18 14:40:21 +00:00
networkException 4e0db87e4c core: allow interface altnames in RestrictNetworkInterfaces=
This patch enables IFNAME_VALID_ALTERNATIVE for checks guarding the
parsing of RestrictNetworkInterfaces=.

The underlying implementation for this option already supports
altnames.
2023-12-18 15:12:10 +01:00
Lennart Poettering a19e7f3101
Merge pull request #30321 from yuwata/find-esp
find-esp: gracefully handle btrfs RAID
2023-12-18 15:11:54 +01:00
Topi Miettinen f432aa9083
Revert "test: temporarily skip checking NFT sets in test_address_static"
This reverts commit e4a80de119.
2023-12-17 18:01:42 +02:00
Topi Miettinen 1ce2ffac6c
test-network: fix racy test for address_static
NFT sets must be installed before starting networkd, otherwise some sets may be
installed too late.

Closes #30427
2023-12-17 17:59:53 +02:00
Frantisek Sumsal 23eca16aad Revert "test: disable TEST-08-INITRD on ubuntu CI"
No longer necessary, as the test checks if systemd ran in the initrd.

This reverts commit 0d290cbcd6.
2023-12-15 16:51:25 +01:00
Frantisek Sumsal 57d61ff319 test: skip TEST-08-INITRD if systemd didn't run in the initrd
This test requires systemd in the initrd, which is not the case in
mkinitrd-based initrds (Ubuntu/Debian).

Resolves: #30481
2023-12-15 16:51:25 +01:00
Zbigniew Jędrzejewski-Szmek 88cc9cc7bc test-systemctl-enable: fix typo
Follow-up for fe6e0cfa19.
2023-12-15 16:22:24 +01:00
Frantisek Sumsal 438c7cb20e test: tell delv to load anchors from /etc/bind.keys explicitly
Since [0] delv no longer does that automagically, so we have to that
explicitly with each delv invocation.

Resolves: #30477

[0] c144fd2871
2023-12-14 23:11:12 +01:00
Frantisek Sumsal 58bcbad86c test: don't check for -Dinstall-tests=true with NO_BUILD=1 2023-12-14 23:11:12 +01:00
Frantisek Sumsal fdd380dde2 test: install empty directories with NO_BUILD=1
Resolves: #30478
2023-12-14 23:11:12 +01:00
Frantisek Sumsal 8f7c876bdc test: forward journal messages to console during sd-bsod tests
Since we nuke the journal multiple times during that, which makes
potential fails undebugable.
2023-12-14 23:08:44 +01:00
Richard Maw 8799346862 test: mount overlayfs over /usr in some tests
Most of the integration tests have been made to not write to /usr
but some genuinely need to do so.

Because mkosi creates images with a read-only /usr
it is not normally writeable.

By mounting an overlayfs with /usr as the lower dir
and upper and working dirs in /var tests may write to /usr.
2023-12-13 17:55:45 +00:00
Frantisek Sumsal f9ba9d3eb7 test: install all necessary units & generators for LVM on Debian
And derivates.

Replaces: #30458
2023-12-13 23:56:14 +09:00
Richard Maw 0129395173 test: slacken plugged -> dead test
This test is for if devices transition from plugged -> dead -> plugged
on boot, but it is normal to see loop devices transition plugged -> dead
on first boot when systemd-repart adds the root partition.
2023-12-13 13:35:04 +00:00
Richard Maw 8f764b32ea test: Create analyze chroot with --rbind
The systemd-analyze integration test also tests chroots.
It builds its chroot by bind-mounting /,
but since /usr might be a separate mountpoint
it should create the chroot with --rbind.
2023-12-13 13:35:04 +00:00
Lennart Poettering 113defc76b test: test that delegation of some newer attrs that shall be delegated work 2023-12-13 10:10:56 +01:00
Yu Watanabe ee07fff03b test: add basic coverity tests for bootctl 2023-12-13 14:29:09 +09:00
Yu Watanabe 97bbb9cfbd test: create ESP and xbootldr partitions 2023-12-13 14:28:30 +09:00
Yu Watanabe 0f236e8cd6 test: mask mdmonitor when building image
Follow-up for 22e31655f3.
2023-12-13 14:28:03 +09:00
Yu Watanabe 4ed943e97b test: make install_mdadm() also install relevant kernel modules
Installing mdadm without kernel modules is mostly meaningless.
2023-12-13 14:19:28 +09:00
Yu Watanabe 5b4fa6f13c test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE 2023-12-13 14:19:28 +09:00
Yu Watanabe 0977039bdc
Merge pull request #30433 from yuwata/network-nexthop-cleanups
network: introduce ManageForeignNextHops=
2023-12-13 14:16:27 +09:00
Frantisek Sumsal 22e31655f3 test: mask the mdmonitor.service
It's pulled in by one of the udev rules (63-md-raid-arrays.rules) and it
fails every time, because there's no valid email address in
/etc/mdadm.conf:

[    5.778153] testsuite-64.sh[403]: mdadm: array /dev/md/mdmirror started.
[    5.819137] kernel: md/raid1:md127: not clean -- starting background reconstruction
[    5.819141] kernel: md/raid1:md127: active with 2 out of 2 mirrors
[    5.819159] kernel: md127: detected capacity change from 0 to 129024
[    5.821950] kernel: md: resync of RAID array md127
...
[    5.887192] mdadm[424]: mdadm: No mail address or alert command - not monitoring.
[    5.890772] systemd[1]: Starting mdmonitor.service...
[    5.891718] systemd[1]: Started mdmonitor.service.
[    5.892570] systemd[1]: mdmonitor.service: Main process exited, code=exited, status=1/FAILURE
[    5.892618] systemd[1]: mdmonitor.service: Failed with result 'exit-code'.

And as we (re)assemble the MD devices multiple times, this gets quite
noisy, especially since we later start hitting the service start rate
limit.

Fedora has the mdmonitor.service patched, so it won't start without
/etc/mdadm.conf being present, but Arch uses the upstream unit which
doesn't have such guard.

Let's just mask the service completely, which replaces all that noise
with one warning:

[    6.553583] testsuite-64.sh[294]: + udevadm wait --settle ...
[    6.580700] systemd[1]: sys-devices-virtual-block-md127.device: Failed to enqueue SYSTEMD_WANTS job, ignoring: Unit mdmonitor.service is masked.
2023-12-13 00:59:20 +00:00
Yu Watanabe 41231f2697 test-network: add test for ManageForeignNextHops=no 2023-12-13 00:02:36 +09:00
Yu Watanabe e7660b9aff test-network: reduce indent for verification 2023-12-12 23:51:10 +09:00
Yu Watanabe 77633317ce test-network: drop redundant call of tearDown() 2023-12-12 23:51:10 +09:00
Frantisek Sumsal 28a2d27650 test: "never" is not a valid value for Restart=
[  154.140565] testsuite-07.sh[1014]: + systemctl start badbin_assert.socket
[  154.738606] testsuite-07.sh[1014]: + socat - ABSTRACT-CONNECT:badbin_assert.socket
[  154.768418] systemd[1]: Cannot find unit for notify message of PID 1021, ignoring.
[  154.812357] systemd[1]: /run/systemd/system/badbin_assert.service:3: Failed to parse service restart specifier, ignoring: never
[  155.347350] testsuite-07.sh[1014]: + timeout 10 sh -c 'while systemctl is-active badbin_assert.service; do sleep .5; done'
[  155.669695] (badbin)[1045]: badbin_assert.service: Failed to execute /tmp/badbin: Exec format error
[  155.676596] systemd[1]: badbin_assert.service: Failed with result 'exit-code'.
[  156.081953] testsuite-07.sh[1051]: failed
[  156.132018] testsuite-07.sh[1054]: ++ systemctl show -P ExecMainStatus badbin_assert.service
[  156.326583] (badbin)[1050]: badbin_assert.service: Failed to execute /tmp/badbin: Exec format error
[  156.343566] systemd[1]: badbin_assert.service: Failed with result 'exit-code'.
[  156.904658] (badbin)[1055]: badbin_assert.service: Failed to execute /tmp/badbin: Exec format error
[  156.913709] systemd[1]: badbin_assert.service: Failed with result 'exit-code'.
[  157.066900] testsuite-07.sh[1014]: + [[ 0 == 203 ]]
[  157.081588] testsuite-07.sh[618]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-07.issue-30412.sh failed'

Follow-up for 1eeaa93de3.
2023-12-12 13:36:28 +00:00
Frantisek Sumsal e4a80de119 test: temporarily skip checking NFT sets in test_address_static
Until https://github.com/systemd/systemd/issues/30427 is resolved.
2023-12-12 12:25:47 +01:00