]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 months agoci: add build/unit-tests jobs for s390x 38232/head
Luca Boccassi [Tue, 15 Jul 2025 15:18:27 +0000 (16:18 +0100)] 
ci: add build/unit-tests jobs for s390x

3 months agotest: skip tpm2 test on s390x on GHA
Luca Boccassi [Tue, 15 Jul 2025 15:16:44 +0000 (16:16 +0100)] 
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.

3 months agomachined mini tweaks (#38226)
Lennart Poettering [Tue, 15 Jul 2025 12:33:44 +0000 (14:33 +0200)] 
machined mini tweaks (#38226)

3 months agonspawn: Generalize parse_bind_user_shell()
DaanDeMeyer [Mon, 14 Jul 2025 08:23:04 +0000 (10:23 +0200)] 
nspawn: Generalize parse_bind_user_shell()

Preparation for reuse in vmspawn.

3 months agomachined: use RET_GATHER() more 38226/head
Lennart Poettering [Tue, 15 Jul 2025 10:15:47 +0000 (12:15 +0200)] 
machined: use RET_GATHER() more

3 months agomachined: align string table
Lennart Poettering [Tue, 15 Jul 2025 10:15:34 +0000 (12:15 +0200)] 
machined: align string table

3 months agotree-wide: the env var is called $XDG_RUNTIME_DIR, not $XDG_RUNTIME_DIRECTORY
Lennart Poettering [Tue, 15 Jul 2025 10:08:12 +0000 (12:08 +0200)] 
tree-wide: the env var is called $XDG_RUNTIME_DIR, not $XDG_RUNTIME_DIRECTORY

3 months agoshell-completion: prettify and discard error messages (#38210)
Luca Boccassi [Tue, 15 Jul 2025 08:30:30 +0000 (09:30 +0100)] 
shell-completion: prettify and discard error messages (#38210)

followup of #38182

3 months agoKill several SysV compat functionalities (v258) (#38178)
Luca Boccassi [Tue, 15 Jul 2025 00:21:13 +0000 (01:21 +0100)] 
Kill several SysV compat functionalities (v258) (#38178)

3 months agoTwo fixlets for coverage test (#38183)
Luca Boccassi [Mon, 14 Jul 2025 20:16:36 +0000 (21:16 +0100)] 
Two fixlets for coverage test (#38183)

3 months agoboot: add LoaderTpm2ActivePcrBanks runtime variable
Luca Boccassi [Sat, 5 Jul 2025 22:04:35 +0000 (23:04 +0100)] 
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

3 months agovmspawn: Run auxiliary daemons inside scope instead of separate service (#38047)
Daan De Meyer [Mon, 14 Jul 2025 14:51:18 +0000 (16:51 +0200)] 
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.

3 months agonspawn: Prepare --bind-user= logic for reuse in systemd-vmspawn
DaanDeMeyer [Fri, 4 Jul 2025 08:26:34 +0000 (10:26 +0200)] 
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=.

3 months agovmspawn: Run auxiliary daemons inside scope instead of separate service 38047/head
DaanDeMeyer [Thu, 3 Jul 2025 08:52:33 +0000 (10:52 +0200)] 
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
0fc45c8d20ad46ab9be0d8f29b16e606e0dd44ca are reverted by this commit.

3 months agofork-journal: Generalize to fork-notify
DaanDeMeyer [Wed, 2 Jul 2025 14:25:15 +0000 (16:25 +0200)] 
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.

3 months agofork-journal: Don't log if process is already gone in journal_terminate()
DaanDeMeyer [Thu, 3 Jul 2025 08:48:33 +0000 (10:48 +0200)] 
fork-journal: Don't log if process is already gone in journal_terminate()

3 months agocore/cgroup: always submit unit to realize queue if all controllers are being invalid...
Daan De Meyer [Mon, 14 Jul 2025 13:07:16 +0000 (15:07 +0200)] 
core/cgroup: always submit unit to realize queue if all controllers are being invalidated (#38194)

3 months agovmspawn: Pass credentials via files
DaanDeMeyer [Thu, 3 Jul 2025 12:13:03 +0000 (14:13 +0200)] 
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.

3 months agomkosi: Disable systemd-timesyncd by default
DaanDeMeyer [Sun, 13 Jul 2025 09:31:35 +0000 (11:31 +0200)] 
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.

3 months agomeson: Fix missing test dependencies
DaanDeMeyer [Mon, 14 Jul 2025 09:54:00 +0000 (11:54 +0200)] 
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.

3 months agofix(shell-completion): discard error messages 38210/head
Eisuke Kawashima [Mon, 14 Jul 2025 07:06:08 +0000 (16:06 +0900)] 
fix(shell-completion): discard error messages

3 months agofix(shell-completion): strictly parse env output
Eisuke Kawashima [Mon, 14 Jul 2025 07:48:25 +0000 (16:48 +0900)] 
fix(shell-completion): strictly parse env output

shell functions may be exported, when env prints their body in multiple
lines

3 months agofix(SC2164): robust `cd` conditional
Eisuke Kawashima [Mon, 14 Jul 2025 08:10:59 +0000 (17:10 +0900)] 
fix(SC2164): robust `cd` conditional

3 months agofix(SC2162): add `-r` to `read`
Eisuke Kawashima [Mon, 14 Jul 2025 07:08:09 +0000 (16:08 +0900)] 
fix(SC2162): add `-r` to `read`

3 months agofix(shell-completion): correct conditional
Eisuke Kawashima [Mon, 14 Jul 2025 10:17:53 +0000 (19:17 +0900)] 
fix(shell-completion): correct conditional

3 months agostyle(shell-completion): remove unnecessary backslashes
Eisuke Kawashima [Mon, 14 Jul 2025 07:01:38 +0000 (16:01 +0900)] 
style(shell-completion): remove unnecessary backslashes

3 months agostyle(shell-completion): remove trailing semicolons
Eisuke Kawashima [Mon, 14 Jul 2025 10:00:31 +0000 (19:00 +0900)] 
style(shell-completion): remove trailing semicolons

3 months agostyle(shell-completion): add missing semicolons
Eisuke Kawashima [Mon, 14 Jul 2025 10:16:26 +0000 (19:16 +0900)] 
style(shell-completion): add missing semicolons

3 months agostyle(shell-completion): expand hard tabs and fix indentation
Eisuke Kawashima [Mon, 14 Jul 2025 09:48:41 +0000 (18:48 +0900)] 
style(shell-completion): expand hard tabs and fix indentation

3 months agofix(shell-completion): fix help string
Eisuke Kawashima [Mon, 14 Jul 2025 10:55:26 +0000 (19:55 +0900)] 
fix(shell-completion): fix help string

3 months agonspawn: Don't clear idmapping if we're not doing an idmapped mount
DaanDeMeyer [Mon, 14 Jul 2025 06:13:45 +0000 (08:13 +0200)] 
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.

3 months agoReplace underscores in filenames with hyphens (#38203)
Daan De Meyer [Mon, 14 Jul 2025 08:37:23 +0000 (10:37 +0200)] 
Replace underscores in filenames with hyphens (#38203)

3 months agobpf: Use hyphens in directory names instead of underscores 38203/head
DaanDeMeyer [Sun, 13 Jul 2025 10:45:37 +0000 (12:45 +0200)] 
bpf: Use hyphens in directory names instead of underscores

3 months agoboot: Use hypen in efi-config.h instead of underscore
DaanDeMeyer [Sun, 13 Jul 2025 10:41:57 +0000 (12:41 +0200)] 
boot: Use hypen in efi-config.h instead of underscore

3 months agobasic: Use hyphens in missing header names instead of underscores
DaanDeMeyer [Sun, 13 Jul 2025 10:39:58 +0000 (12:39 +0200)] 
basic: Use hyphens in missing header names instead of underscores

3 months agoworkflows: Use hyphens in filenames instead of underscores
DaanDeMeyer [Sun, 13 Jul 2025 10:39:38 +0000 (12:39 +0200)] 
workflows: Use hyphens in filenames instead of underscores

3 months agomkosi: update debian commit reference to a8ad8e30e70c0b82ecb8fe016f2dde3a084236f0 38178/head
Yu Watanabe [Sat, 12 Jul 2025 11:40:47 +0000 (20:40 +0900)] 
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

3 months agomkosi: drop SysV compat files from packages
Yu Watanabe [Mon, 21 Apr 2025 04:38:01 +0000 (13:38 +0900)] 
mkosi: drop SysV compat files from packages

These workarounds can be dropped when the downstream .spec or filelists
are updated.

3 months agoNEWS: mention removal of several SysV compat features
Yu Watanabe [Wed, 23 Apr 2025 01:48:11 +0000 (10:48 +0900)] 
NEWS: mention removal of several SysV compat features

3 months agounits: drop runlevel[0-6].target
Yu Watanabe [Mon, 21 Apr 2025 00:47:04 +0000 (09:47 +0900)] 
units: drop runlevel[0-6].target

3 months agoutmp: drop setting runlevel entry in utmp
Yu Watanabe [Sun, 20 Apr 2025 21:27:35 +0000 (06:27 +0900)] 
utmp: drop setting runlevel entry in utmp

This removes systemd-update-utmp-runlevel.service and related command.

3 months agocore,initctl,systemctl: kill /dev/initctl support
Yu Watanabe [Sun, 20 Apr 2025 19:17:45 +0000 (04:17 +0900)] 
core,initctl,systemctl: kill /dev/initctl support

This also kills support for controlling system state through
/sbin/init, initctl, and telinit.

3 months agosystemctl: kill SysV compat 'runlevel' command
Yu Watanabe [Sun, 20 Apr 2025 20:48:53 +0000 (05:48 +0900)] 
systemctl: kill SysV compat 'runlevel' command

3 months agosystemctl/halt: drop support for calling in SysV init script
Yu Watanabe [Mon, 21 Apr 2025 04:14:30 +0000 (13:14 +0900)] 
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.

3 months agosystemctl: move functions in systemctl-sysv-compat.[ch]
Yu Watanabe [Mon, 21 Apr 2025 02:08:16 +0000 (11:08 +0900)] 
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.

3 months agoio.systemd.Unit.List fix context/runtime split (#38172)
Mike Yuan [Sat, 12 Jul 2025 16:01:41 +0000 (18:01 +0200)] 
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

3 months agocore/cgroup: always submit unit to realize queue if all controllers are being invalidated 38194/head
Mike Yuan [Sat, 12 Jul 2025 15:39:14 +0000 (17:39 +0200)] 
core/cgroup: always submit unit to realize queue if all controllers are being invalidated

Alternative to #38190
Fixes #38112

3 months agocore/cgroup: remove deserialization for "cpuacct-usage-base"
Mike Yuan [Fri, 11 Jul 2025 20:38:49 +0000 (22:38 +0200)] 
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.

3 months agocore/exec-invoke: pass "/" instead of "" for cgroup root
Mike Yuan [Sun, 6 Jul 2025 18:50:38 +0000 (20:50 +0200)] 
core/exec-invoke: pass "/" instead of "" for cgroup root

3 months agotest: skip one test case when running on coverage 38183/head
Yu Watanabe [Sat, 12 Jul 2025 08:11:11 +0000 (17:11 +0900)] 
test: skip one test case when running on coverage

Since 90fa161b5ba29d58953e9f08ddca49121b51efe6, --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.

3 months agomeson: fix coverage build
Yu Watanabe [Fri, 11 Jul 2025 17:14:00 +0000 (02:14 +0900)] 
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 543a48b653ff25cc562ce4dcffec377a875f604e.

3 months agoci: re-enable uefi secure boot
Luca Boccassi [Sat, 12 Jul 2025 08:58:17 +0000 (09:58 +0100)] 
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

3 months agopidref: propagate critical errors in pidref_acquire_pidfd_id()
Yu Watanabe [Sat, 12 Jul 2025 07:19:51 +0000 (16:19 +0900)] 
pidref: propagate critical errors in pidref_acquire_pidfd_id()

Follow-up for 571867ffa76c7829d3901386aa43294852a0363c.

Fixes CID#1612242.

3 months agocore: Fix scope SIGTERM logging
DaanDeMeyer [Sat, 12 Jul 2025 07:40:22 +0000 (09:40 +0200)] 
core: Fix scope SIGTERM logging

KILL_TERMINATE_AND_LOG doesn't do anything at the moment, let's fix
that.

3 months agocore/scope: drop effectively unused unit_watch_pidref() calls (#38186)
Lennart Poettering [Sat, 12 Jul 2025 05:27:56 +0000 (07:27 +0200)] 
core/scope: drop effectively unused unit_watch_pidref() calls (#38186)

3 months agoupdate TODO
Lennart Poettering [Sat, 12 Jul 2025 05:21:30 +0000 (07:21 +0200)] 
update TODO

3 months agojournal: Fix socket max level initialization
DaanDeMeyer [Fri, 11 Jul 2025 19:31:00 +0000 (21:31 +0200)] 
journal: Fix socket max level initialization

Follow up for df5b3426f60bb626f46f93fbdacecae274c1645b

3 months agounits: check if kmod command exists
Yu Watanabe [Fri, 11 Jul 2025 15:50:02 +0000 (00:50 +0900)] 
units: check if kmod command exists

We already check existences of quotaon in quotaon@.service and
quotacheck in systemd-quotacheck@.service.
Let's also check if kmod command exists.

Closes #38179.

3 months agocore/scope: serialize_item() is NOP on NULL 38186/head
Mike Yuan [Fri, 11 Jul 2025 20:19:14 +0000 (22:19 +0200)] 
core/scope: serialize_item() is NOP on NULL

3 months agocore/scope: drop effectively unused unit_watch_pidref() calls
Mike Yuan [Fri, 11 Jul 2025 19:58:51 +0000 (21:58 +0200)] 
core/scope: drop effectively unused unit_watch_pidref() calls

Follow-up for 495e75ed5c8cce933947dae10a4a1b5f8067e432

The mentioned commit switched scope unit's "pids" deserialization
to call unit_watch_pid() already, meaning all later invocations
in scope_coldplug() are no-op. Remove the cruft altogether.

3 months agounits/machines.target: fix typo
Mike Yuan [Fri, 11 Jul 2025 19:31:24 +0000 (21:31 +0200)] 
units/machines.target: fix typo

Follow-up for 48cb009afc07fbc6634612ff66088a09acd554fc

3 months agoSupport global sysext/confext in systemd-stub/systemd-sysext (#38113)
Lennart Poettering [Fri, 11 Jul 2025 19:10:51 +0000 (21:10 +0200)] 
Support global sysext/confext in systemd-stub/systemd-sysext (#38113)

Systemd-stub supports loading addons, credentials, system and
configuration
extensions from ESP and while addons and credentials can be both global
and
per-UKI, sysext/confext are only per-UKI.

Add support for global sysext/confext to systemd-stub/systemd-sysext.

Fixes #37993

3 months agomachined: make registration of unpriv user's VMs/containers work (#37855)
Lennart Poettering [Fri, 11 Jul 2025 19:10:08 +0000 (21:10 +0200)] 
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.

3 months agoshell-completion: update systemd-run
Eisuke Kawashima [Thu, 10 Jul 2025 13:32:30 +0000 (22:32 +0900)] 
shell-completion: update systemd-run

3 months agoupdate TODO 37855/head
Lennart Poettering [Mon, 16 Jun 2025 10:11:31 +0000 (12:11 +0200)] 
update TODO

3 months agotest: add testcase for unpriv machined nspawns reg + killing
Lennart Poettering [Mon, 30 Jun 2025 21:13:26 +0000 (23:13 +0200)] 
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.

3 months agounits: systems might take a while to boot
Lennart Poettering [Fri, 13 Jun 2025 16:21:11 +0000 (18:21 +0200)] 
units: systems might take a while to boot

vmspawn systems might take quite a while to boot in particular if they
go through uefi and wait for a network lease. Hence let's increase the
start timeout to 2min (from 45s). We'll do that for both nspawn and
vmspawn, even though the UEFI thing certainly doesn't apply there (but
the DHCP thing still does).

3 months agounits: add units for vmspawn/nspawn in --user mode too
Lennart Poettering [Fri, 23 May 2025 13:41:58 +0000 (15:41 +0200)] 
units: add units for vmspawn/nspawn in --user mode too

3 months agovmspawn: do not set vt220
Lennart Poettering [Fri, 11 Jul 2025 07:05:29 +0000 (09:05 +0200)] 
vmspawn: do not set vt220

We do not let qemu do terminal stuff, hence no point in setting any
TERM.

3 months agovmspawn: introduce --notify-ready= switch
Lennart Poettering [Mon, 16 Jun 2025 08:49:25 +0000 (10:49 +0200)] 
vmspawn: introduce --notify-ready= switch

This mimics the switch of the same name from nspawn: it controls whether
we expect a READY=1 message from the payload or not. Previously we'd
always expect that. This makes it configurable, just like it is in
nspawn.

There's one fundamental difference in behaviour though: in nspawn it
defaults to off, in vmspawn it defaults to on. (for historical reasons,
ideally we'd default to on in both cases, but changing is quite a compat
break both directly and indirectly: since timeouts might get triggered).

3 months agovmspawn: substantially beef up cgroup logic, to match more closely what nspawn does
Lennart Poettering [Fri, 13 Jun 2025 08:29:01 +0000 (10:29 +0200)] 
vmspawn: substantially beef up cgroup logic, to match more closely what nspawn does

This beefs up the cgroup logic, adding --slice=, --property= to vmspawn
the same way it already exists in nspawn.

There are a bunch of differences though: we don't delegate the cgroup
access in the allocated unit (since qemu wouldn't need that), and we do
registration via varlink not dbus. Hence, while this follows a similar
logic now, it differs in a lot of details.

This makes in particular one change: when invoked on the command line
we'll only add the qemu instance to the allocated scope, not the vmspawn
process itself (this follows more closely how nspawn does this where
only the container payload has its scope, not nspawn itself). This is
quite tricky to implement: unlike in nspawn we have auxiliary services
to start, with depencies to the scope. This means we need to start the
scope early, so that we know the scope's name. But the command line to
invoke is only assembled from the data we learn about the auxiliary
services, hence much later. To addres we'll now fork off the child that
eventually will become early, then move it to a scope, prepare the
cmdline and then very late send the cmdline (and the fds we want to
pass) to the prepared child, which then execs it.

3 months agovmspawn: spawn polkit during registration phase
Lennart Poettering [Thu, 12 Jun 2025 09:48:37 +0000 (11:48 +0200)] 
vmspawn: spawn polkit during registration phase

Just like in nspawn, there's a chance we need to PK authenticate the
registration, hence let's spawn off the agent for that during that
phase, and terminate it once we don't need it anymore.

3 months agovmspawn: use VM leader PID not vmspawn PID to register machine
Lennart Poettering [Thu, 15 May 2025 09:00:17 +0000 (11:00 +0200)] 
vmspawn: use VM leader PID not vmspawn PID to register machine

Let's make vmspawn machine registration more like nspawn machine
registration, and register the payload, not vmspawn/nspawn itself.

3 months agonspawn: properly order include of constants.h
Lennart Poettering [Fri, 11 Jul 2025 12:25:40 +0000 (14:25 +0200)] 
nspawn: properly order include of constants.h

3 months agonspawn: tweak logging/notifications when processing exit requests
Lennart Poettering [Wed, 9 Jul 2025 07:36:25 +0000 (09:36 +0200)] 
nspawn: tweak logging/notifications when processing exit requests

3 months agonspawn: slightly beef up READY= logic in nspawn
Lennart Poettering [Mon, 16 Jun 2025 08:46:37 +0000 (10:46 +0200)] 
nspawn: slightly beef up READY= logic in nspawn

Let's also send out a STATUS= message when we get READY=1 if it didn't
come with a STATUS= message itself.

Also, let's initially say the container is "started", and only once the
READY=1 is seen claim it was "running".

3 months agonspawn: reorganize scope allocation/registration logic
Lennart Poettering [Fri, 23 May 2025 20:04:56 +0000 (22:04 +0200)] 
nspawn: reorganize scope allocation/registration logic

This cleans up allocation of a scope unit for the container: when
invoked in user context we'll now allocate a scope through the per-user
service manager instead of the per-system manager. This makes a ton more
sense, since it's the user that invokes things after all. And given that
machined now can register containers in the user manager there's nothing
stopping us to clean this up.

Note that this means we'll connect to two busses if run unpriv: once to
the per-user bus to allocate the scope unit, and once to the per-system
bus to register it with machined.

3 months agomachinectl: output supervisor info in status output
Lennart Poettering [Wed, 2 Jul 2025 11:12:06 +0000 (13:12 +0200)] 
machinectl: output supervisor info in status output

3 months agomachined: add a bit more debug logging
Lennart Poettering [Wed, 9 Jul 2025 07:35:25 +0000 (09:35 +0200)] 
machined: add a bit more debug logging

3 months agomachined: explicitly watch machine cgroup for getting empty
Lennart Poettering [Wed, 9 Jul 2025 07:35:12 +0000 (09:35 +0200)] 
machined: explicitly watch machine cgroup for getting empty

3 months agomachined: also track 'supervisor' process of a machine
Lennart Poettering [Wed, 2 Jul 2025 09:20:23 +0000 (11:20 +0200)] 
machined: also track 'supervisor' process of a machine

So far, machined strictly tracked the "leader" process of a machine,
i.e. the topmost process that is actually the payload of the machine.
Its runtime also defines the runtime of the machine, and we can directly
interact with it if we need to, for example for containers to join the
namespaces, or kill it.

Let's optionally also track the "supervisor" process of a machine, i.e.
the host process that manages the payload if there is one. This is
generally useful info, but in particular is useful because we might need
to communicate with it to shutdown a machine without cooperation of the
payload. Traditionally we did this by simply stopping the unit of the
machine, but this is not doable now that the host machined can be used
to track per-user machines.

In the long run we probably want a more bespoke protocol between
machined and supervisors (so that we can execute other commands too,
such as request cooperative reboots/shutdowns), but that's for later.

Some environments call the concept "monitor" rather than "supervisor" or
use some other term. I stuck to "supervisor" because nspawn uses this,
and ultimately one name is as good as another.

And of course, in other implementations of VM managers of containers
there might not be a single process tracking each VM/container. Because
of this, the concept of a supervisor is optional.

3 months agomachined: use different polkit actions for registering and creating a machine
Lennart Poettering [Fri, 23 May 2025 20:10:36 +0000 (22:10 +0200)] 
machined: use different polkit actions for registering and creating a machine

The difference between these two operations are large: one is relatively
superficial: for "registration" all resources remain associated with the
invoking user, only the cgroup is reported to machined which then keeps
track of the machine, too. OTOH "creation" a scope is allocated in
system context, hence the invoked code will be owned by the system, and
its resource usage charged against the system.

Hence, use two distinct polkit actions for this, so that we can relax
access to registration, but keep access to creation tough.

3 months agomachined: track UID owner of machines
Lennart Poettering [Fri, 23 May 2025 13:30:22 +0000 (15:30 +0200)] 
machined: track UID owner of machines

Now that unpriv clients can register machines, let's register their UID
too. This allows us to do two things:

1. make sure the scope delegation is assigned to the right UID (so that
   the unpriv user can actually create cgroups below the delegated
   scope)

2. permit certain types of access (i.e. killing, or pty access) to the
   client without auth if it owns the machine.

3 months agomachined: optionally track machines in cgroup subgroups
Lennart Poettering [Wed, 21 May 2025 15:23:47 +0000 (17:23 +0200)] 
machined: optionally track machines in cgroup subgroups

3 months agocgroup-util: add cg_path_get_unit_full() helper and related calls
Lennart Poettering [Wed, 21 May 2025 15:21:36 +0000 (17:21 +0200)] 
cgroup-util: add cg_path_get_unit_full() helper and related calls

This helper returns not only the unit a cgroup belongs to, but also the
cgroup sub-path beyond it.

3 months agouki.conf is used by the ukify tool to create an Unified Kernel Image. It
vlefebvre [Fri, 11 Jul 2025 10:17:46 +0000 (12:17 +0200)] 
uki.conf is used by the ukify tool to create an Unified Kernel Image. It
would make sense to install it only if ukify is wanted.

3 months agotest: Fix --capability=CAP_BPF condition
DaanDeMeyer [Fri, 11 Jul 2025 12:58:47 +0000 (14:58 +0200)] 
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 9554ac305239c7baea02d112d2da72b7a97fce41

3 months agonetwork: clean up link_may_have_ipv6ll() and allow to run RADV on Tun interface ...
Yu Watanabe [Fri, 11 Jul 2025 14:04:18 +0000 (23:04 +0900)] 
network: clean up link_may_have_ipv6ll() and allow to run RADV on Tun interface (#38175)

Closes #38170.

3 months agocore: leave comments in varlink-unit.c and varlink-cgroup.c about runtime/context... 38172/head
Ivan Kruglov [Fri, 11 Jul 2025 10:19:41 +0000 (03:19 -0700)] 
core: leave comments in varlink-unit.c and varlink-cgroup.c about runtime/context split

3 months agocore: move Slice from runtime to context in io.systemd.Unit.List
Ivan Kruglov [Fri, 11 Jul 2025 13:54:53 +0000 (06:54 -0700)] 
core: move Slice from runtime to context in io.systemd.Unit.List

3 months agocore: move DebugInvocation from runtime to context in io.systemd.Unit.List
Ivan Kruglov [Fri, 11 Jul 2025 10:04:16 +0000 (03:04 -0700)] 
core: move DebugInvocation from runtime to context in io.systemd.Unit.List

3 months agotest: drop unnecessary line continuation
Yu Watanabe [Fri, 11 Jul 2025 11:24:57 +0000 (20:24 +0900)] 
test: drop unnecessary line continuation

3 months agoudevadm: fix memleak
Yu Watanabe [Fri, 11 Jul 2025 11:16:02 +0000 (20:16 +0900)] 
udevadm: fix memleak

Fixes a bug in a4a6e216739506153df88cbc8ac078cba4591e5f.

Fixes the following memleak:
```
$ sudo valgrind --leak-check=full build/udevadm cat /usr/lib/udev/rules.d
==3975939==
==3975939== HEAP SUMMARY:
==3975939==     in use at exit: 640 bytes in 1 blocks
==3975939==   total heap usage: 7,657 allocs, 7,656 frees, 964,328 bytes allocated
==3975939==
==3975939== 640 bytes in 1 blocks are definitely lost in loss record 1 of 1
==3975939==    at 0x4841866: malloc (vg_replace_malloc.c:446)
==3975939==    by 0x4ACA71F: malloc_multiply (alloc-util.h:92)
==3975939==    by 0x4ACF988: _hashmap_dump_entries_sorted (hashmap.c:2167)
==3975939==    by 0x4ACFC76: _hashmap_dump_sorted (hashmap.c:2209)
==3975939==    by 0x4AA60A4: hashmap_dump_sorted (hashmap.h:311)
==3975939==    by 0x4AA9077: dump_files (conf-files.c:397)
==3975939==    by 0x4AAA14E: conf_files_list_strv_full (conf-files.c:596)
==3975939==    by 0x42426A: search_rules_file (udevadm-util.c:301)
==3975939==    by 0x424768: search_rules_files (udevadm-util.c:334)
==3975939==    by 0x41287D: cat_main (udevadm-cat.c:110)
==3975939==    by 0x4A7B911: dispatch_verb (verbs.c:139)
==3975939==    by 0x427272: udevadm_main (udevadm.c:121)
==3975939==
==3975939== LEAK SUMMARY:
==3975939==    definitely lost: 640 bytes in 1 blocks
==3975939==    indirectly lost: 0 bytes in 0 blocks
==3975939==      possibly lost: 0 bytes in 0 blocks
==3975939==    still reachable: 0 bytes in 0 blocks
==3975939==         suppressed: 0 bytes in 0 blocks
==3975939==
==3975939== For lists of detected and suppressed errors, rerun with: -s
==3975939== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
```

3 months agoman: fix version info tag
Yu Watanabe [Fri, 11 Jul 2025 11:57:20 +0000 (20:57 +0900)] 
man: fix version info tag

Follow-up for 63770fa1d3eb0c8a367d0ffab73772e3c96a509f.

3 months agonetwork/radv: allow to send Router Advertisement from e.g. Tun interface 38175/head
Yu Watanabe [Fri, 11 Jul 2025 11:30:34 +0000 (20:30 +0900)] 
network/radv: allow to send Router Advertisement from e.g. Tun interface

Sending router advertisement requires an IPv6LL address and
IFF_MULTICAST flag. The length of the hardware address is irrelevant.

Closes #38170.

3 months agonetwork: split link_may_have_ipv6ll() into two
Yu Watanabe [Fri, 11 Jul 2025 11:48:51 +0000 (20:48 +0900)] 
network: split link_may_have_ipv6ll() into two

This renames and splits link_may_have_ipv6ll() into
link_ipv6ll_enabled_harder() and link_multicast_enabled(),
as they are completely irrelevant to each other.

Also, this makes link_ipv6ll_enabled_harder() work non-Wireguard
interfaces.

3 months agoInclude more headers explicitly (#38169)
Yu Watanabe [Fri, 11 Jul 2025 11:21:33 +0000 (20:21 +0900)] 
Include more headers explicitly (#38169)

Similar to the recent change like
4f18ff2e29b8054f30b084abcabf5f689f4b340b.

3 months agosysext: Support global sysext/confext 38113/head
Vitaly Kuznetsov [Mon, 7 Jul 2025 13:03:55 +0000 (15:03 +0200)] 
sysext: Support global sysext/confext

Load global sysext/confext from /.extra/global_{sysext,confext} which
systemd-stub puts there from ESP/loader/credentials/*.{sysext,confext}.raw.
Global extensions are handled the exact same way as per-UKI ones.

3 months agostub: Support global sysext/confext
Vitaly Kuznetsov [Mon, 7 Jul 2025 12:25:29 +0000 (14:25 +0200)] 
stub: Support global sysext/confext

Systemd-stub support loading addons, credentials, system and configuration
extensions from ESP and while addons and credentials can be both global and
per-UKI, sysext/confext are only per-UKI.

Add support for loading ESP/loader/credentials/*.{sysext,confext}.raw to
systemd-stub.

Note: for backwards compatibility reasons, per-UKI sysexts can also be
*.raw (not only *.sysext.raw) but as global extensions are new, there's
no need to bring this legacy there.

3 months agodetect-virt: add bare-metal support for GCE
vlefebvre [Tue, 8 Jul 2025 15:46:10 +0000 (15:46 +0000)] 
detect-virt: add bare-metal support for GCE

Google Compute Engine are not only virtual but can be also physical
machines. Therefore checking only the dmi is not enough to detect if it
is a virtual machine. Therefore systemd-detect-virt return "google"
instead of "none" in c3-highcpu-metal machine.
SMBIOS will not help us to make the difference as for EC2 machines.
However, GCE use KVM hypervisor for these VM, we can use this
information to detect virtualization. [0]

Issue and changes has been tested on SUSE SLE-15-SP7 images with
systemd-254 for both GCE, bare-metal and VM.

[0] -
https://cloud.google.com/blog/products/gcp/7-ways-we-harden-our-kvm-hypervisor-at-google-cloud-security-in-plaintext