]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 days agoresolvconf-compat: convert to OPTION macros 41978/head
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2026 11:54:12 +0000 (13:54 +0200)] 
resolvconf-compat: convert to OPTION macros

Use the "resolvconf" namespace to keep these options separate from the
resolvectl/systemd-resolve sets.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
5 days agoresolvectl: convert to OPTION and VERB macros
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2026 07:57:43 +0000 (09:57 +0200)] 
resolvectl: convert to OPTION and VERB macros

Use OPTION_NAMESPACE() to keep the resolvectl and systemd-resolve
option sets separate. The resolvconf-compat path (resolvconf
invocation) keeps its own getopt-based parsing.

--help output has the expected changes to formatting. Synopis
for [status] is now shows that the verb is optional.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
5 days agoshared/verbs: when showing default verb, put [] around the args too
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2026 11:38:04 +0000 (13:38 +0200)] 
shared/verbs: when showing default verb, put [] around the args too

The verb cannot be omitted but the args kept, so:
  resolvectl [status] [link]
is wrong, we need:
  resolvectl [status [link]]

Fixes f94da4b4c564f8cff4b5b739456c985e036a4201.

5 days agoresolvectl: move verb implementations to match order in --help
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2026 07:31:28 +0000 (09:31 +0200)] 
resolvectl: move verb implementations to match order in --help

5 days agoresolvectl: move things around in --help
Zbigniew Jędrzejewski-Szmek [Thu, 7 May 2026 07:30:37 +0000 (09:30 +0200)] 
resolvectl: move things around in --help

Move the "display options" to the end of both --help strings and then
reorder the implementation to match.

5 days agoresolvectl: split out parse_protocol
Zbigniew Jędrzejewski-Szmek [Wed, 6 May 2026 12:41:08 +0000 (14:41 +0200)] 
resolvectl: split out parse_protocol

