1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-06 17:18:12 +03:00
Commit Graph

5137 Commits

Author SHA1 Message Date
Daniel Dawson
7323feef9b systemd-integritysetup: accept integrity-algorithm=xxhash64
Signed-off-by: Daniel Dawson <danielcdawson@gmail.com>
(cherry picked from commit 0c96911afb)
2024-10-08 16:39:12 +01:00
Ivan Kruglov
0cd10d410b machine: resolve race condition in TEST-13-NSPAWN.machinectl.sh
I encountered this race condition while working on TEST-13-NSPAWN.varlinkctl.sh.
The long-running machine's init script sometimes does not have time to start and
register signals. As result, occasiounally failed tests.

(cherry picked from commit e826a8bed4)
2024-10-08 16:39:12 +01:00
Simon Pilkington
bc0ba0030b creds: fix cat with encrypted credentials
Fixes: https://github.com/systemd/systemd/issues/34547
(cherry picked from commit 32951fe4de)
2024-10-08 16:39:12 +01:00
Daan De Meyer
3f313d0d49 test: Run TEST-74-AUX-UTILS in virtual machine
Various tests skip themselves when running in a container so make
sure the test runs in a virtual machine so we get full coverage.

(cherry picked from commit f4faac2073)
2024-10-08 16:39:12 +01:00
Luca Boccassi
2552348da2 portable: ensure PORTABLE_FORCE_ATTACH works even when there is a leftover unit
Force means force, we skip checks with PID1 for existing units, but
then bail out with EEXIST if the files are actually there. Overwrite
everything instead.

(cherry picked from commit 1e2d1a7202)
2024-09-11 13:19:25 +02:00
Luca Boccassi
a2c84836ef test: mount ld.so.cache in minimal nspawn container if present
In some cases (SUSE Tumbleweed) this is needed as a library (libz) is
not in the default path, so it fails to run.

(cherry picked from commit 1e17e48b96)
2024-09-11 13:19:25 +02:00
Daan De Meyer
58f38e0a28 tests: Don't override QemuKvm= value if TEST_NO_KVM=0
Let's disable KVM if TEST_NO_KVM=1 is set but let's not specify anything
if it's not set so the QemuKvm= setting from mkosi.conf is used.

(cherry picked from commit c8e7cfeddc)
2024-09-10 14:56:05 +02:00
Yu Watanabe
dda8cb4a8e test: fix indentation
(cherry picked from commit fe6049d021)
2024-09-10 14:56:05 +02:00
Yu Watanabe
69282da9aa test: add test case for systemd-repart --seed=random
For issue #34257.

(cherry picked from commit 56d6ebd404)
2024-09-10 14:56:05 +02:00
Yu Watanabe
44dc95690c test: add test case that 'nspawn --network-veth' enables IP forwarding
(cherry picked from commit 08779d7c55)
2024-09-10 14:56:05 +02:00
Yu Watanabe
93759103e6 test: allow to skip matrix_run_one() if $TEST_MATCH_TESTCASE is set
(cherry picked from commit 7908e1d459)
2024-09-10 14:56:05 +02:00
Daan De Meyer
0eec580add Add $SYSTEMD_IN_CHROOT to override chroot detection
When running unprivileged, checking /proc/1/root doesn't work because
it requires privileges. Instead, let's add an environment variable so
the process that chroot's can tell (systemd) subprocesses whether
they're running in a chroot or not.

(cherry picked from commit 2701c2f67d)
2024-08-19 07:49:55 +02:00
Luca Boccassi
a08ab811de test: add TEST_SKIP to mkosi integration test wrapper
Takes a space-separate list of test names, allows to skip one or more tests

