Commit Graph
82907 Commits
Author SHA1 Message Date
Luca Boccassi b735d01c8a test: skip tpm2 test on s390x on GHA
The test reliably fails on s390x but only on the GHA worker,
on a native s390x VM it works. Skip it for now.
2025-07-15 16:17:34 +01:00
Lennart Poettering 987d283aca machined mini tweaks (#38226) 2025-07-15 14:33:44 +02:00
DaanDeMeyer dbbbdde266 nspawn: Generalize parse_bind_user_shell()
Preparation for reuse in vmspawn.
2025-07-15 14:22:52 +02:00
Lennart Poettering d32ca63318 machined: use RET_GATHER() more 2025-07-15 13:09:08 +02:00
Lennart Poettering 4baede011d machined: align string table 2025-07-15 12:49:08 +02:00
Lennart Poettering 0fa8b51962 tree-wide: the env var is called $XDG_RUNTIME_DIR, not $XDG_RUNTIME_DIRECTORY 2025-07-15 12:49:08 +02:00
Luca Boccassi 5b94f463f0 shell-completion: prettify and discard error messages (#38210)
followup of #38182
2025-07-15 09:30:30 +01: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
Luca Boccassi 6eab4cd44c boot: add LoaderTpm2ActivePcrBanks runtime variable
It turns out checking sysfs is not 100% reliable to figure out whether
the firmware had TPM2 support enabled or not. For example with EDK2 arm64, the
default upstream build config bundles TPM2 support with SecureBoot support,
so if the latter is disabled, TPM2 is also unavailable. But still, the ACPI
TPM2 table is created just as if it was enabled. So /sys/firmware/acpi/tables/TPM2
exists and looks correct, but there are no measurements, neither the firmware
nor the loader/stub can do them, and /sys/kernel/security/tpm0/binary_bios_measurements
does not exist.

The loader can use the apposite UEFI protocol to check, which is a more
definitive answer. Given userspace can also make use of this information, export
the bitmask with the list of active banks as-is. If it's not 0, then we can be
sure a working TPM2 was available in EFI mode.

Partially fixes https://github.com/systemd/systemd/issues/38071
2025-07-14 20:56:22 +01:00
Daan De Meyer 9120022587 vmspawn: Run auxiliary daemons inside scope instead of separate service (#38047)
Currently, vmspawn is in this really weird state where vmspawn itself
and qemu will inherit the caller's execution environment but the
auxiliary
daemons it spawn will run in a fully pristine environment in the service
manager. In practice, this causes issues as checks for whether auxiliary
daemons are installed happen in the caller's execution environment but
they
might not exist in the spawned service's execution environment.

A good example of where this causes issues is trying to use
systemd-vmspawn
in our CI. We use mkosi in CI to run systemd-vmspawn in a custom
userspace
with all the necessary tools available, but systemd-vmspawn then tries
to
spawn services that run these tools using the host userspace, where the
tools are not available or too old and hence systemd-vmspawn fails to
start.

Let's make things more consistent and allow using systemd-vmspawn in CI
at
the same time by having systemd-vmspawn spawn auxiliary daemons itself
instead of having the service manager spawn them. We use
systemd-socket-activate to still have socket activation for these
services,
even though we now spawn them ourselves. To make sure we wait for
systemd-socket-activate to bind to its socket before continuing, we use
the
new general fork_notify() helper.

Why not support both "online" and "offline" operation? systemd-vmspawn
is not
well tested as is and supporting two completely separate modes for
spawning
auxiliary daemons will drastically increase the surface area for bugs.
Given
there doesn't seem to be a major benefit to running daemons in services,
it
seems better to only support offline operation and not both. Should we
want
separate resource control for the auxiliary daemons in the future, we
can run
move them into separate scopes if needed.
2025-07-14 16:51:18 +02:00
DaanDeMeyer 852de7ed70 nspawn: Prepare --bind-user= logic for reuse in systemd-vmspawn
Aside from the usual boilerplate of moving the shared logic to shared/,
we also rework the implementation of --bind-user= to be similar to what
we'll do in systemd-vmspawn. Instead of messing with the nspawn container
user namespace, we use idmapped mounts to map the user's home directory on
the host to the mapped uid in the container.

Ideally we'd also use the "userdb.transient" credentials to provision the
user records, but this would only work for booted containers, whereas the
current logic works for non-booted containers as well.

Aside from being similar to how we'll implement --bind-user= in vmspawn,
using idmapped mounts also allows supporting --bind-user= without having to
use --private-users=.
2025-07-14 16:25:22 +02:00
DaanDeMeyer c81fa16ddf vmspawn: Run auxiliary daemons inside scope instead of separate service
Currently, vmspawn is in this really weird state where vmspawn itself
and qemu will inherit the caller's execution environment but the auxiliary
daemons it spawn will run in a fully pristine environment in the service
manager. In practice, this causes issues as checks for whether auxiliary
daemons are installed happen in the caller's execution environment but they
might not exist in the spawned service's execution environment.

A good example of where this causes issues is trying to use systemd-vmspawn
in our CI. We use mkosi in CI to run systemd-vmspawn in a custom userspace
with all the necessary tools available, but systemd-vmspawn then tries to
spawn services that run these tools using the host userspace, where the
tools are not available or too old and hence systemd-vmspawn fails to start.

Let's make things more consistent and allow using systemd-vmspawn in CI at
the same time by having systemd-vmspawn spawn auxiliary daemons itself
instead of having the service manager spawn them. We use
systemd-socket-activate to still have socket activation for these services,
even though we now spawn them ourselves. To make sure we wait for
systemd-socket-activate to bind to its socket before continuing, we use the
new general fork_notify() helper.

Why not support both "online" and "offline" operation? systemd-vmspawn is not
well tested as is and supporting two completely separate modes for spawning
auxiliary daemons will drastically increase the surface area for bugs. Given
there doesn't seem to be a major benefit to running daemons in services, it
seems better to only support offline operation and not both. Should we want
separate resource control for the auxiliary daemons in the future, we can run
move them into separate scopes if needed.

As a bonus, this approach allows us to get rid of the extra complexity of
having to fork off the qemu process first so we can allocate a scope for it
that the other services bind to. This means large parts of
0fc45c8d20 are reverted by this commit.
2025-07-14 15:07:48 +02:00
DaanDeMeyer e4691ebb49 fork-journal: Generalize to fork-notify
Most of the logic isn't journalctl specific, let's generalize a bit
so we can reuse this for other commands as well.
2025-07-14 15:07:48 +02:00
DaanDeMeyer be3f7aaf44 fork-journal: Don't log if process is already gone in journal_terminate() 2025-07-14 15:07:48 +02:00
Daan De Meyer 43d0d111d2 core/cgroup: always submit unit to realize queue if all controllers are being invalidated (#38194) 2025-07-14 15:07:16 +02:00
DaanDeMeyer a79e94aa58 vmspawn: Pass credentials via files
Credentials data can get potentially very large. Passing it all via
the command line is rather messy. Let's pass all the credential data
via files instead to both make the final command line less verbose
and reduce the chance of us running into command line size limits if
many or large credentials are used.
2025-07-14 14:54:19 +02:00
DaanDeMeyer e19e17df57 mkosi: Disable systemd-timesyncd by default
It causes quite a bit of debug log noise by repeated DNS lookups so
let's disable it by default to avoid log noise.
2025-07-14 14:51:52 +02: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
Eisuke Kawashima c2b0f637c2 fix(shell-completion): discard error messages 2025-07-14 20:24:26 +09:00
Eisuke Kawashima 86fff7fb38 fix(shell-completion): strictly parse env output
shell functions may be exported, when env prints their body in multiple
lines
2025-07-14 20:24:26 +09:00
Eisuke Kawashima b371e7252c fix(SC2164): robust cd conditional 2025-07-14 20:24:26 +09:00
Eisuke Kawashima 01e769bc2e fix(SC2162): add -r to read 2025-07-14 20:24:26 +09:00
Eisuke Kawashima cb2e0dc4f5 fix(shell-completion): correct conditional 2025-07-14 20:24:26 +09:00
Eisuke Kawashima 12e64a4848 style(shell-completion): remove unnecessary backslashes 2025-07-14 20:24:25 +09:00
Eisuke Kawashima 5300aa7a1d style(shell-completion): remove trailing semicolons 2025-07-14 20:24:25 +09:00
Eisuke Kawashima 56c093004c style(shell-completion): add missing semicolons 2025-07-14 20:24:25 +09:00
Eisuke Kawashima dfe6b3fa38 style(shell-completion): expand hard tabs and fix indentation 2025-07-14 20:24:25 +09:00
Eisuke Kawashima 2da41c4b51 fix(shell-completion): fix help string 2025-07-14 20:24:25 +09:00
DaanDeMeyer b955051244 nspawn: Don't clear idmapping if we're not doing an idmapped mount
We only need to clear the existing idmapping if we're going to be
replacing it with another idmapping. Otherwise we should keep the
existing idmapping in place.
2025-07-14 11:54:56 +01:00
Daan De Meyer 6488fa5634 Replace underscores in filenames with hyphens (#38203) 2025-07-14 10:37:23 +02:00
DaanDeMeyer f4df5902d8 bpf: Use hyphens in directory names instead of underscores 2025-07-13 12:45:37 +02:00
DaanDeMeyer d962bfeb03 boot: Use hypen in efi-config.h instead of underscore 2025-07-13 12:41:57 +02:00
DaanDeMeyer 47f761fda6 basic: Use hyphens in missing header names instead of underscores 2025-07-13 12:41:14 +02:00
DaanDeMeyer 13a86b4d9f workflows: Use hyphens in filenames instead of underscores 2025-07-13 12:41:12 +02:00
Yu Watanabe f12cc0d3be mkosi: update debian commit reference to a8ad8e30e70c0b82ecb8fe016f2dde3a084236f0
* a8ad8e30e7 Stop installing legacy sysv tools/units for upstream builds
* 9856b1b1bd Install new files for upstream build
* b68bfb52d4 Update changelog for 257.7-2 release
* 3bd5f6d2e0 systemd-boot-tools: change architecture to linux-any
* 057ce29542 Move bootctl zsh completion file too to new package
* b47be01659 Revert "Revert installing systemd-networkd-varlink.socket"
* 71a425dd3b ukify: recommend sbsigntool | pesign for signing
* 54f67475ee Revert installing systemd-networkd-varlink.socket
2025-07-13 05:49:09 +09:00
Yu Watanabe c3116558ad mkosi: drop SysV compat files from packages
These workarounds can be dropped when the downstream .spec or filelists
are updated.
2025-07-13 05:49:09 +09:00
Yu Watanabe 75df71d180 NEWS: mention removal of several SysV compat features 2025-07-13 05:49:09 +09:00
Yu Watanabe e58ba80a40 units: drop runlevel[0-6].target 2025-07-13 05:49:09 +09: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 8ba48d4bf8 core,initctl,systemctl: kill /dev/initctl support
This also kills support for controlling system state through
/sbin/init, initctl, and telinit.
2025-07-13 05:38:14 +09:00
Yu Watanabe af925f7eb3 systemctl: kill SysV compat 'runlevel' command 2025-07-13 05:38:13 +09:00
Yu Watanabe 5572fb18c0 systemctl/halt: drop support for calling in SysV init script
Traditionally, halt is called at the end of the init script on
reboot/shutdown. To support such usecase, previously we read the current
runlevel from utmp and set force flag on reboot/shutdown.

This drops the support for such the usecase.
Note, neither supported nor tested, but hopefully still the command can
be used in the end of the sysv init script by specifying -ff.
2025-07-13 05:38:13 +09:00
Yu Watanabe c17516a84a systemctl: move functions in systemctl-sysv-compat.[ch]
- parse_shutdown_time_spec() is used only by systemctl-compat-shutdown.c,
- talk_initctl() and action_to_runlevel() are used only by systemctl-compat-telinit.c,
- the exit code enum is widely used in systemctl, hence moved to systemctl-util.h.

No functional change, preparation for later changes.
2025-07-13 05:38:13 +09:00
Mike Yuan 391ad5d8aa io.systemd.Unit.List fix context/runtime split (#38172)
This PR rearranges fields in io.systemd.Unit.List according to
@poettering guidance:

> if a property can be set in a unit file, ever, then it belongs in
context. Otherwise, it belongs to runtime.

https://github.com/systemd/systemd/issues/38124
2025-07-12 18:01:41 +02:00
Mike Yuan e0d3213e09 core/cgroup: always submit unit to realize queue if all controllers are being invalidated
Alternative to #38190
Fixes #38112
2025-07-12 17:41:52 +02:00
Mike Yuan 77af13ffdb core/cgroup: remove deserialization for "cpuacct-usage-base"
This has been superseded by "cpu-usage-base" ever since
the introduction of cgroup v2. With upgrading and thus
deserialzing from cgroup v1 systems becoming impossible
it is eligible for removal.
2025-07-12 17:41:04 +02:00
Mike Yuan db54d1a6b7 core/exec-invoke: pass "/" instead of "" for cgroup root 2025-07-12 17:32:32 +02: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
Yu Watanabe 5921c48fcf meson: fix coverage build
This moves coverage.h to src/coverage/, and specifies path to coverage.h
with files() directive, to make it can be included even when located
outside of the include directories. Otherwise, libc-wrapper cannot be
built when -Db_coverage=true option is enabled.

Follow-up for 543a48b653.
2025-07-12 21:19:01 +09:00