Commit Graph

6022 Commits

Author SHA1 Message Date
Matteo Croce
9b31b3d5ee test: add basic test for timer serialization
Set an OnCalendar= timer before the downgrade, then test for its
validity after the downgrade and the upgrade.
2025-07-17 17:22:32 +01:00
Yu Watanabe
8013beb4a2 Revert "test: skip one test case when running on coverage"
This reverts commit 2cc6c651ee.

The issue was fixed by b955051244.

Closes #38163.
2025-07-16 10:50:36 +01:00
Matteo Croce
2e354ac7da tests: avoid apt-get asking for user input
apt needs to be called with `-y` to avoid asking for user input,
and thus blocking the script execution when ran non-interactively.
2025-07-16 02:05:41 +01:00
Yu Watanabe
ee7ed2f067 fsck,quotacheck: add credentials support and drop support of /forcefsck and friends (#38197) 2025-07-16 08:29:20 +09:00
Yu Watanabe
c0c8f918bb test-network: stop varlink.socket before stopping networkd.service
To avoid the following warnings:
```
systemd-networkd-tests.py[3139]: Stopping 'systemd-networkd.service', but its triggering units are still active:
systemd-networkd-tests.py[3139]: systemd-networkd-varlink.socket
```

Follow-up for b0ea79c5b5.
2025-07-16 08:28:23 +09:00
Yu Watanabe
059afcadfd fsck: add fsck.mode and fsck.repair credentials support
Maybe useful when kernel command line is hard to change, e.g. when UKI
is used.
2025-07-16 05:47:38 +09:00
Luca Boccassi
7ebbe57ece Kill several SysV compat functionalities (v258) (#38178) 2025-07-15 01:21:13 +01:00
Luca Boccassi
9ae2dbf7f4 Two fixlets for coverage test (#38183) 2025-07-14 21:16:36 +01:00
DaanDeMeyer
1408505318 meson: Fix missing test dependencies
These test would fail when executed directly with meson test before
doing a build because the required dependencies are not declared, let's
fix that.
2025-07-14 13:07:29 +01:00
Yu Watanabe
dc1505555b utmp: drop setting runlevel entry in utmp
This removes systemd-update-utmp-runlevel.service and related command.
2025-07-13 05:49:00 +09:00
Yu Watanabe
2cc6c651ee test: skip one test case when running on coverage
Since 90fa161b5b, --bind= or Bind=
settings for coverage directory does not work with managed mode:
```
[  158.105361] systemd-nspawn[3718]: Failed to open tree and set mount attributes: Operation not permitted
[  158.105364] systemd-nspawn[3718]: Failed to clone /coverage: Operation not permitted
[  158.118655] systemd-nspawn[3707]: (sd-namespace) failed with exit status 1.
```
Let's tentatively skip the test case when running on coverage.

Workaround for #38163.
2025-07-12 21:19:01 +09:00
Luca Boccassi
375d80b04a ci: re-enable uefi secure boot
Kernel 6.11.0-1018-azure is now in use, which has a workaround
for the HyperV bug, so this should work again in GHA
2025-07-12 21:07:58 +09:00
Lennart Poettering
aac7e892e4 machined: make registration of unpriv user's VMs/containers work (#37855)
This adds missing glue to reasonably allow unpriv users VMs/containers
to register with the system machined.

This primarily adds two things:

1. machined can now properly track VMs/containers residing in subcgroups
of units, because that's effectively what happens for per-user
VMs/containers: they are placed below the system unit `user@….service`
in some user unit.

2. machines registered with machined now have an owning UID: users can
operate on their own machines withour re-authentication, but not on
others.

Note that this is only a first step regarding machined's hookup of
nspawn/vmspawn in the long run for unpriv operation.

I think eventually we should make it so that there's both a per-user and
a per-system machined instance (so far, and even with this PR there's
still one per-system instance), and per-user containers/VMs would
registering with *both*. Having two instances makes sense I think,
because it would mean we can make machined reasonably manage the
per-user image discovery, and also do the per-system network/hostname
handling.
2025-07-11 21:10:08 +02:00
Lennart Poettering
bfd356da63 test: add testcase for unpriv machined nspawns reg + killing
Let's add a superficial test for the code we just added: spawn a
container unpriv, make sure registration fully worked, then kill it via
machinectl, to ensure it all works properly.

Not too thorough but a good start.
2025-07-11 18:17:04 +02:00
DaanDeMeyer
42c288dfd8 test: Fix --capability=CAP_BPF condition
We also run in a VM if we're not running as root, yet we weren't
checking this when deciding whether to pass --capability=CAP_BPF or
not. Let's fix that.

Follow up for 9554ac3052
2025-07-11 16:08:00 +02:00
Yu Watanabe
f2e9193fcf test: drop unnecessary line continuation 2025-07-11 22:24:25 +09:00
Yu Watanabe
b1ce0a2b50 conf-files: make conf-file enumerators provide more detailed information of enumerated files (#38006)
This introduces `struct ConfFile` that stores detailed information of an
enumerated file, and introduces `conf_files_list_full()` and friends
that provide results in `ConfFile`.
Then make udev, hwdb, catalog, and cat-files use the new function and
struct to make them not read files outside of specified root directory.
2025-07-11 13:50:47 +09:00
Yu Watanabe
98751cf16e mkosi: various improvements (#38156) 2025-07-11 12:40:22 +09:00
Yu Watanabe
bdfb884237 TEST-17-UDEV: conditionalize test cases for testuser
Then, we can also run the test script in our local machine.
2025-07-11 10:42:08 +09:00
Yu Watanabe
a4a6e21673 udevadm: do not read udev rules files outside of the specified root directory
With this change, an invalid symlink and an empty file is silently
ignored. Hence, the test code is slightly updated.
2025-07-11 10:42:08 +09:00
Yu Watanabe
661b5bfd21 pretty-print: make conf_files_cat() not show files outside of the specified root.
Then, make the function show the original and resolved path if they are
different.

With this change, procfs needs to be mounted on /proc/, hence the test
code is slightly updated.
2025-07-11 10:42:08 +09:00
Yu Watanabe
d6b3793704 test: drop unnecessary disablement of pipefail 2025-07-11 08:45:46 +09:00
Ubuntu
df5b3426f6 journald: support reloading configuration at runtime 2025-07-10 21:38:36 +02:00
DaanDeMeyer
7f76ff2821 tree-wide: Use "mkosi box" instead of "mkosi sandbox"
The box verb was added as a synonym for sandbox. sandbox still works,
but let's switch to box as it's shorter.
2025-07-10 16:24:34 +02:00
Zbigniew Jędrzejewski-Szmek
d871e07285 TEST-04-JOURNAL: drop unexpected whitespace 2025-07-10 13:37:07 +09:00
Lennart Poettering
03b4a607f6 core: followups for the recent subgroup killing commits
This is a follow-up for 0f23564ad4 and
6b02854f50, as suggested here:

https://github.com/systemd/systemd/pull/37855#pullrequestreview-2997596953
2025-07-10 13:32:51 +09:00
Matteo Croce
ea9826eb94 core: add options to delegate BPFFS token creation
Add four new options BPFDelegate{Commands,Maps,Programs,Attachments}=
in order to delegate to a BPFFS instance the permission to create tokens.

The value is a list of options taken from:
https://github.com/torvalds/linux/blob/v6.14/include/uapi/linux/bpf.h#L922-L1121
The special value "any" means to allow every possible values.

More informations about BPF tokens here:
https://lwn.net/Articles/947173/
2025-07-08 22:35:29 +02:00
Matteo Croce
3a47437fc9 core: Introduce PrivateBPF= to mount a private BPFFS
Add a new option PrivateBPF= to mount a new instance of bpffs within a
namespace.
PrivateBPF= can be set to "no" to use the host bpffs in readonly mode
and "yes" to do a new mount.
The mount is done with the new fsopen()/fsmount() API because in future
we'll hook some commands between the two calls.
2025-07-08 22:33:28 +02:00
Matteo Croce
9554ac3052 tests: run test with CAP_BPF
Add CAP_BPF to tests run with nspawn, so we don't have to use a VM
to test BPF calls.
2025-07-08 18:23:46 +02:00
Lennart Poettering
14354d70e1 test: invoke systemd-nspawn properly from a session
Let's not run user code outside of user context, that's not how things
are deployed, and means we cannot test the session setup properly
2025-07-08 15:55:01 +09:00
Lennart Poettering
8cf772edc1 test: add testcase for subcgroup killing 2025-07-08 03:29:40 +02:00
Andres Beltran
c777c05125 test: add test for quotas on Exec directories 2025-07-07 17:31:05 +00:00
Andres Beltran
a89afe1948 Add quota support for DBus 2025-07-07 17:31:03 +00:00
Lennart Poettering
64a78cb082 Unify error messages for transient settings, fix handling of Ex variants (#38083) 2025-07-07 09:39:40 +02:00
Zbigniew Jędrzejewski-Szmek
228d84e37a systemd-analyze: stop printing Ex transient settings
The test will fail if we ever add one again in the future by mistake.
2025-07-06 18:17:47 +02:00
Zbigniew Jędrzejewski-Szmek
fb98c75e0e shared/bus-unit-util: tweak bus_append_exec_command to use Ex prop only if necessary
This changes little in behaviour, the conceptual part is more important. The
non-Ex variant is the actual name on the command line, and we should use the
non-Ex D-Bus property too, if it works. This increases compatibility with old
versions. But the code was mostly doing the right thing. Even the tests tested
the right thing.

Follow-up for b3d593673c and
898fc00e79.

The test is simplified by taking advantage of the fact that both names
on the commandline are supposed to behave identically.

Partially resolves https://github.com/systemd/systemd/issues/37174.
2025-07-06 18:17:43 +02:00
Luca Boccassi
163e666204 meson: call qemu with -machine virt on aarch64
'qemu-system-aarch64 -device help' fails when no machine is specified.
Use the 'virt' type which seems to be what everyone uses for VMs.
2025-07-05 20:21:51 +01:00
Luca Boccassi
d25e515ebc mkosi: enable arm64 job and test fixlets (#38066)
Enable nspawn job, as there's no nested kvm so VMs are too slow. Fix
some tests that fail in a VM anyway, might add a nightly job later that
runs them.
2025-07-05 11:46:30 +01:00
Yu Watanabe
4df7d51cde networkd-test: stop varlink socket before setting up runtime directories
Follow-up for b0ea79c5b5.
2025-07-05 16:54:19 +09:00
Luca Boccassi
c0a5801f7b mkosi: enable arm64 job
There's no acceleration, so nested VMs are too slow, only enable
nspawn.
2025-07-04 17:39:29 +01:00
Luca Boccassi
4bffb45bb7 test: /lib64 is not guaranteed to exist, do not try to copy it if not 2025-07-04 17:21:16 +01:00
Luca Boccassi
a1000c075b test: bump machinectl timeouts from 10s to 30s
Nested arm64 VMs are very slow, bump the timeouts
2025-07-04 17:21:16 +01:00
Luca Boccassi
b6be8bf2c6 test: do not fail if scsi_debug module not available
On Debian it's only built on amd64 kernels, so skip test cases if it
cannot be loaded
2025-07-04 17:21:16 +01:00
ZIHCO
9a08000d18 systemd-analyze: added the verb unit-shell to spawn and attach shell 2025-07-04 16:09:07 +01:00
Yu Watanabe
c2f3bb742b Add systemd-analyze verb to list runtime unit properties (#37665) 2025-07-04 11:47:38 +09:00
Zbigniew Jędrzejewski-Szmek
a839c4b7b7 analyze: add transient-settings verb
Related to https://github.com/systemd/systemd/pull/37641.

The name "transient settings" was used in docs/TRANSIENT-SETTINGS.md.
Using "setting" helps distinguish this from D-Bus "properties", which are
a much larger set, partially overlapping.
2025-07-03 21:03:26 +02:00
Zbigniew Jędrzejewski-Szmek
9228d67dc8 test: drop ProtectHostnameEx, add one test for ProtectHostnameEx
This is a separate commit because the parent commit is supposed to be
backward compatible, i.e. the tests must pass with both the bogus ProtectHostnameEx
name and ProtectHostname.

A test is added for ProtectHostnameEx to verify that it is still accepted
for backward compat.
2025-07-03 19:35:33 +02:00
Daan De Meyer
67b2cb7769 test: Add tests for various varlink socket units
Let's make sure these socket units work as expected by stopping the
related services and making sure the services are started as expected
when a client connects to the corresponding socket.
2025-07-03 11:24:03 +02:00
Luca Boccassi
a63f0ea73d test: allow to run test-local-addresses with IPv6 disabled by default, and assume RTA_VIA is always supported (#38039) 2025-07-03 09:58:02 +01:00
Yu Watanabe
34af1513d0 fuzz: avoid assertion for ExecContext.private_var_tmp triggered
Follow-up for 6156bec7a4.

Fixes #38037 and oss-fuzz#429112745.
2025-07-03 09:55:58 +01:00