1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-20 18:04:03 +03:00

5181 Commits

Author SHA1 Message Date
Luca Boccassi
abba1e6bc2 sysusers: handle NSS errors gracefully
If the io.systemd.DynamicUser or io.systemd.Machine files exist,
but nothing is listening on them, the nss-systemd module returns
ECONNREFUSED and systemd-sysusers fails to creat the user/group.

This is problematic when ran by packaging scripts, as the package
assumes that after this has run, the user/group exist and can
be used. adduser does not fail in the same situation.

Change sysusers to print a loud warning but otherwise continue
when NSS returns an error.

(cherry picked from commit fc9938d6f8e7081df5420bf88bf98f683b1391c0)
2024-07-05 20:00:04 +02:00
Luca Boccassi
160b539a9d os-util: avoid matching on the wrong extension-release file
The previous commit tries to extract a substring from the
extension-release suffix, but that is not right, it's only the
images that need to be versioned and extracted, use the extension-release
suffix as-is. Otherwise if it happens to contain a prefix that
matches the wrong image, it will be taken into account.

Follow-up for 37543971aff79f3a37646ffc2bb5845c9394797b

(cherry picked from commit 92d1fe3efac7b3a700317ec71b64cab5ebc17b42)
2024-07-05 20:00:04 +02:00
Franck Bui
ea92f16422 test: fix TEST-74-AUX-UTILS.ssh.sh on SUSE
(cherry picked from commit 252542ffc3fda9b110d108a1bce1a1d562baebd4)
2024-07-05 20:00:04 +02:00
Franck Bui
f52475dcf3 test: preserve symlink in inst_recursive()
On SUSE this function is used to copy symlinks installed in *.wants/
directories.

(cherry picked from commit 855bad331e28a03d7ad5831caacd3481db938180)
2024-07-05 20:00:04 +02:00
Franck Bui
10b7e0a0af test: fix TEST-24-CRYPTSETUP on SUSE
/etc/systemd/journald.conf.d drop-in dir already exists on SUSE.

(cherry picked from commit 56a894e888002f44f3463b3188f9d5abdcca4bb0)
2024-07-05 20:00:04 +02:00
Franck Bui
4f7d6885a1 test: install /etc/hosts
Needed for resolving the "localhost" hostname.

(cherry picked from commit a09825ce9fb3bd315f35654b6e6ee4f92c675cde)
2024-07-05 20:00:04 +02:00
Daniel Rusek
e94e33b566 test: split the resolved test suite into separate test cases
Although being far from ideal and the first two test cases have to be run
before the setup phase otherwise they will fail, it still makes the test
suite look much better and easier to read

(cherry picked from commit a9d472d6e4ae6c548dd24097b20563dc9c06b329)
2024-07-05 20:00:04 +02:00
Daan De Meyer
6c8e99dedd TEST-54-CREDS: Use UEFI firmware if available
On aarch64, SMBIOS is only available when using UEFI, so let's make
sure that the creds test uses UEFI when available so that it can
read creds from SMBIOS when running in a virtual machine.

(cherry picked from commit 436474dd4348d5f12f70d9032d1cc45171b335e7)
2024-07-05 20:00:04 +02:00
Daan De Meyer
78631dcafd TEST-18-FAILUREACTION: Set auto firmware
This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.

(cherry picked from commit f392be9e7756268fc1b9d5204adc642bee10c8fa)
2024-07-05 20:00:04 +02:00
Daan De Meyer
71fb49d02c TEST-09-REBOOT: Set auto firmware
This test runs in nspawn by default but will still run in qemu when
tests are run unprivileged so make sure we use UEFI if available to
avoid hangs when using the linux firmware.

(cherry picked from commit 3cf38516bb765126fee80fed6d984ae963d075de)
2024-07-05 20:00:04 +02:00
Daan De Meyer
938f7b6f29 TEST-06-SELINUX: Explicitly pull in autorelabel.service
(cherry picked from commit 7c04137a6f09f8536ea3dfb667bd5a862fe945f1)
2024-07-05 20:00:04 +02:00
Daan De Meyer
37412c952d TEST-70-TPM2: Use UEFI firmware if available
On x86 this doesn't matter but on aarch64 we need to make sure UEFI
is used so that /sys/kernel/security/tpm0/binary_bios_measurements
is there which is required for TEST-70-TPM2.