(cherry picked from commit ddc91af4ea)
2024-08-15 14:04:42 +01:00
Daan De Meyer
c3a6aa495b test: Use usual setup in integration-test-setup script
(cherry picked from commit db043a9b1a)
2024-08-15 14:04:41 +01:00
Daan De Meyer
274d5bf224 test: Fix section of StateDirectory=
(cherry picked from commit dba138b863)
2024-08-15 14:04:41 +01:00
Nick Rosbrook
6f57f9b8aa core/unit: do not use unit path cache in unit_need_daemon_reload()
When unit_need_daemon_reload() calls unit_find_dropin_paths() to check
for new drop-in configs, the manager's unit path cache is used to limit
which directories are considered. If a new drop-in directory is created,
it may not be in the unit path cache, and hence unit_need_daemon_reload()
may return false, despite a new drop-in being present. However, if a
unit path cache is not given to unit_file_find_dropin_paths() at all,
then it behaves as if the target path was found in the unit path cache.

So, to fix this, adapt unit_find_dropin_paths() to take a boolean
argument indicating whether or not to pass along the unit path cache.
Set this to false in unit_need_daemon_reload().

Fixes #31752

(cherry picked from commit 82c482d573)
2024-08-15 14:04:41 +01:00
Luca Boccassi
195124fd1c test: note in README how to get full list of Ubuntu CI jobs
(cherry picked from commit 79488ac003)
2024-08-15 14:04:41 +01:00
Nick Rosbrook
edf52384c2 sysusers: check if requested group name matches user name in queue
When creating a user, check if the requested group name matches a user
name in the queue. If that matched user name is also going to be a group
name, then use it for the new user too. In other words, allow the
following:

 u foo -
 u bar -:foo

when both foo and bar are new users.

Fixes #33547

(cherry picked from commit 18a8f03e51)
2024-08-15 14:04:41 +01:00
Yu Watanabe
b50419e838 systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry=help
This fixes the following assertion:
===
SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring.
Failed to connect to bus: Operation not supported
===

Fixes a bug introduced by 97af80c5a7.
Fixes #33661.
Fixes oss-fuzz#70153.

(cherry picked from commit 1056457d11)
2024-08-15 14:04:41 +01:00
Arnaud Patard
74f830e048 src/pcrlock/pcrlock.c: Handle empty pcrlock.d directories
Running the following commands:

  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock predict --pcr=1+2+3+4+5+16

Will result in:

...
Floating point exception

Running the following commands:
  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock make-policy --pcr=1+2+3+4+5+16

Will result to this (partial) log:
...
Predicted future PCRs in 133us.
[]
...
Written policy digest 0000000000000000000000000000000000000000000000000000000000000000 to NV index 0x1921da6
...

So, add missing checks to handle gracefully cases where there's no variant
inside the component.

Signed-off-by: Arnaud Patard <arnaud.patard@collabora.com>
(cherry picked from commit e7a93e7521)
2024-08-15 14:04:41 +01:00
Daan De Meyer
df3736d149 test: Add a way to quickly iterate on an integration test
Rebuilding the integration test every time is very slow. Let's
introduce a way to iterate on an integration test without rebuilding
the image every time. By making a btrfs snapshot before we run the
integration test, we can then systemctl soft-reboot after running
the test to restore the rootfs to a pristine state before running
the test again.

As /run/nextroot will get nuked on reboot or soft-reboot, we introduce
a tmpfiles snippet to make sure it is recreated every (soft-)reboot
and adapt the existing tests to deal with this new symlink.

(cherry picked from commit af153e36ae)
2024-08-15 14:04:41 +01:00
Daan De Meyer
ad43f87ae8 test: Implement TEST_SHELL for mkosi based test runner
TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.

(cherry picked from commit dd1c01b20f)
2024-08-15 14:04:41 +01:00
Daan De Meyer
039af94fb5 test: Rename INTERACTIVE_DEBUG to TEST_SHELL
(cherry picked from commit 33f400a9e0)
2024-08-15 14:04:41 +01:00
Frantisek Sumsal
86d89f4a10 test: don't use /skipped for subtests
Since, at least the old framework, checks for the presence of the file
at the end and marks the whole test as skipped if it exists.

Resolves: systemd/systemd-centos-ci#728
(cherry picked from commit 4d1fbe53c1)
2024-08-15 14:04:41 +01:00
Frantisek Sumsal
2e2371c5b5 test: attempt to install sshd-session from multiple places
On Fedora the sshd-session binary is under /usr/libexec/openssh/ so
cover this path as well in the old framework.