7 days agoAnother batch of conversions to option and verb macros (#41881)
Zbigniew Jędrzejewski-Szmek [Wed, 6 May 2026 10:39:36 +0000 (12:39 +0200)] 
Another batch of conversions to option and verb macros (#41881)

7 days agofs-util: Some followups for xopenat_full() (#41835)
Christian Brauner [Wed, 6 May 2026 10:35:55 +0000 (12:35 +0200)] 
fs-util: Some followups for xopenat_full() (#41835)

7 days agovmspawn,machinectl: integrate io.systemd.StorageProvider (#41910)
Christian Brauner [Wed, 6 May 2026 10:20:26 +0000 (12:20 +0200)] 
vmspawn,machinectl: integrate io.systemd.StorageProvider (#41910)

PR #41776 introduced the io.systemd.StorageProvider Varlink interface
and
two backends ('block' exposes host block devices, 'fs' exposes regular
files / dirs / subvolumes under /var/lib/storage), plus the
storagectl(1)
CLI to enumerate them. The only consumer so far was mount.storage. This
series wires up the first of the three integrations called out in
TODO.md:

  systemd-vmspawn --bind-volume=PROVIDER:VOLUME[:CONFIG][:K=V,...]
      Boot-time attach. Drives added this way are immutable at runtime.

  io.systemd.MachineInstance.AddStorage  / .RemoveStorage
      Two new generic methods on the per-machine control socket. vmspawn
      implements them (this series); systemd-nspawn will reuse the same
      methods later.

  machinectl bind-volume   MACHINE PROVIDER:VOLUME[:CONFIG][:K=V,...]
  machinectl unbind-volume MACHINE PROVIDER:VOLUME
Runtime hotplug front-end: machinectl Acquire()s the fd locally and
      pushes it across to the target machine's MachineInstance socket.

Volumes are identified by a user-visible name "<provider>:<volume>"
(e.g.
"block:/dev/sda"). The 3rd 'config' field is opaque to the shared layer
and interpreted per backend — vmspawn maps it to a DiskType from
disk_type_table[] (virtio-blk default, virtio-scsi, nvme, scsi-cd; same
vocabulary as --extra-drive); future nspawn will read it as a mount
path.

7 days agodocs,test: --bind-volume / bind-volume / unbind-volume 41910/head
Christian Brauner [Fri, 1 May 2026 11:38:12 +0000 (13:38 +0200)] 
docs,test: --bind-volume / bind-volume / unbind-volume

  - Document the new --bind-volume= option in systemd-vmspawn(1) and
    the new bind-volume / unbind-volume verbs in machinectl(1).

  - Add an integration test
    (TEST-87-AUX-UTILS-VM.bind-volume.sh) covering boot-time attach
    via --bind-volume, runtime attach via 'machinectl bind-volume',
    runtime detach via 'machinectl unbind-volume', the StorageImmutable
    rejection of attempts to detach boot-time volumes, and the
    NoSuchStorage rejection of detach on unknown names.

  - Strike "hook-up in systemd-vmspawn" from TODO.md; the nspawn and
    service-manager hookups remain.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agomachinectl: add bind-volume / unbind-volume verbs
Christian Brauner [Fri, 1 May 2026 11:37:33 +0000 (13:37 +0200)] 
machinectl: add bind-volume / unbind-volume verbs

  machinectl bind-volume MACHINE PROVIDER:VOLUME[:CONFIG][:K=V,...]
  machinectl unbind-volume MACHINE PROVIDER:VOLUME

For bind-volume, machinectl parses the SPEC with the shared
bind_volume_parse(), Acquires the storage volume from the named
provider on the machinectl side, locates the target machine's
io.systemd.MachineInstance control socket via
machine_get_control_address(), pushes the fd across, and calls
io.systemd.MachineInstance.AddStorage with name='<provider>:<volume>'
and the user-supplied config string.

For unbind-volume, machinectl just forwards the name string to
io.systemd.MachineInstance.RemoveStorage.

Volumes attached at machine startup (e.g. via systemd-vmspawn's
--bind-volume=) are rejected with StorageImmutable when the user
attempts to unbind them at runtime.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agovmspawn: implement io.systemd.MachineInstance.AddStorage / RemoveStorage
Christian Brauner [Fri, 1 May 2026 11:36:21 +0000 (13:36 +0200)] 
vmspawn: implement io.systemd.MachineInstance.AddStorage / RemoveStorage

Wire up the runtime hotplug Varlink methods on the per-VM control
socket:

  AddStorage  → take fd from the link, look up the DiskType from the
                'config' field, build a DriveInfo flagged
                QMP_DRIVE_REMOVABLE, dispatch to
                vmspawn_qmp_add_block_device(). Reply delivered async
                by on_add_device_add_complete() once the guest sees
                the device.

  RemoveStorage → forward the user-visible name to
                  vmspawn_qmp_remove_block_device(); the existing
                  device_del / DEVICE_DELETED / blockdev-del chain
                  replies on the link.

Add SD_VARLINK_SERVER_ALLOW_FD_PASSING_INPUT to the server flags so
clients can push storage fds across via sd_varlink_push_fd().

Maps -EEXIST → StorageExists and -EOPNOTSUPP/-EINVAL →
ConfigNotSupported in the AddStorage handler so callers see the
specific MachineInstance errors.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agovmspawn: add --bind-volume= command line option
Christian Brauner [Fri, 1 May 2026 11:35:44 +0000 (13:35 +0200)] 
vmspawn: add --bind-volume= command line option

  systemd-vmspawn --bind-volume=PROVIDER:VOLUME[:CONFIG][:K=V,...]

For each --bind-volume passed at startup, vmspawn calls Acquire() on
the named StorageProvider and attaches the resulting fd to the VM as
an additional drive. The drive is identified by the user-visible name
'<provider>:<volume>' on the bridge — that is also the handle used
later when machinectl unbind-volume detaches drives at runtime
(though boot-time drives like these are NOT removable; that is the
StorageImmutable behaviour added earlier).

The colon grammar is parsed by the shared bind_volume_parse() helper.
The 3rd 'config' field selects the guest device type from the
disk_type_table[] vocabulary (virtio-blk, virtio-scsi, nvme, scsi-cd);
empty defaults to virtio-blk per the TASK grammar.

Wiring lives next to the existing --extra-drive setup: parse_argv()
appends a parsed BindVolume to arg_bind_volumes, and prepare_device_info()
hands the array to vmspawn_bind_volume_prepare_boot() which Acquires
each volume and pushes a DriveInfo onto the existing drives array.
PCIe port assignment (assign_pcie_ports()) and the QMP setup loop pick
them up automatically.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agovmspawn: add vmspawn-bind-volume glue
Christian Brauner [Fri, 1 May 2026 11:34:54 +0000 (13:34 +0200)] 
vmspawn: add vmspawn-bind-volume glue

This is vmspawn's per-backend code for the StorageProvider integration.
Other backends (future systemd-nspawn, future service-manager
BindVolume=) consume the same shared parser and Acquire helper but
each provides its own attach/detach glue; this is vmspawn's.

  - disk_type_from_bind_volume_config() turns the opaque BindVolume
    'config' field (e.g. "scsi-cd") into a DiskType. Empty defaults to
    virtio-blk to match the --bind-volume CLI grammar.

  - vmspawn_bind_volume_acquire() takes a parsed BindVolume, calls
    storage_acquire_volume() for the fd, and builds a DriveInfo ready
    for vmspawn_qmp_setup_drives() (boot) or vmspawn_qmp_add_block_device()
    (hotplug). Rejects directory-typed volumes (vmspawn block devices
    need a regular file or a host block device).

  - vmspawn_bind_volume_attach_fd() is the runtime path: takes a fd
    that was already pushed across by an AddStorage caller plus the
    name+config it specified, builds the DriveInfo with
    QMP_DRIVE_REMOVABLE set and a varlink link, and dispatches to
    vmspawn_qmp_add_block_device(). Reply is delivered asynchronously
    by the existing on_add_device_add_complete() callback.

  - vmspawn_bind_volume_prepare_boot() is a thin loop the boot-time
    path uses to populate DriveInfos.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agovmspawn: track removability as a QmpDriveFlags bit and expose add_block_device
Christian Brauner [Fri, 1 May 2026 11:34:06 +0000 (13:34 +0200)] 
vmspawn: track removability as a QmpDriveFlags bit and expose add_block_device

Drives attached at boot via the existing CLI options (--image,
--extra-drive) must not be detachable at runtime via the upcoming
RemoveStorage Varlink method, while drives added at runtime via
AddStorage must be. Track this distinction with a new QMP_DRIVE_REMOVABLE
property flag — placed alongside QMP_DRIVE_BLOCK_DEVICE, not in the
transient BlockDeviceStateFlags state-machine, since "may be removed"
is a permanent property of the drive.

vmspawn_qmp_remove_block_device() now early-rejects unknown ids with
io.systemd.MachineInstance.NoSuchStorage and immutable drives with
io.systemd.MachineInstance.StorageImmutable.

vmspawn_qmp_add_block_device() loses its 'static' qualifier and gets a
declaration in the header, so the runtime hotplug path
(vmspawn-bind-volume.c, next) can dispatch into it directly.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agoshared: add AddStorage / RemoveStorage to io.systemd.MachineInstance
Christian Brauner [Fri, 1 May 2026 11:32:58 +0000 (13:32 +0200)] 
shared: add AddStorage / RemoveStorage to io.systemd.MachineInstance

Define two new methods on the generic 'MachineInstance' Varlink
interface that systemd-vmspawn (this series) and (future)
systemd-nspawn implement on their per-machine control sockets:

  AddStorage(fileDescriptorIndex, name, config?) -> ()
      Attach a storage volume — the caller passes an fd previously
      acquired from a StorageProvider, plus a unique name of the form
      '<provider>:<volume>' that identifies this binding for later
      removal, plus a backend-specific 'config' field (vmspawn: guest
      device type; future nspawn: mount path).

  RemoveStorage(name) -> ()
      Detach a previously-added storage volume.

Plus errors NoSuchStorage, StorageExists, StorageImmutable (the volume
was attached at boot and cannot be removed), BadConfig, and
ConfigNotSupported. Names follow the io.systemd.StorageProvider
vocabulary (NoSuchVolume, BadTemplate, TypeNotSupported, etc.) so the
two interfaces are visually consistent.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agostoragectl: refactor mount.storage helper to use storage_acquire_volume()
Christian Brauner [Fri, 1 May 2026 11:32:01 +0000 (13:32 +0200)] 
storagectl: refactor mount.storage helper to use storage_acquire_volume()

Drop the inline socket-build + sd_varlink_callbo() + reply-dispatch
+ take_fd block from run_as_mount_helper() in favour of the shared
helper. Preserves the type-fallback retry (TypeNotSupported / WrongType
re-tries with requestAs="blk") and the per-error-id message mapping;
the helper just reports the io.systemd.StorageProvider.* error name
back to the caller.

Net effect: ~50 lines of dedup, no functional change.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agoshared: add storage_acquire_volume() helper
Christian Brauner [Fri, 1 May 2026 11:31:21 +0000 (13:31 +0200)] 
shared: add storage_acquire_volume() helper

storagectl's mount.storage helper bundles "open StorageProvider socket
+ Acquire() + dispatch reply + take fd" inline. Future consumers
(systemd-vmspawn boot-time --bind-volume, machinectl bind-volume) need
the same dance.

Factor it into a single libshared helper that takes the Acquire()
parameters by value and returns the fd plus the actual type/read-only
flags. Library code, so no logging — varlink errors are surfaced via
sd_varlink_error_to_errno() and the StorageProvider error_id is
returned to the caller via reterr_error_id (caller decides how to
format messages).

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agoshared: add BindVolume parser in machine-util
Christian Brauner [Fri, 1 May 2026 11:32:27 +0000 (13:32 +0200)] 
shared: add BindVolume parser in machine-util

Add a universal parser for the colon-separated grammar
'PROVIDER:VOLUME[:CONFIG][:K=V,K=V,…]' that backs --bind-volume on
systemd-vmspawn (next), machinectl bind-volume, and the future nspawn
+ service-manager BindVolume= integrations.

The 'config' field is opaque to shared code and interpreted per
backend (vmspawn: a DiskType name, future nspawn: a mount path). The
trailing key=value list is parsed into the io.systemd.StorageProvider
.Acquire() parameters (template, create, read-only/ro, size/create-size
and request-as), with values validated against the existing
storage-util enums and validators. Provider/volume names are checked
with storage_provider_name_is_valid() and storage_volume_name_is_valid();
the combined "<provider>:<volume>" string is also validated as
string_is_safe so it is safe to use as a QEMU device id.

Add a test-machine-util unit test covering the happy paths plus a
handful of malformed inputs.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agoshared: move storage-util to libshared
Christian Brauner [Fri, 1 May 2026 11:29:56 +0000 (13:29 +0200)] 
shared: move storage-util to libshared

The storage backend providers (block, fs) and storagectl currently each
extract storage-util.c into their target. Several upcoming consumers
(machine-util's BindVolume parser, vmspawn's hotplug glue, machinectl's
new bind-volume verbs) need the StorageProvider type/string-table
helpers and a future shared Acquire client helper.

Move storage-util.{c,h} to src/shared so libshared exports the symbols
once and every consumer (storage providers, storagectl, libshared
itself) picks them up by linking libshared. Drop the now-redundant
'extract'/'objects' wiring in src/storage/meson.build.

No code changes; this is purely a relocation.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agouser-util,storagectl: introduce USERNS_RANGE_SIZE macro
Christian Brauner [Fri, 1 May 2026 12:58:53 +0000 (14:58 +0200)] 
user-util,storagectl: introduce USERNS_RANGE_SIZE macro

The mount.storage helper open-codes the conventional 64K UID/GID
delegation block size as 0x10000 / 0x10000U in four places. Several
other places in the tree do the same (nspawn's arg_uid_range default,
homed's mount setup, …), but with no shared name.

Add USERNS_RANGE_SIZE in user-util.h alongside UID_NOBODY and friends,
and switch storagectl over to it. Other call sites can adopt it
incrementally.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
7 days agoAdd a manual test to exercise homectl prompt logic (#41954)
Lennart Poettering [Wed, 6 May 2026 07:21:17 +0000 (09:21 +0200)] 
Add a manual test to exercise homectl prompt logic (#41954)

7 days agosd-boot: efi-log: fix `__stack_chk_guard` type
Sergei Trofimovich [Tue, 5 May 2026 20:55:30 +0000 (21:55 +0100)] 
sd-boot: efi-log: fix `__stack_chk_guard` type

In https://gcc.gnu.org/PR121911 `gcc` started enforcing the type of
`__stack_chk_guard` to `uintptr_t` and broke `systemd` build as:

```
../src/boot/efi-log.c:136:17: error: conflicting types for '__stack_chk_guard'; have 'intptr_t' {aka 'long int'}
  136 | _used_ intptr_t __stack_chk_guard = (intptr_t) 0x70f6967de78acae3;
      |                 ^~~~~~~~~~~~~~~~~
cc1: note: previous declaration of '__stack_chk_guard' with type 'long unsigned int'
../src/boot/efi-log.c:136:17: error: declaration of '__stack_chk_guard' shadows a global declaration [-Werror=shadow]
  136 | _used_ intptr_t __stack_chk_guard = (intptr_t) 0x70f6967de78acae3;
      |                 ^~~~~~~~~~~~~~~~~
```

Let's match the declaration to unsigned type as suggested by upstream in
https://gcc.gnu.org/PR121911#c6.

7 days agoCouple of coverity fixes (#41951)
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 20:45:13 +0000 (22:45 +0200)] 
Couple of coverity fixes (#41951)

7 days agohwdb: add SOUND_FORM_FACTOR for Edifier M60 and Fractal Scape Dongle
José Miguel Sarasola [Tue, 5 May 2026 19:20:59 +0000 (21:20 +0200)] 
hwdb: add SOUND_FORM_FACTOR for Edifier M60 and Fractal Scape Dongle

7 days agohomectl: drop redunant sort 41954/head
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 20:08:19 +0000 (22:08 +0200)] 
homectl: drop redunant sort

Claude points out that prompt_groups() already does the sort
in every loop, including the last.

7 days agotest-homectl-prompts: add manual test to exercise prompt functionality
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 11:21:30 +0000 (13:21 +0200)] 
test-homectl-prompts: add manual test to exercise prompt functionality

The prompt for groups is nice. The prompt for a shell could use some
love. Looking at this is much easier if we can invoke the code outside
in isolation.

I wrote this when looking at https://github.com/systemd/systemd/pull/41947,
where I wanted to see how the homectl prompt works with the changes.

7 days agoMerge facts into metrics and add systemd-report generate/upload (#41688)
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 18:55:36 +0000 (20:55 +0200)] 
Merge facts into metrics and add systemd-report generate/upload (#41688)

7 days agohomectl: split out two prompt functions
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 11:01:16 +0000 (13:01 +0200)] 
homectl: split out two prompt functions

homectl.c is too long…

7 days agotest: make TEST-04-JOURNAL.journalctl-varlink more robust (#41953)
Luca Boccassi [Tue, 5 May 2026 18:24:41 +0000 (19:24 +0100)] 
test: make TEST-04-JOURNAL.journalctl-varlink more robust (#41953)

This test is sometimes flaky under sanitizers, and it does repeated
calls with the same parameters to run through different greps, and
the second one sometimes fails.
Store the result and grep it twice instead to try and reduce
flakiness.

```
[ 2089.891152] TEST-04-JOURNAL.sh[22392]: + systemd-run --unit=test-journalctl-varlink-2-18237.service --wait bash -c 'echo hello-from-varlink-test-2'
[ 2090.066050] TEST-04-JOURNAL.sh[22460]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service"]}'
[ 2090.067075] TEST-04-JOURNAL.sh[22461]: + grep -q hello-from-varlink-test-1
[ 2090.384551] TEST-04-JOURNAL.sh[22466]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service"]}'
[ 2090.385373] TEST-04-JOURNAL.sh[22467]: + grep hello-from-varlink-test-2
[ 2090.723461] TEST-04-JOURNAL.sh[22474]: + grep -q hello-from-varlink-test-1
[ 2090.724294] TEST-04-JOURNAL.sh[22473]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service", "test-journalctl-varlink-2-18237.service"]}'
[ 2091.135655] TEST-04-JOURNAL.sh[22480]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service", "test-journalctl-varlink-2-18237.service"]}'
[ 2091.136605] TEST-04-JOURNAL.sh[22481]: + grep -q hello-from-varlink-test-2
[ 2091.479930] TEST-04-JOURNAL.sh[22480]: Method call failed: io.systemd.JournalAccess.NoEntries
```

7 days agohomectl: fix error handling in shell_is_ok()
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 16:37:13 +0000 (18:37 +0200)] 
homectl: fix error handling in shell_is_ok()

Fixes f233132a67a4c2c6dff053afac2385f570e8e3fe.

7 days agosysupdate: Ensure that end of the MatchPattern is matched correctly
Jonas Dreßler [Thu, 30 Apr 2026 18:27:43 +0000 (20:27 +0200)] 
sysupdate: Ensure that end of the MatchPattern is matched correctly

An error snuck into the pattern parsing of the `MatchPattern` key in the
sysupdate transfer files. If there's two files "part1-v2.raw", and
"part1-v2.raw.tar" in the source folder, and MatchPattern="part1-@v.raw",
sysupdate will incorrectly choose "part1-v2.raw.tar" instead of
"part1-v2.raw".

While the pattern matching works perfectly fine, after the full pattern
is successfully matched to the string, we don't ensure that the string
actually ends when the pattern just did.

This means we can end up choosing a wrong file for the update, if the
filename/path happens to start with the same MatchPattern.

Fix it by ensuring the string ends after our match pattern ended.

7 days agoreport: fold io.systemd.Basic facts into metrics 41688/head
Michael Vogt [Tue, 5 May 2026 12:55:18 +0000 (14:55 +0200)] 
report: fold io.systemd.Basic facts into metrics

We removed the concept of facts, so we need to update the existing
io.systemd.Basic facts provider to metrics. This commit does just
that. Its mostly mechanical.

This also means that facts.{c,h} and varlink-io.systemd.Facts.{c,h}
are gone now.

7 days agoreport: when a report fails, print the json error details
Michael Vogt [Wed, 29 Apr 2026 15:52:50 +0000 (17:52 +0200)] 
report: when a report fails, print the json error details

When a report upload fails the backend often provides useful
details via the varlink error. Show them as part of the upload
error message. For now we just dump the json because we have
no structure that the backends should follow. We may want to
consider adding one (like check for an "error_message" key in
the json). But for now this is a nice step forward.

7 days agoreport: set description on varlink sockets
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 09:42:00 +0000 (11:42 +0200)] 
report: set description on varlink sockets

We make multiple connections and without this it's hard to
know socket we're talking to.

7 days agoreport: upload reports using a "varlink socket directory"
Zbigniew Jędrzejewski-Szmek [Tue, 28 Apr 2026 21:55:48 +0000 (23:55 +0200)] 
report: upload reports using a "varlink socket directory"

Two new verbs are added: "generate" and "upload". The first one just
creates a "report", i.e. puts the metrics into a structured JSON object
that in the future is intended to carry additional data like a
signature:

$ build/systemd-report generate io.systemd.Manager.UnitsTotal
{
"mediaType" : "application/vnd.io.systemd.report",
"timestamp" : "Tue 2026-04-28 22:30:09 UTC",
"metrics" : [
{
"name" : "io.systemd.Manager.UnitsTotal",
"value" : 520
}
]
}

The second verb can be used to upload or otherwise process the report.
It builds on the code added in 0a8560eed873a5f89487630a19db550fdbee3c15.
In /run/systemd/metrics-upload/ we expect a set of sockets. We'll call
out to each one of them. This allows the data to be processed in custom
ways, incl. writing to storage or sending over the network.

Each socket must provide a single interface:
  io.systemd.Metrics.Upload {"report":$data}

7 days agotest: reduce number of identical io.systemd.JournalAccess.GetEntries calls 41953/head
Luca Boccassi [Tue, 5 May 2026 15:50:40 +0000 (16:50 +0100)] 
test: reduce number of identical io.systemd.JournalAccess.GetEntries calls

This test is sometimes flaky under sanitizers, and it does repeated
calls with the same parameters to run through different greps, and
the second one sometimes fails.
Store the result and grep it twice instead to try and reduce
flakiness.

[ 2089.891152] TEST-04-JOURNAL.sh[22392]: + systemd-run --unit=test-journalctl-varlink-2-18237.service --wait bash -c 'echo hello-from-varlink-test-2'
[ 2090.066050] TEST-04-JOURNAL.sh[22460]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service"]}'
[ 2090.067075] TEST-04-JOURNAL.sh[22461]: + grep -q hello-from-varlink-test-1
[ 2090.384551] TEST-04-JOURNAL.sh[22466]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service"]}'
[ 2090.385373] TEST-04-JOURNAL.sh[22467]: + grep hello-from-varlink-test-2
[ 2090.723461] TEST-04-JOURNAL.sh[22474]: + grep -q hello-from-varlink-test-1
[ 2090.724294] TEST-04-JOURNAL.sh[22473]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service", "test-journalctl-varlink-2-18237.service"]}'
[ 2091.135655] TEST-04-JOURNAL.sh[22480]: + varlinkctl call --more /run/systemd/io.systemd.JournalAccess io.systemd.JournalAccess.GetEntries '{"units": ["test-journalctl-varlink-1-22690.service", "test-journalctl-varlink-2-18237.service"]}'
[ 2091.136605] TEST-04-JOURNAL.sh[22481]: + grep -q hello-from-varlink-test-2
[ 2091.479930] TEST-04-JOURNAL.sh[22480]: Method call failed: io.systemd.JournalAccess.NoEntries

7 days agotest: drop more 'grep -q' instances
Luca Boccassi [Tue, 5 May 2026 15:21:16 +0000 (16:21 +0100)] 
test: drop more 'grep -q' instances

Follow-up for ee6b3d1aa2329cddb5867bbc86a4b62983ee56fe

7 days agoterminal-util: when prompting for a choice from a list, preselect longest prefix
Lennart Poettering [Tue, 5 May 2026 08:45:14 +0000 (10:45 +0200)] 
terminal-util: when prompting for a choice from a list, preselect longest prefix

If all entries of a menu prompt start with the same prefix, let's
preselect the prefix to enhance user experience.

This is particularly relevant when prompting for a disk to install
things on, as typically they all start with the same prefix /dev/, and
if there's only a single target medium discoverable, then we can even
fill it out fully.

7 days agotest-oomd: fix flakiness under sanitizers
Luca Boccassi [Tue, 5 May 2026 14:33:49 +0000 (15:33 +0100)] 
test-oomd: fix flakiness under sanitizers

The test asserts that pgscan is 0, but under sanitizers this sometimes
fails and shows up as 1. We cannot control what the kernel scans, and
with sanitizers the runtime can be slow enough it's possible that the
kernel does a pass on the cgroup of the unit test.
Instead of asserting that it's 0, assert that it's between 0 and 9,
which seems a reasonable range.

Fixes https://github.com/systemd/systemd/issues/37710

7 days agoman: EnvironmentFile= honors %h, not \$HOME
Simran Singh [Sat, 2 May 2026 18:52:10 +0000 (00:22 +0530)] 
man: EnvironmentFile= honors %h, not \$HOME

7 days agoupdate TODO
Lennart Poettering [Tue, 5 May 2026 15:24:48 +0000 (17:24 +0200)] 
update TODO

7 days agobootctl,mute-console,pcrextend,pcrlock,repart: allow connections from self
Zbigniew Jędrzejewski-Szmek [Tue, 28 Apr 2026 13:26:47 +0000 (15:26 +0200)] 
bootctl,mute-console,pcrextend,pcrlock,repart: allow connections from self

With SD_VARLINK_SERVER_ROOT_ONLY, we refuse all unprivileged operations.
This is silly, the user can and should be able to do anything that doesn't
require privileges.

E.g.:

$ SYSTEMD_LOG_LEVEL=debug varlinkctl introspect /usr/lib/systemd/systemd-pcrextend
Forking off Varlink child process '/usr/lib/systemd/systemd-pcrextend'.
Successfully forked off '(sd-vlexec)' as PID 568993.
varlink: Setting state idle-client
json-stream: Sending message: {"method":"org.varlink.service.GetInterfaceDescription","parameters":{"interface":"io.systemd.PCRExtend"}}
Skipping PR_SET_MM, as we don't have privileges.
varlink: Changing state idle-client → calling
varlink: Unprivileged client attempted connection, refusing.
Failed to run Varlink event loop: Operation not permitted
json-stream: Got POLLHUP from socket.
varlink: Changing state calling → pending-disconnect
varlink: Connection was closed.
Failed to issue org.varlink.service.GetInterfaceDescription() varlink call: Connection reset by peer

This and similar commands now work, e.g.

$ SYSTEMD_LOG_LEVEL=debug varlinkctl call --more ./build/bootctl io.systemd.BootControl.ListBootEntries {}
...
Failed to open directory "/efi": No such file or directory
File system "/boot" is not a FAT EFI System Partition (ESP) file system.
...
Method call failed: Permission denied
{
"origin" : "linux",
"errno" : 13,
"errnoName" : "EACCES"
}
Which is fine — we lack privileges to actually return a useful answer, but the
call itself should go through.

I didn't touch udevd, which refuses to run if it is not root, and does a lot of
privileged setup, so would refuse to start even if the check was removed.

7 days agotreewide: fix typos in the entire codebase
Diego Viola [Tue, 5 May 2026 11:22:55 +0000 (08:22 -0300)] 
treewide: fix typos in the entire codebase

Signed-off-by: Diego Viola <diego.viola@gmail.com>
7 days agoudev-builtin-tpm2-id: gracefully skip tpm2 identification if tss2-libs are not installed
Lennart Poettering [Tue, 5 May 2026 10:43:42 +0000 (12:43 +0200)] 
udev-builtin-tpm2-id: gracefully skip tpm2 identification if tss2-libs are not installed

Fixes: #41714
7 days agosystemd-sysinstall (this time on top of bootctl link) (#41877)
Lennart Poettering [Tue, 5 May 2026 15:20:47 +0000 (17:20 +0200)] 
systemd-sysinstall (this time on top of bootctl link) (#41877)

This is a reiteration of #38764, but this time on top of "bootctl link"
for installing a kernel, i.e. #41543, instead of "kernel-install".

It's the same as #41543, only adds three new commits on top.

7 days agoman/systemd-report: document --url= and other options
Zbigniew Jędrzejewski-Szmek [Tue, 28 Apr 2026 22:53:20 +0000 (00:53 +0200)] 
man/systemd-report: document --url= and other options

5bbbe210a4e3856385d95e16074d8aa98cff909b added the options but not the
documentation.

7 days agotest: make TEST-64 btrfs_basic cleanup robust against reruns
Luca Boccassi [Tue, 5 May 2026 09:43:45 +0000 (10:43 +0100)] 
test: make TEST-64 btrfs_basic cleanup robust against reruns

The LUKS subtest in testcase_btrfs_basic leaves stale LUKS headers on
the underlying SCSI devices, so if the VM is rebooted the test fails
because the LUKS signature is still there and blkid finds it.

[    7.683] + udevadm lock ... mkfs.btrfs -f -L btrfs_root -U deadbeef-dead-dead-beef-000000000000 /dev/disk/by-id/scsi-0systemd_foobar_deadbeefbtrfs0
[    7.729]   Label: btrfs_root
[    7.729]   UUID:  deadbeef-dead-dead-beef-000000000000
[    7.743] + udevadm wait --settle --timeout=30 /dev/disk/by-id/scsi-0systemd_foobar_deadbeefbtrfs0 /dev/disk/by-uuid/deadbeef-dead-dead-beef-000000000000 /dev/disk/by-label/btrfs_root
[    7.788] sda: ... SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}": Added device node symlink "disk/by-label/encdisk0".
[   37.998] Timed out for waiting devices being initialized.
[   38.002] TEST-64-UDEV-STORAGE-btrfs_basic.service: Main process exited, code=exited, status=1/FAILURE

Likewise for the BTRFS UUID:

ERROR: non-unique UUID: deadbeef-dead-dead-beef-000000000001

So wipe that too.

8 days agovmspawn-qmp: take temporary ref in drive_info_add_fail 41951/head
Luca Boccassi [Tue, 5 May 2026 12:55:54 +0000 (13:55 +0100)] 
vmspawn-qmp: take temporary ref in drive_info_add_fail

drive_info_add_fail() calls bridge_unregister_drive() followed by
drive_info_unref(), then continues to access the DriveInfo object.
While all current callers hold their own reference, it is a bit
fragile and it trips static analyzers. Take a local reference.

CID#1655804

Follow-up for 1d0a8e5dbd267c803e100d9030d70d327eddf8b1

8 days agoupdate TODO 41877/head
Lennart Poettering [Mon, 20 Apr 2026 10:34:48 +0000 (12:34 +0200)] 
update TODO

8 days agoci: add CI test for systemd-sysinstall
Lennart Poettering [Wed, 29 Apr 2026 19:49:58 +0000 (21:49 +0200)] 
ci: add CI test for systemd-sysinstall

8 days agosysinstall: new component
Lennart Poettering [Thu, 28 Aug 2025 09:51:11 +0000 (11:51 +0200)] 
sysinstall: new component

8 days agobootctl: allow extra files on 'link' be specified as literal data
Lennart Poettering [Mon, 20 Apr 2026 11:12:44 +0000 (13:12 +0200)] 
bootctl: allow extra files on 'link' be specified as literal data

8 days agoscsi_id: fix memory leak of option_get_synopsis() return value
Luca Boccassi [Tue, 5 May 2026 12:55:00 +0000 (13:55 +0100)] 
scsi_id: fix memory leak of option_get_synopsis() return value

option_get_synopsis() returns a heap-allocated string. Capture it in
a _cleanup_free_ variable so it is freed after being used in the log
message.

CID#1657828

Follow-up for 05fea7df1bd6579dc382455626e0e84acb2a8912

8 days agonetworkctl: use proper errno in mesage 41881/head
Zbigniew Jędrzejewski-Szmek [Thu, 30 Apr 2026 07:20:02 +0000 (09:20 +0200)] 
networkctl: use proper errno in mesage

$ build/networkctl --lines=4883284838483883838383
Failed to parse --lines setting '4883284838483883838383': Numerical result out of range

8 days agonetworkctl: convert to OPTION and VERB macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:10:00 +0000 (00:10 +0200)] 
networkctl: convert to OPTION and VERB macros

--help output is identical except for common options strings and
whitespace.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agomstack-tool: convert to OPTION macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:07:29 +0000 (00:07 +0200)] 
mstack-tool: convert to OPTION macros

Both the main parser and the util-linux mount-helper-mode parser
(invoked as mount.mstack) are converted with "systmed-mstack" and
"mount.mstack" as namespaces. The latter has no help.

For systemd-mstack, Commands are listed first, and then Options.
And --no-pager, --no-legend, --json= are moved to the end.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agojournal-upload: convert to OPTION macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:05:02 +0000 (00:05 +0200)] 
journal-upload: convert to OPTION macros

The help strings are adjusted a tiny bit.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agonetworkd-wait-online: convert to OPTION macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:02:27 +0000 (00:02 +0200)] 
networkd-wait-online: convert to OPTION macros

Also fix a latent bug in parse_interface_with_operstate_range() where
the global 'optarg' was used instead of the 'str' parameter when
extracting the interface name; with getopt removed they would have
diverged.

The help strings are adjusted a bit to be grammatical and short so
that the table formatting is easier.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agotest-modem-manager-mock: convert to OPTION macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:00:47 +0000 (00:00 +0200)] 
test-modem-manager-mock: convert to OPTION macros

--help and --version are moved to the beginning of the option list.
This is the usual location. Custom '-v' alias for --version is dropped.
It is not used by anything and it's better to follow the usual style.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agosysext: convert to option and verb macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:45:32 +0000 (00:45 +0200)] 
sysext: convert to option and verb macros

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agosysext: move stuff around
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 22:34:19 +0000 (00:34 +0200)] 
sysext: move stuff around

The verb implementation functions are reordered to match the listing in --help.
The option are reorded a bit to have the "important" options that determine
behaviour first, and various display options and tweaks later. The cases in
parse_argv are ordered in the same way. No functional change.

8 days agovarious: convert "services" to option macros
Zbigniew Jędrzejewski-Szmek [Wed, 29 Apr 2026 21:22:45 +0000 (23:22 +0200)] 
various: convert "services" to option macros

Here we have the unusual situation that the option list is
conditionalized. I thought about embedding some "tag" information in
individual options to allow the options to be filtered by some arbitrary
conditions. But it seems that using groups works quite well. It wouldn't
scale well if there was a lot more options and conditions, but for the
current set it's good enough.

For options that are not supported in a given service, we print a custom
message ("This service does not support [this] option"), instead of the
generic "Unknown option …". I think this is actually better: we don't
have to pretent that we don't know about the option, and can directly
say that the it's a valid option in general but this service does not
support it (yet).

This converts systemd-homed, systemd-hostnamed, systemd-importd,
systemd-localed, systemd-logind, systemd-machined, systemd-networkd,
systemd-portabled, systemd-resolved, systemd-sysupdated,
systemd-timedated, and systemd-timesyncd.

When we add introspection of the option data, we'll somehow have to deal
with conditionalization. But let's cross that bridge when we need to.

8 days agoreport-basic-server: use accessor function
Zbigniew Jędrzejewski-Szmek [Tue, 28 Apr 2026 18:36:27 +0000 (20:36 +0200)] 
report-basic-server: use accessor function

This is the API for "external" users.

8 days agosocket-activate: fix comment
Zbigniew Jędrzejewski-Szmek [Tue, 28 Apr 2026 18:31:14 +0000 (20:31 +0200)] 
socket-activate: fix comment

"optargs" is not a thing.

8 days agoConvert systemd-analyze to option and verb macros (#41945)
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 11:47:17 +0000 (13:47 +0200)] 
Convert systemd-analyze to option and verb macros (#41945)

I thought that this would require some bigger changes, but it turns out
that the existing functionality is good enough with some minor
adjustments if used appropriately.

The behaviour of help_section() is changed to simplify all callers.

8 days agogithub: rename "systemd-import" to "importctl"
Max Chernoff [Fri, 1 May 2026 08:15:07 +0000 (02:15 -0600)] 
github: rename "systemd-import" to "importctl"

The user-facing components are the "systemd-importd.service" unit and
the "importctl" binary, so using these names makes more sense.

There _is_ a "systemd-import" binary, but it's in "/usr/lib/systemd/",
so this is a confusing name for a user-facing form.

8 days agosystemd-dissect: do not fail dissection on LUKS v1 partitions
Nandakumar Raghavan [Mon, 4 May 2026 09:31:59 +0000 (09:31 +0000)] 
systemd-dissect: do not fail dissection on LUKS v1 partitions

partition_is_luks2_integrity() was returning -EINVAL when it
encountered a non-LUKS2 header (e.g. LUKS v1), which caused the
caller to abort the entire disk dissection. A LUKS v1 partition
simply isn't LUKS2-with-integrity, so return 0 instead and let
dissection continue normally.

8 days agotest: skip TEST-70-TPM2.nvpcr check if pcrextend socket inactive
Luca Boccassi [Tue, 5 May 2026 08:52:29 +0000 (09:52 +0100)] 
test: skip TEST-70-TPM2.nvpcr check if pcrextend socket inactive

systemd-dissect --mtree calls io.systemd.PCRExtend over Varlink to extend
the verity NvPCR after activation, and the test then diffs the measure
log to find the new entry. But systemd-pcrextend.socket has
ConditionSecurity=measured-os, which fails when the firmware did not
initialize PCRs, so the test fails.

[   10.056930] systemd[1]: systemd-pcrextend.socket - TPM PCR Measurements skipped, unmet condition check ConditionSecurity=measured-os

Follow-up for 521a523ce0cdcf0d529bd566f3d64ae93f10419d

8 days agocore/varlink-metrics: expose ReloadCount as a metric
Simon Lucido [Mon, 4 May 2026 09:40:41 +0000 (11:40 +0200)] 
core/varlink-metrics: expose ReloadCount as a metric

Add ReloadCount to the io.systemd.Metrics family table so it can be
queried alongside other manager-level metrics via systemd-report.

Also extend the existing integration test to cross-check the value
returned by systemd-report against the D-Bus and Varlink transports
on every assertion.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Simon Lucido <simonlucido@meta.com>
8 days agoanalyze: convert to OPTION and VERB macros 41945/head
Zbigniew Jędrzejewski-Szmek [Mon, 4 May 2026 06:00:32 +0000 (08:00 +0200)] 
analyze: convert to OPTION and VERB macros

The logic that was tested in the previous commit is used to implement
the behaviour for unit-shell and other verbs without changes.

The compare-versions synopsis is shortened to "V1 [OP] V2" to make the
verb synopsis fit. Unusual capitalizaition of "Command" is changed to
"COMMAND" (it's a replace arg, not a fixed string), and some help
strings are adjusted. The order of options in --help is based on the
existing order in parse_argv(). The old order in --help was mostly
random. I think it might be good to figure out something more rational
here, but I'm leaving that as a separate step.

The urlification of dot(1) in the --help string is lost. It's hard to
do this with the help string being stored in a read-only section.
I think this is not worth the trouble to reimplement in the current
scheme.

8 days agotest-options: add a check for custom logic in systemd-analyze
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 07:59:16 +0000 (09:59 +0200)] 
test-options: add a check for custom logic in systemd-analyze

8 days agoshared/verbs: display default verb as "[verb]"
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 08:59:46 +0000 (10:59 +0200)] 
shared/verbs: display default verb as "[verb]"

8 days agoshared/help-util: automatically append ":" in sections
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 08:40:31 +0000 (10:40 +0200)] 
shared/help-util: automatically append ":" in sections

8 days agoresolve: enforce the search domain limit earlier (#41938)
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 09:12:25 +0000 (11:12 +0200)] 
resolve: enforce the search domain limit earlier  (#41938)

The search domain limit is already enforced by dns_search_domain_new(),
but in this case it's way too late. Let's enforce it during the first
loop to avoid unnecessary parsing.

---

Also, set a similar limit for NTAs - introduce a new constant, since
there's no pre-existing limit. I pulled the value from a thin air since
there's (AFAIK) no mandated maximum/minimum for NTAs, but given they're
supposed to be a manual and _temporary_ workarounds, hopefully 2K of
NTAs will be more than enough (if not, please yell).

Also note: the newly added error messages don't have the trailing "."
and similarly the newly introduced constant doesn't have the "u" suffix
to match the style of the surrounding code (and I didn't want to fix the
surrounding code to make the diff minimal). If this is not desirable,
please also yell.

8 days agocryptsetup: avoid a segfault when a keyfile is passed along with a TPM device (#41892)
Zbigniew Jędrzejewski-Szmek [Tue, 5 May 2026 09:10:25 +0000 (11:10 +0200)] 
cryptsetup: avoid a segfault when a keyfile is passed along with a TPM device (#41892)

A segfault is observed when both key_file and tpm2-device are
simultaneously passed to systemd-cryptsetup, e.g.:
  systemd-cryptsetup attach test_data /vol /my-pass tpm2-device=auto

The crash appears after commit 5c6aad9 but the flaw in the logic was
pre-existing.

Fixes #41867

8 days agotest: avoid nspawn failure due to scope in use in TEST-06-SELINUX
Luca Boccassi [Mon, 4 May 2026 22:41:10 +0000 (23:41 +0100)] 
test: avoid nspawn failure due to scope in use in TEST-06-SELINUX

TEST-06-SELINUX occasionally fails because repeated nspawn invocations use
the same machine name and scope:

TEST-06-SELINUX.sh[598]: Failed to allocate scope: Unit H.scope was already loaded or has a fragment file.

Use a different machine name/scope for each invocation in the test
case to avoid hitting this issue

8 days agotest: skip TEST-07-PID1.DeferReactivation with sanitizers
Luca Boccassi [Mon, 4 May 2026 20:06:02 +0000 (21:06 +0100)] 
test: skip TEST-07-PID1.DeferReactivation with sanitizers

This test relies on tight timers, and is flaky under sanitizers
as everything slows down a lot. Just skip it.

8 days agoupdate TODO
Lennart Poettering [Tue, 5 May 2026 06:02:07 +0000 (08:02 +0200)] 
update TODO

8 days agoresolve: limit the number NTAs to something sensible 41938/head
Frantisek Sumsal [Mon, 4 May 2026 20:07:46 +0000 (22:07 +0200)] 
resolve: limit the number NTAs to something sensible

8 days agoresolve: enforce the search domain limit earlier
Frantisek Sumsal [Mon, 4 May 2026 19:38:56 +0000 (21:38 +0200)] 
resolve: enforce the search domain limit earlier

The search domain limit is already enforced by dns_search_domain_new(),
but in this case it's way too late. Let's enforce it during the first
loop to avoid unnecessary parsing.

8 days agotest: suppress PCR public key auto-loading in TEST-70-TPM2 dditest
Luca Boccassi [Mon, 4 May 2026 13:42:03 +0000 (14:42 +0100)] 
test: suppress PCR public key auto-loading in TEST-70-TPM2 dditest

The dditest block calls systemd-repart with Encrypt=tpm2 but without
--tpm2-public-key-pcrs=. Since systemd-stub drops
/run/systemd/tpm2-pcr-public-key.pem when booting from a signed UKI
systemd-repart auto-loads it and enrolls a signed PCR policy, and
then systemd-cryptsetup tpm2-device=auto has no matching signature file,
so unlock fails.

--tpm2-public-key= is not enough as the default kicks in then.

Follow-up for cd18656d47710c251a44a8f5f9d616151a909152

8 days agotest: make TEST-64 mdadm_lvm cleanup robust against reruns
Luca Boccassi [Sun, 3 May 2026 21:16:15 +0000 (22:16 +0100)] 
test: make TEST-64 mdadm_lvm cleanup robust against reruns

mdadm --zero-superblock only wipes the MD metadata on the underlying
disks, not the LVM PV header that lives in the array data area. When
the VM is restarted and the test re-creates the array with the same
UUID, /dev/md127 exposes the old data including the LVM PV header, so
udev's 69-lvm.rules auto-triggers lvm-activate-mdlvm_vg.service which
races with the test's own pvcreate for exclusive access on /dev/md127.

Wipe the LVM signature off the MD device (and the underlying disks as
a belt-and-braces measure) to avoid the race on re-run, fixing failures
when the VM is rebooted instead of shut down.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
8 days agosemaphore: stop deleting all apt sources
Luca Boccassi [Mon, 4 May 2026 11:58:33 +0000 (12:58 +0100)] 
semaphore: stop deleting all apt sources

The image configuration was changed and the main sources are
now in a drop-in apt sources files too, so deleting the whole
drop-in directory breaks installing packages. Just delete the
disabled ones and chrome.

9 days agocore: Open netfilter socket only when needed
Valentin David [Mon, 4 May 2026 08:25:19 +0000 (10:25 +0200)] 
core: Open netfilter socket only when needed

On initrds where nfnetlink module is missing, trying to open
a NETLINK_NETFILTER netlink socket takes a lot of time then fails.
This makes boot noticibly slower. Even though probably no
unit in an initrd need netfilter.

So here we delay opening the socket until we know we need it.

9 days agotest: fix flaky TEST-04-JOURNAL.reload.sh due to service name collision
Luca Boccassi [Sun, 3 May 2026 22:31:59 +0000 (23:31 +0100)] 
test: fix flaky TEST-04-JOURNAL.reload.sh due to service name collision

write_to_journal() was called via $(...) command substitution, so
SERVICE_COUNTER++ ran in a subshell and never incremented in the
parent:

[ 1492.668302] TEST-04-JOURNAL.sh[15064]: + local service=test-0-18493.service
[ 1492.725882] TEST-04-JOURNAL.sh[15064]: + local service=test-0-18009.service
[ 1492.739643] TEST-04-JOURNAL.sh[15064]: + local service=test-0-18493.service
[ 1492.774586] TEST-04-JOURNAL.sh[15064]: + local service=test-0-25540.service
[ 1492.815664] TEST-04-JOURNAL.sh[15064]: + local service=test-0-15916.service
[ 1492.867067] TEST-04-JOURNAL.sh[15064]: + local service=test-0-20327.service
[ 1492.899077] TEST-04-JOURNAL.sh[15064]: + local service=test-0-86.service
[ 1497.289715] TEST-04-JOURNAL.sh[15064]: + local service=test-0-10849.service
[ 1497.335791] TEST-04-JOURNAL.sh[15064]: + local service=test-0-18009.service

With 99999 possible unit names collisions are rare but not impossible,
so every now and then a CI run fails.

Have write_to_journal() set a global SERVICE_NAME variable instead and
call it directly so SERVICE_COUNTER actually goes up through the test.

9 days agoTEST-70-TPM2: Test the key_file + tpm2-device= combo 41892/head
Vitaly Kuznetsov [Thu, 30 Apr 2026 14:44:45 +0000 (16:44 +0200)] 
TEST-70-TPM2: Test the key_file + tpm2-device= combo

When key_file is passed along with tpm2-device= to systemd-cryptsetup, the
logic is to try the blob as a TPM blob first, and then fall back to trying the
file as a regular key file. Check that this fallback works.

9 days agocryptsetup: avoid a segfault when a keyfile is passed along with a TPM device
Vitaly Kuznetsov [Thu, 30 Apr 2026 14:44:39 +0000 (16:44 +0200)] 
cryptsetup: avoid a segfault when a keyfile is passed along with a TPM device

When a keyfile is passed with tpm2-device=, e.g.,

 systemd-cryptsetup attach test_data /vol /my-pass tpm2-device=auto

the logic in attach_luks_or_plain_or_bitlk_by_tpm2() tries to process it as a
TPM blob first. This did not work properly because it passes n_blobs=1 to
acquire_tpm2_key(), and the key_file is only read when n_blobs == 0. As a
result, the code ends up calling tpm2_unseal(..., blobs=NULL, n_blobs=1, ...).

Before commit 5c6aad9 ("cryptsetup-tokens: Print tpm2-primary-alg: only when it
is known"), the segfault was not observed because tpm2_unseal() was bailing out
early when primary_alg == 0. However, after that change, it attempts to process
the blob (which is NULL) and crashes.

Fix this logic by passing n_blobs=0 to acquire_tpm2_key() so that it actually
reads the key_file. Additionally, assert 'blobs' in tpm2_unseal() as a
safeguard.

Fixes #41867

9 days agoman/sd-bus: add a note that tcp: is w/o encryption
Zbigniew Jędrzejewski-Szmek [Mon, 4 May 2026 08:10:13 +0000 (10:10 +0200)] 
man/sd-bus: add a note that tcp: is w/o encryption

9 days agodbus-manager: limit the number of states/patterns per query (#41891)
Lennart Poettering [Mon, 4 May 2026 08:07:04 +0000 (10:07 +0200)] 
dbus-manager: limit the number of states/patterns per query (#41891)

Let's cap the number of states/patterns per query to something
reasonable, i.e. max 256 states and 4K patterns per query.

---

Also, use the env assignments limit in a couple more places.

9 days agoboot: Try to load UKI from simple filesystem before LoadImage
Valentin David [Sat, 18 Apr 2026 13:09:00 +0000 (15:09 +0200)] 
boot: Try to load UKI from simple filesystem before LoadImage

When the source buffer is NULL, the firmware is supposed to try to load the UKI
with simple filesystem protocol then load file 2 protocol. But it seems
on some versions of AMI, it does not use simple filesystem protocol,
and then fails to load if the ESP was loaded from an El Torito boot
catalog. Trying to load the source buffer from the simple filesystem protocol
protocols seems work around this limitation.

Shim for example, also loads the source buffer before calling LoadImage. So it
seems to be a safe thing to do. We could also maybe in the future use load file
2 protocol if simple filesystem failed in the first place.

9 days agotest: make TEST-70-TPM2 and TEST-86-MULTI-PROFILE-UKI robust against reruns (#41922)
Zbigniew Jędrzejewski-Szmek [Mon, 4 May 2026 05:48:38 +0000 (07:48 +0200)] 
test: make TEST-70-TPM2 and TEST-86-MULTI-PROFILE-UKI robust against reruns (#41922)

These tests leave a lot of state around, and when the test is re-run,
for example due to the qemu bug that makes a VM reboot instead of
shutting down, it fails.

9 days agotest: make TEST-86-MULTI-PROFILE-UKI robust against reruns 41922/head
Luca Boccassi [Sun, 3 May 2026 15:33:38 +0000 (16:33 +0100)] 
test: make TEST-86-MULTI-PROFILE-UKI robust against reruns

When qemu reboots instead of shutting down after the last iteration,
the profile is already set to profile2 but the /root/encrypted.raw is
gone so the test fails. Reset the default boot entry at the end of the
test to make it robust against reruns.

Fixes https://github.com/systemd/systemd/issues/39553

9 days agotest: make TEST-70-TPM2 robust against reruns
Luca Boccassi [Sun, 3 May 2026 15:23:41 +0000 (16:23 +0100)] 
test: make TEST-70-TPM2 robust against reruns

The test leaves a lot of state around, and when the test is re-run,
for example due to the qemu bug that makes a VM reboot instead of
shutting down, it fails.

Do more cleanups in the traps.

[  162.642175] TEST-70-TPM2.sh[2815]: Calculated public key name: 000b2b66edc3a466e81059286aaf38d09ea42a7a9dcdf6ba3b664c62f0cae4ce4f66
[  162.642628] TEST-70-TPM2.sh[2815]: PolicyAuthorize calculated digest: 2caa740101f65734d50395d6abc64fa46015d40d1f5de239434578544e592a92
[  162.643681] TEST-70-TPM2.sh[2815]: Calculated NV index name: 000b439cfa1534815bbe8d33b80c56f5a8d17d36fe94a7782b23a37b50def5fc5eaa
[  162.645111] TEST-70-TPM2.sh[2815]: PolicyAuthorizeNV calculated digest: 69ee0e89fafe6b9df2cd6a5defbf74aa46cf6d92703e645d463549da4ba5e1a4
[  162.645407] TEST-70-TPM2.sh[2815]: Combined signed PCR policies and pcrlock policies cannot be calculated offline, currently.
[  162.649576] TEST-70-TPM2.sh[2815]: Releasing crypt device /dev/loop0 context.
[  162.652433] TEST-70-TPM2.sh[2815]: Releasing device-mapper backend.
[  162.653518] TEST-70-TPM2.sh[2815]: Closing read only fd for /dev/loop0.
[  162.654359] TEST-70-TPM2.sh[2815]: Closing read write fd for /dev/loop0.
[  162.654786] TEST-70-TPM2.sh[2815]: Failed to encrypt device: Operation not supported

Fixes https://github.com/systemd/systemd/issues/38241

10 days agotest: bump device timeout to 300s for TPM2 tests
Luca Boccassi [Sun, 3 May 2026 12:27:32 +0000 (13:27 +0100)] 
test: bump device timeout to 300s for TPM2 tests

Booting with TPM2 has become slower recently so tests are randomly
failing, try to bump the default device timeout in those test VMs

10 days agotest: fix json encoding issue due to backslashes
Luca Boccassi [Sat, 2 May 2026 23:06:56 +0000 (00:06 +0100)] 
test: fix json encoding issue due to backslashes

TEST-74-AUX-UTILS.sh[3782]: + varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List '{"name": "proc-sysrq\x2dtrigger.mount"}'
TEST-74-AUX-UTILS.sh[3783]: + jq -e .context.Mount
TEST-74-AUX-UTILS.sh[3782]: Failed to parse parameters at <argv[4]>:1:10: Invalid argument

Use jq to encode the input

10 days agotest: avoid getting stuck on /dev/fuse
Luca Boccassi [Sat, 2 May 2026 22:46:46 +0000 (23:46 +0100)] 
test: avoid getting stuck on /dev/fuse

On Fedora Rawhide checking /dev/fuse in the test is getting stuck and timing out:

[   47.930104] TEST-13-NSPAWN.sh[2588]: + testcase_fuse
[   47.930424] TEST-13-NSPAWN.sh[2589]: ++ cat
[   58.772538] audit: type=1131 audit(1777728357.726:778): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-importd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  901.882562] audit: type=1131 audit(1777729200.830:782): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-tmpfiles-clean comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Finishing after writing 176921 entries
qemu-system-x86_64: terminating on signal 15 from pid 70717 (/usr/bin/python3)

Wrap it with a timeout to avoid getting stuck forever

Follow-up for dc3223919f663b7c8b8d8d1d6072b4487df7709b

10 days agotest: make varlink StartTransient checks compatible with jq 1.6
Luca Boccassi [Sat, 2 May 2026 22:18:22 +0000 (23:18 +0100)] 
test: make varlink StartTransient checks compatible with jq 1.6

The new "varlinkctl --more StartTransient" subtest pipes a JSON-SEQ
stream of multiple records into "jq --seq -e ...". CentOS 9
ships jq 1.6, where -e only inspects the last input record's output:
when the trailing record (the final reply) doesn't match the
"select()" filter, jq exits non-zero even though earlier records
match, so the test fails.

Use --slurp which collapses the records into an array first and
returns a single bool.

Follow-up for 1cde1cc3bab595fe7b4e2befbfa08a01a172db0f

10 days agobuild(deps): bump the actions group with 6 updates
dependabot[bot] [Fri, 1 May 2026 10:59:43 +0000 (10:59 +0000)] 
build(deps): bump the actions group with 6 updates

Bumps the actions group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [github/codeql-action](https://github.com/github/codeql-action) | `4.32.4` | `4.35.2` |
| [actions/github-script](https://github.com/actions/github-script) | `8.0.0` | `9.0.0` |
| [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `6.0.0` | `6.1.0` |
| [redhat-plumbers-in-action/gather-pull-request-metadata](https://github.com/redhat-plumbers-in-action/gather-pull-request-metadata) | `1.9.0` | `1.9.1` |
| [super-linter/super-linter](https://github.com/super-linter/super-linter) | `8.5.0` | `8.6.0` |
| [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `2.6.1` | `3.0.0` |

Updates `github/codeql-action` from 4.32.4 to 4.35.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/89a39a4e59826350b863aa6b6252a07ad50cf83e...95e58e9a2cdfd71adc6e0353d5c52f41a045d225)

Updates `actions/github-script` from 8.0.0 to 9.0.0
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/ed597411d8f924073f98dfc5c65a23a2325f34cd...3a2844b7e9c422d3c10d287c895573f7108da1b3)

Updates `aws-actions/configure-aws-credentials` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases)
- [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md)
- [Commits](https://github.com/aws-actions/configure-aws-credentials/compare/8df5847569e6427dd6c4fb1cf565c83acfa8afa7...ec61189d14ec14c8efccab744f656cffd0e33f37)

Updates `redhat-plumbers-in-action/gather-pull-request-metadata` from 1.9.0 to 1.9.1
- [Release notes](https://github.com/redhat-plumbers-in-action/gather-pull-request-metadata/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/gather-pull-request-metadata/compare/b86d1eaf7038cf88a56b26ba3e504f10e07b0ce5...62fc85c7acd15db62a0bdf007c8dbeda86eaf3b6)

Updates `super-linter/super-linter` from 8.5.0 to 8.6.0
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/61abc07d755095a68f4987d1c2c3d1d64408f1f9...9e863354e3ff62e0727d37183162c4a88873df41)

Updates `softprops/action-gh-release` from 2.6.1 to 3.0.0
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/153bb8e04406b158c6c84fc1615b65b24149a1fe...b4309332981a82ec1c5618f44dd2e27cc8bfbfda)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.35.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/github-script
  dependency-version: 9.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: aws-actions/configure-aws-credentials
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: redhat-plumbers-in-action/gather-pull-request-metadata
  dependency-version: 1.9.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: super-linter/super-linter
  dependency-version: 8.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: softprops/action-gh-release
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
10 days agobuild(deps): bump meson from 1.10.2 to 1.11.1 in /.github/workflows
dependabot[bot] [Fri, 1 May 2026 10:55:59 +0000 (10:55 +0000)] 
build(deps): bump meson from 1.10.2 to 1.11.1 in /.github/workflows

Bumps [meson](https://github.com/mesonbuild/meson) from 1.10.2 to 1.11.1.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.10.2...1.11.1)

---
updated-dependencies:
- dependency-name: meson
  dependency-version: 1.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>