(cherry picked from commit 98f2a332cb1a3efc3b2e8a5914a895a0a051bda4)
2024-07-05 20:00:04 +02:00
Daan De Meyer
711f843e3a TEST-45-TIMEDATE: Use syslog identifier journalctl match
Using a unit match is racy whereas a syslog identifier match is
reliable.

(cherry picked from commit 24284098a4613e626368ebe06ea6e39e49a9bc0f)
2024-07-05 20:00:04 +02:00
Daan De Meyer
dc0167b674 TEST-64-UDEV-STORAGE: Make nvme_subsystem expected pci symlinks more generic
When running the test on aarch64 the symlinks look as follows:

"""
[root@H ~]# ls /dev/disk/by-path
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0       platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part1  platform-4010000000.pcie-pci-0000:00:05.0-nvme-16
platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part  platform-4010000000.pcie-pci-0000:00:04.0-scsi-0:0:0:0-part2  platform-4010000000.pcie-pci-0000:00:05.0-nvme-17
"""

So let's make the PCI patterns a little more generic so they match
both the x86 and the aarch64 paths.

(cherry picked from commit 72d121b60174b825bf1390958eb1b55f34c5ff5b)
2024-07-05 20:00:04 +02:00
Daan De Meyer
ffc8126cc6 test: pull in multi-user.target explicitly
Let's make sure we pull in multi-user.target so that we get a console
when a test fails and we're running meson test with --interactive.

(cherry picked from commit 32f3617fd700e4a98b35f8c28a2807c2e51a2d9f)
2024-07-05 20:00:04 +02:00
Daan De Meyer
b908f492bc TEST-64-UDEV-STORAGE: Fix python 3.9 compatibility
Using double quotes in f-strings only works from python 3.12 onwards.
Use single quotes to make sure python 3.9 works as well.

Also clean up quotes a little in general.

(cherry picked from commit 4e469c0af2e92914b324f0fb48cf4462caff5c86)
2024-07-05 20:00:04 +02:00
Daan De Meyer
1c4f25c296 TEST-64-UDEV-STORAGE: Use bus pci slot 1 instead of 0
Trying to use bus pci slot 0 fails on aarch64 so let's use 1 instead.

The error:

"""
qemu-system-aarch64: -device virtio-blk-pci,drive=drive0,scsi=off,bus=pci_bridge25: Unsupported PCI slot 0 for standard hotplug controller. Valid slots are between 1 and 31.
"""

(cherry picked from commit 7f07f9c8cdbcca3b57e40143e86e7179420d39db)
2024-07-05 20:00:04 +02:00
Zbigniew Jędrzejewski-Szmek
9663bb7410 TEST-58-REPART: reverse order of diff args
I expect the test output to be the second argument, so we're diffing "expected"
and "output", not the other way around.

I noticed this when working on https://github.com/systemd/systemd/pull/33081.

(cherry picked from commit 6bb3ea655d08c0602c99ccd2a580ba102fd19114)
2024-07-05 20:00:04 +02:00
Yu Watanabe
81acc5b39a test-execute: add a test case for issue #33299
(cherry picked from commit 956a9f00b444145ebc5ddc7c5cefb0a6c9c7ca8f)
2024-07-05 20:00:04 +02:00
Yu Watanabe
54910267ba test-network: check if static routes not overridden by NDisc routes
(cherry picked from commit 62fb079a3b4a6553d87d06a3004d21b4e322a4e5)
2024-07-05 20:00:04 +02:00
Luca Boccassi
058fca7e6c mkosi: add support for TEST_SAVE_JOURNAL to integration test wrapper
Same variable and values as supported by the shell suite

(cherry picked from commit 59d4970a552cbc30d7977bdc9eca756b41260875)
2024-07-05 20:00:04 +02:00
Luca Boccassi
771bb489bf test: skip TEST-69-SHUTDOWN on Debian
There is a regression in the login package, skip the test until
it is fixed. https://bugs.debian.org/1075733

(cherry picked from commit 92d9d5ca70b0a8b3aea12f24e9cd0f770c31a94c)
2024-07-05 11:38:42 +02:00
Luca Boccassi
c26e56d08f install: allow removing symlinks even for units that are gone
If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a6207efc9ae9e0b1f73975b5b610914017