Follow-up for aaa7b36bd1.

(cherry picked from commit ce2344bbee)
2024-08-15 14:04:41 +01:00
Michal Sekletar
1a3d8368bc socket: fix socket activation of stopped services with pinned FD store
(cherry picked from commit 941a12dcba)
2024-08-15 14:04:41 +01:00
Daan De Meyer
091c4820c4 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.

(cherry picked from commit 3de13e6148)
2024-08-15 14:04:41 +01:00
Dan Nicholson
b5448c16f8 firstboot: fix root params with creds and prompting disabled
Remove an early return that prevents --prompt-root-password or
--prompt-root-shell and systemd.firstboot=off using credentials. In that case,
arg_prompt_root_password and arg_prompt_root_shell will be false, but the
prompt helpers still need to be called to read the credentials. Furthermore, if
only the root shell has been set, don't overwrite the root password.

(cherry picked from commit 35bc4c3424)
2024-08-15 14:04:41 +01:00
Dan Nicholson
847dd914d0 firstboot: handle missing root password entries
If /etc/passwd and/or /etc/shadow exist but don't have an existing root entry,
one needs to be added. Previously this only worked if the files didn't exist.

(cherry picked from commit 2319154a6b)
2024-08-15 14:04:41 +01:00
Dan Nicholson
21d270d38f firstboot: create locked and empty root passwords consistently
Although locked and empty passwords in /etc/passwd are treated the same, in all
other cases the entry is configured to read the password from /etc/shadow.

(cherry picked from commit 5088de9daa)
2024-08-15 14:04:41 +01:00
Dan Nicholson
fdf270a89e test: extend firstboot testing
Several features were not being tested or weren't being evaluated thoroughly.

(cherry picked from commit 38688bbc8f)
2024-08-15 14:04:41 +01:00
Daan De Meyer
852be5a77f test: Don't mount build sources into image when running non-interactively
(cherry picked from commit 578ee05155)
2024-08-15 13:08:37 +01:00
Michal Koutný
8ea1e6450c test: Fail cgroup delegation test when user cannot be created
It means: a) user cannot be created, something's wrong in the
test environment -> fail the test; b) user already exists, we shall not
continue and delete (foreign) user.

(cherry picked from commit 3e6e3e6d40)
2024-08-15 13:08:37 +01:00
Daan De Meyer
161286e989 resize-fs: Put minimal ext4 size in the same ballpark as the other filesystems
TEST-46-HOMED fails on ext4 because the filesystem is deemed to small
for activation by cryptsetup. Let's bump the minimal filesystem size for
ext4 a bit to be in the same ballpark as ext4 and btrfs to avoid weird
errors due to impossibly small filesystems.

Also use U64_MB while we're touching this.

(cherry picked from commit ae07feb401)
2024-08-15 13:08:37 +01:00
Michal Koutný
64b63f6cd0 test: Reorganize testcase of cgroup delegation
There are multiple subtests, just move them around into functions
(leveraging the testcase_* convention) to make space for new related
subtests.

(cherry picked from commit 4f0541dc59)
2024-08-15 13:08:37 +01:00
Daan De Meyer
67ad9221b7 TEST-54-CREDS: Specify SMBIOS creds via corresponding mkosi option
This allows mkosi to combine fstab.extra with its own fstab.extra so
that it doesn't override the one we pass for the test.

(cherry picked from commit ebe17e3f9e)
2024-08-15 13:08:37 +01:00
Luca Boccassi
277204f1a3 test: fix D-Bus policy override for TEST-73-LOCALE
We don't need to allow non-root, and the policy needs to specify destination
and interface too, to narrow it down

Follow-up for 7b5c38a91d

(cherry picked from commit a4c436c9d8)
2024-08-15 11:06:58 +01:00
Mike Yuan
6a3cb4cd11 core/unit: ignore dropins for masked units completely when checking need_reload
Follow-up for 19a44dfe45

If a drop-in is set from upper level, e.g. global unit_type.d/,
even if a unit is masked, its dropin_paths would still be partially
populated. However, unit_need_daemon_reload() would always
compare u->dropin_paths with empty strv in case of masked units,
resulting in it always returning true. Instead, let's ignore
dropins entirely here.

Fixes #33672

(cherry picked from commit 11b3775f51)
2024-07-22 14:27:30 +02:00
David Tardon
f81659f5f3 test: add a reproducer for #33672
(cherry picked from commit 8b6de9e638)
2024-07-22 14:27:30 +02:00
Mike Yuan
7da84cc154 test-execute: ExecStop= and friends should not get credentials
See #32583

(cherry picked from commit 60b218e36e)
2024-07-22 14:27:30 +02:00
Luca Boccassi
8f58652f5e test: override blocking localed policy in TEST-73-LOCALE
On Debian and derivatives writing calls to localed are blocked as other
tools are used to change settings, override that policy for the tests

(cherry picked from commit 7b5c38a91d)
2024-07-22 14:27:30 +02:00
Daan De Meyer
a40eb432cb test: Set priority for TEST-73-LOCALE
I don't know why yet, but TEST-73-LOCALE can take more than 10
minutes. Until we figure out why, let's give it a higher priority
so it doesn't bottleneck the test run.

(cherry picked from commit 14963ea90d)
2024-07-22 10:26:01 +01:00
Daan De Meyer
172ffeb813 TEST-06-SELINUX: Disable RuntimeBuildSources=
Otherwise fixfiles will try to relabel it which could potentially
lead to disaster. We also change the recommendation in HACKING.md
to set the default so that TEST-06-SELINUX can override it.

(cherry picked from commit 575f954b5d)
2024-07-22 10:26:01 +01:00
Daan De Meyer
2fd3514456 test: Add missing --no-rebuild to doc
Otherwise meson will try to rebuild all targets.

(cherry picked from commit b5eaa52d49)
2024-07-22 10:26:01 +01:00
Daan De Meyer
c54eab5dd0 mkosi: Streamline running the integration tests without building systemd
Let's document in detail how to build the integration test image and run
the integration tests without building systemd. To streamline the process,
we stop automatically using binaries from build/ when invoking mkosi directly
and don't automatically use a tools tree anymore if systemd on the host is too
old. Instead, we document these options in HACKING.md and change the mkosi meson
target to automatically use the current build directory as an extra binary search
path for mkosi.

(cherry picked from commit d279ec4a50)
2024-07-18 21:14:03 +02:00
Daan De Meyer
102ed56c61 mkosi: Remove enforcing=0 from default kernel command line
We already have selinux=0 in the default kernel command line so
enforcing=0 is redundant. Instead, pass in enforcing=0 when we
enable selinux in TEST-06-SELINUX.

(cherry picked from commit f5c44df929)
2024-07-18 21:12:25 +02:00
Daan De Meyer
1be0b1f54b TEST-13-NSPAWN: make sure we don't load libnss_systemd
Let's make sure we don't load libnss_systemd.so from bash as the
necessary environment variables aren't set to make that work when
we're running with sanitizers enabled.

We can't add a sanitizer wrapper for bash as the wrapper runs using
bash so you end up in a loop.

(cherry picked from commit 5ac0dc70ff)
2024-07-16 15:15:21 +02:00
Daan De Meyer
89904fc10c systemd-networkd-tests: Skip tests requiring dhcpd if it is not available
dhcpd is not available on CentOS Stream 10

See https://github.com/systemd/systemd/issues/33717

(cherry picked from commit 985d5b4bc2)
2024-07-16 15:15:08 +02:00
Daan De Meyer
c3342c3dc7 TEST-55-OOMD: Remove the opensuse user@ dropin
Required to make TEST-55-OOMD pass on OpenSUSE.

(cherry picked from commit f65ec2e904)
2024-07-16 15:15:01 +02:00
Daan De Meyer
1a995b9d66 TEST-64-UDEV-STORAGE: Use max_ioqpairs instead of num_queues
Fixes a deprecation warning from qemu.

(cherry picked from commit d97b48176b)
2024-07-16 15:14:47 +02:00