(cherry picked from commit 5163c9b1e56293b1bb2803420613c5b374570892)
2024-06-18 20:41:01 +02:00
Yu Watanabe
4cc6da9a5d test-network: mention that the captive portal option is supported since v2.20
The current latest release is v2.19, hence the test is typically skipped now.

(cherry picked from commit 4f6d8ab0767e534553bfa130f39dbb07ebb804a4)
2024-06-18 20:41:01 +02:00
Luca Boccassi
7d65709901 test: use 'auto' instead of 'uefi' for automated fallback
mkosi will prefer UEFI if the architecture supports it, but fallback
to 'linux' if it doesn't.

(cherry picked from commit 80468db8fa21ffd07dc2f28c656eeaf8f0292367)
2024-06-18 20:41:01 +02:00
Luca Boccassi
6178aa4bbc test: support TEST_NO_QEMU in mkosi integration wrapper
Same as the old integration test suite, allow skipping tests that
require qemu.
ppc64el's vsock support doesn't appear to work, so we'll skip it,
as it is already done in the legacy framework.

(cherry picked from commit 464d182b3e470e4163ca376145539a537a6e43a2)
2024-06-18 20:41:01 +02:00
Luca Boccassi
a36cb5660e test: support TEST_NO_KVM
The shell integration suite allows to manually deselect KVM, so
suppor the same env var for the same purpose in python.

(cherry picked from commit 7d2701e7d1d0a7194026dd371071df6e63f59a82)
2024-06-18 20:41:01 +02:00
Luca Boccassi
df1e7d9572 test: drop obsolete comment
We want to keep various logic here instead of mkosi, so drop the
temporary comment

(cherry picked from commit 626518ecd5e7b0c0c708ba53d7eb62934506ed54)
2024-06-18 20:41:01 +02:00
Luca Boccassi
51a2e7be5e test: drop unneeded firmware: uefi setting
These tests no longer need this, as they are running in nspawn, drop it

(cherry picked from commit f44fc531c95e37c83203375c411189009a01b482)
2024-06-18 20:41:01 +02:00
Luca Boccassi
50b53b8221 test: check the skip condition before installing additional files
(cherry picked from commit e1daedb4be6d8180790e0b303872fb1c87ddc7fc)
2024-06-18 20:41:01 +02:00
Frantisek Sumsal
4a468387ac test: dump a simple summary at the end of TEST-02-UNITTEST
Let's dump a list of skipped tests and logs from failed tests at the end
of TEST-02-UNITTEST to make debugging fails in CI slightly less painful.

(cherry picked from commit 2ac0e52f29eb5f0040882fc46bcfa369893577f3)
2024-06-18 20:41:01 +02:00
Yu Watanabe
8843726ac2 test-network: wait a while for addresses to be dropped
Hopefully fixes the following failure:
```
======================================================================
FAIL: test_ipv6_token_prefixstable (__main__.NetworkdRATests.test_ipv6_token_prefixstable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/systemd/tests/testdata/test-network/systemd-networkd-tests.py", line 5705, in test_ipv6_token_prefixstable
    self.assertNotIn('2002:da8:1:0:b47e:7975:fc7a:7d6e/64', output) # the 1st prefixstable
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '2002:da8:1:0:b47e:7975:fc7a:7d6e/64' unexpectedly found in
  '19: veth99@veth-peer: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000\n
       inet6 2002:da8:1:0:b47e:7975:fc7a:7d6e/64 scope global tentative dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 2002:da8:1:0:da5d:e50a:43fd:5d0f/64 scope global dynamic mngtmpaddr noprefixroute \n
          valid_lft 2100sec preferred_lft 1000sec\n
       inet6 fe80::1034:56ff:fe78:9abc/64 scope link proto kernel_ll \n
          valid_lft forever preferred_lft forever'
----------------------------------------------------------------------
```
2024-06-11 13:52:41 +01:00
Yu Watanabe
01420b2db5 network/ndisc: use router lifetime as one for redirect route
Previously, we did not set lifetime for redirect route, and redirect
routes were removed only when received a RA from the target address.
Thus, routes that redirect on-link addresses were never removed.

RFCs mention nothing about the lifetime of redirection. But the previous
implementation does not pass the IPv6 Core Conformance Tests.

This makes
- remember all received RAs and manage them by the sender address
  (previously, remembered only one with the highest preference),
- then use the router lifetime as one for redirect route,
- remove redirect route also when the router corresponds to the sender
  address is dropped (previously, considered only target address).

Note, even if we recieve a new RA, we do not update existing redirect
routes. The lifetime of the redirect route is updated only when a new
Redirect message is received.

Closes #32527.
2024-06-06 11:19:55 +01:00
Daan De Meyer
1a48d8549f core: Fix CPUQuotaPerSecUSec unit file serialization
CPUQuota= can deal with float percentages perfectly fine these days
(up to two places after the dot), so let's take that into account
when serializing the value to the transient unit file so we don't lose
precision when specifying e.g. "CPUQuota=0.5%".
2024-06-05 16:50:36 +02:00
Yu Watanabe
dadf2bd4f4 test-network: introduce a .network file to protect existing interfaces 2024-06-03 18:41:26 +01:00
Yu Watanabe
653c38b3eb test-network: show PID and Invocation ID of networkd
Then, we can easily find relevant journal entry on failure.
This is especially useful when the test is running with --no-journal.
2024-06-03 18:41:26 +01:00
Yu Watanabe
6fec598290 test-network: flush stream buffer and journals before/after running test 2024-06-03 18:41:26 +01:00
Yu Watanabe
22fa8f6724 test-network: generate debugging logs of networkd-persistent-storage.service 2024-06-03 18:41:26 +01:00
Luca Boccassi
80a3eb5ab5 test: disable TEST-21-DFUZZER in mkosi, as it is very flacky
Can be re-enabled once https://github.com/systemd/systemd/issues/33156
is solved
2024-06-03 19:37:17 +02:00
Luca Boccassi
d6243ebedd journald: enable persistent FD Store to fix logging during soft-reboot
A unit with StandardOutput=journal (the default) will get its stdout/stderr sockets
disconnected when journald stops, as the file descriptors on journald's side are
not preserved (it works on restart, as the FD Store keeps them open during restarts).
Set FileDescriptorStorePreserve=yes so that the journal FD's stay open during a soft
reboot, and applications don't get broken stdout/stderr.
2024-06-03 16:30:54 +01:00
Luca Boccassi
88c2ef1f75 Revert "test: Run end.sh when running integration tests with mkosi"
It seems this introduced a regression in the CentOS CI;

14:25:58 FAILED TASKS:14:25:58 -------------
14:25:58 TEST-03-JOBS
14:25:58 TEST-52-HONORFIRSTSHUTDOWN
14:25:58 TEST-63-PATH

Revert for now.

This reverts commit da3c6fc55363af2163b4d2613c9951bdaea24810.
2024-06-03 16:29:23 +01:00
Daan De Meyer
9619fdc102
Merge pull request #33157 from DaanDeMeyer/end
test: Run end.sh when running integration tests with mkosi
2024-06-02 21:04:56 +02:00
Daan De Meyer
da3c6fc553 test: Run end.sh when running integration tests with mkosi 2024-06-02 19:15:21 +02:00
Daan De Meyer
7c0ab0cdf2 TEST-16-EXTEND-TIMEOUT: Convert to oneshot service
To match the other service units more and allow adding more
ExecStart= lines via dropins.
2024-06-02 19:15:21 +02:00
Yu Watanabe
46322f2742 test: exit earlier when cgroup user xattr is not supported
Also, use trap for cleaning up the test environment.
2024-06-01 22:35:07 +09:00
Yu Watanabe
5f03c19f7b test: reduce number of 'systemctl daemon-reload' a bit 2024-06-01 22:28:32 +09:00
Yu Watanabe
7faf8987ed test: sync journal in short-living services
This also adjusts LogLevelMax=.

Hopefully, this makes the test much stabler.
2024-06-01 22:25:50 +09:00
Yu Watanabe
77356099ce test-network: add missing sleep()
Fixes a bug introduced by 7ef26afca555a5e167ebc59514490906a46db2cb.

Fixes #33098.
2024-06-01 08:25:10 +02:00
Daan De Meyer
f4a0dd0ef6
Merge pull request #33105 from DaanDeMeyer/sanitizers
Sanitizers
2024-05-31 19:44:05 +02:00
Daan De Meyer
605d72cb14 TEST-21-DFUZZER: Stop marking as slow
This was a workaround to not run TEST-21-DFUZZER without sanitizers.
Now that we're going to get sanitizer support, let's run it by default
again.
2024-05-31 17:26:13 +02:00