Commit Graph
89794 Commits
Author SHA1 Message Date
Paul Meyer ef7d64cd09 vmspawn: fix QEMU target names for ppc64/mips64el/mipsel hosts
architecture_to_qemu_table mapped four 64-bit/LE architectures to wrong
qemu-system-<target> names: MIPS64_LE and MIPS_LE both to "mips" (the BE
MIPS32 target), and PPC64/PPC64_LE to "ppc" (32-bit PowerPC). The string
feeds both find_qemu_binary() ("qemu-system-" + name) and the
firmware.json architecture match, so on those hosts vmspawn looked up a
wrong or nonexistent binary and never matched a firmware descriptor. Map
them to the real targets: mips64el, mipsel, and ppc64 (qemu-system-ppc64
runs LE pSeries guests; there is no qemu-system-ppc64le).

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer 4f6ce566e1 vmspawn: reject oversized fstab.extra credential before int-cast merge
The fstab.extra merge prepends the existing credential via
asprintf("%.*s", (int) existing->size, …). MachineCredential.size is
size_t, so for a credential >INT_MAX the (int) cast yields a negative
precision, which C treats as omitted — turning %.*s into an unbounded
read past the allocation. Reject such a credential up front with EFBIG;
for all realistic sizes the merge is unchanged.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer 0fc82c6d13 vmspawn: return negative errno from qemu_config_key()/_section_impl()
errno_or_else() already returns a negative errno, so "return
-errno_or_else(EIO)" returned a positive value on fprintf()/ferror()
failure. Callers checking "r < 0" therefore missed the write error and
treated it as success. Drop the spurious negation; these were the only
two "-errno_or_else" uses in the tree.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer c90e572411 vmspawn: null freed fields and drain subscribers before bridge teardown
vmspawn_varlink_context_free() discarded the sd_varlink_server_unref()
and vmspawn_qmp_bridge_free() return values, leaving ctx->varlink_server
and ctx->bridge dangling. No current handler reads those fields, but use
the assign-back idiom so the fields are NULL during any synchronous
callback regardless of future changes.

Also drain subscribers before freeing the bridge, so subscriber teardown
can't run against a half-freed bridge.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer b10a938d8d vmspawn: reject --initrd= without --linux= for directory boot
determine_kernel() ran boot-entry discovery under a !arg_linux guard
only. With --initrd= but no --linux=, discovery overwrote arg_initrds
with the discovered entry's own initrds (leaking the user's strv) and
set arg_linux, so verify_arguments()'s "--initrd= needs --linux=" check,
which runs afterwards, never fired: the user's --initrd= was
silently discarded. Reject the combination before discovery. This also
keeps the discovery store leak-free.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer 9f28938a84 vmspawn: don't leak prior arg_directory in ephemeral branch
The ephemeral-snapshot branch did a bare arg_directory = strdup(...),
orphaning the -D/--directory allocation from parse_argv.
Use free_and_strdup(), matching the idiom already used elsewhere in
the file.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Paul Meyer 6212baaf82 vmspawn: enforce an identifier grammar for QEMU config types/ids/keys
qemu_config_section()/qemu_config_key() write section types and keys
unquoted ([type], key = …), but the type check only rejected '\n' while
the structurally identical id/key checks rejected more, even though the
unquoted type slot is the most sensitive. Replace the three ad-hoc
denylists with one allowlist matching QEMU's identifier grammar
([A-Za-z0-9._-], non-empty). This is merely hardening, all callers pass
constant input today.

For the value check use string_is_safe() for now, which is a bit
stricter than QEMUs own config validation.

Add test-vmspawn-qemu-config covering both.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-06-17 10:23:47 +02:00
Luca Boccassi c55c651cc0 meson: bump version to v261~rc4 2026-06-16 17:57:06 +01:00
Luca Boccassi 8170156f29 NEWS: update time and place 2026-06-16 17:57:06 +01:00
Luca Boccassi febb547335 NEWS: update contributors list 2026-06-16 17:57:06 +01:00
Luca Boccassi 9decc099ce Update hwdb autosuspend
ninja -C build update-hwdb-autosuspend
2026-06-16 17:57:06 +01:00
Luca Boccassi b8fbcbf2b7 Update hwdb
ninja -C build update-hwdb
2026-06-16 17:57:06 +01:00
Luca Boccassi e0edfca4cb LUO: only deserialize on boot, add version and structure to JSON payload (#42607) 2026-06-16 17:55:56 +01:00
Lennart Poettering 76ef4902d3 homectl: actually honour --mute-console= (#42617) 2026-06-16 17:13:29 +02:00
dongshengyuan 98cae7a125 core: fix unit_merge() load state check evaluating after state overwrite
The condition on line 1206 checks other->load_state != UNIT_STUB to
decide whether to call the vtable done() callback, but the state was
already overwritten to UNIT_MERGED on line 1198, making the condition
always true.

Save the original load_state before overwriting it, so that units in
UNIT_STUB state (which never went through a load attempt) correctly
skip the done() call.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 15:43:37 +01:00
Daan De Meyer a77838a950 nsresourced: reclaim ranges from dead namespaces during allocation
The only runtime trigger for registry cleanup is the BPF kprobe that fires
on user namespace destruction; when it is missed (ring buffer overflow,
kprobe missing, fdstore entry dropped), the dead namespace's registry entry
survives and keeps its UID/GID ranges blocked until the manager restarts and
its startup sweep runs. The allocation hot path checked whether a candidate
range was already taken but never whether the namespace holding it was still
alive, so a single dead namespace could permanently starve an allocation.
This is most visible when a parent delegates its entire container UID window
to a child that then dies: every subsequent allocation from the parent fails
with NoDynamicRange even though the ranges are reclaimable.

Add userns_registry_reap_if_dead(), which probes a registered namespace's
liveness via the kernel namespace identifier recorded at allocation time and,
if it is authoritatively dead, releases its registry entry — restoring any
ranges it received via delegation to their ancestors. Call it from the
allocation availability check for both transient registrations and delegated
ranges, walking a chain of dead ancestors in the delegation case. This
mirrors the existing inode-slot stale cleanup and makes allocation
self-healing without waiting for a restart.

The startup sweep grew the same load-probe-release logic, so route it through
the new helper too; its errno return distinguishes alive, no-recorded-id, and
unprobeable-environment cases so the sweep keeps its early-out when lookup by
id isn't possible at all.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 14:00:03 +01:00
Luca Boccassi ced0bf2f70 core: add version and structure to LUO json payload
We might want to add more state to the LUO session json payload,
so add a version (to allow clean compat breaks if needed) and nest
the current fdstore contents under a 'units' object, so that more
top-level data can be added in the future without breaking
backward compatibility.

Follow-up for 257c35c1a3
2026-06-16 13:51:59 +01:00
Luca Boccassi 4436d492b5 mkosi: fix escape in suse repackaging script
Otherwise it trips on files such as:

 Installed (but unpackaged) file(s) found:
 /usr/lib/udev/hwdb.d/70-debug-appliance.hwdb

Follow-up for 4d0f1451b5
2026-06-16 12:15:59 +01:00
dongshengyuan 30071f51e5 misc: fix minor error handling issues
fstab-generator: pass k instead of r to bus_error_message() so the
fallback error string reflects the actual bus call failure, not the
accumulated result that was reset to 0 earlier.

networkd-ndisc: return -ENOMEM when newdup() fails, since r is 0 at
that point and the OOM would otherwise be reported as success.

storagetm: add missing NULL check after strndup() for attr_model,
matching the pattern already used for attr_firmware and attr_serial.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 11:44:08 +01:00
Luca Boccassi 229abeaf8d core: only attempt to deserialize state from LUO on boot
Avoid trying to query for our LUO session on reexec/softreboot/reload/etc.
Currently /dev/liveupdate is only accessible to root so it's not a big
issue, but this might change in the future, so make sure nobody can
play games with us.

Follow-up for 257c35c1a3
2026-06-16 11:35:11 +01:00
Luca Boccassi bedabe36cc obs: prepare ParticleOS images in workflow
Link ParticleOS images in the workflow subproject for the PR,
so that they can be enabled with a click when needed.
But keep disabled by default, as they take a lot of resources,
especially disk space.
2026-06-16 11:08:45 +01:00
dongshengyuan f50ac21ceb gpt-auto-generator: fix error propagation in add_root_mount()
When generator_write_initrd_root_device_deps() fails, the error was
swallowed by returning 0 (success) instead of r. The two subsequent
calls in the same block correctly return r on failure.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:26:23 +02:00
dongshengyuan cfed283b9c mount: log control command before clearing it in mount_sigchld_event()
control_command and control_command_id were cleared before being passed
to unit_log_process_exit(), so the log always showed an invalid/unknown
command name.

Move both clears after the log call, matching the ordering in
socket_sigchld_event() and service_sigchld_event().

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:14:02 +02:00
guido fc06cd756e Add Elecom Huge Plus information for wired usb, wireless usb, and bluetooth 2026-06-16 10:13:42 +02:00
Daan De MeyerandLuca Boccassi 3978b076af loop-util: shortcut block device fd when it carries no partition table
663f0bf5cb stopped reusing the original block device fd whenever
partition scanning was requested (LO_FLAGS_PARTSCAN) but couldn't be
enabled on the device, so that nested partition tables on devices the
kernel won't scan (e.g. the pmOS/android case) get exposed via a real
loop device.

However that also forced a pointless loop device for any partition that
carries a file system directly, e.g. a btrfs subvolume mounted via
MountImages=. For multi-device btrfs this is fatal: the kernel rejects
seeing the same member via both the original partition and the loop
device, and the mount fails.

A loop device is only ever needed here to expose a nested partition
table. So only refuse the shortcut when the device actually carries one,
probed via gpt_probe(), instead of whenever partition scanning is
disabled. Devices carrying a file system directly (or nothing) take the
shortcut as before.

Add an integration test to cover the failure scenario of the original
issue.

Fixes: https://github.com/systemd/systemd/issues/42520
Replaces: https://github.com/systemd/systemd/pull/42576
Follow-up for 663f0bf5cb79ecaf6dd71441ecdc9dc401e7eae6

Co-Authored-By: Luca Boccassi <luca.boccassi@gmail.com>
Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 00:16:05 +01:00
Luca Boccassi 53f5f840c7 report: place Upload() on io.systemd.Report.Uploader rather than io.systemd.Report interface (#42584)
We really want to use io.systemd.Report for the interface provided by
systemd-report itself, not by its backend. hence, rename the interface
that uploading plugins shall implement to io.systemd.Report.Uploader.

Note that we ideally should have a varlink interface definition for that
interface. if we had, we'd have noticed that earlier.
2026-06-15 22:05:18 +01:00
Luca Boccassi 8127d21ffc tools: add script to print blurb for SPI yearly report
Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 20:45:36 +01:00
Lennart Poettering de4611efc2 report: rename varlink dir for upload plugins
let's name the dir "/run/systemd/report.upload/" (rather than
"/run/systemd/metrics-upload/"). After all, these are reports that we
upload, not indiviudual metrics. And it would be particular confusing
since the dir to pick up metrics is called /run/systemd/report/, rather
than /run/systemd/metrics/. Hence the thing that deals with reports is
nmamed metrics, and the thing that deals in metrics is named reports...
2026-06-15 20:54:37 +02:00
Lennart Poettering b144bdaf0c report: place Upload() on io.systemd.Report.Uploader rather than io.systemd.Report interface
We really want to use io.systemd.Report for the interface
provided by systemd-report itself, not by its backend. hence, rename the
interface that uploading plugins shall implement to
io.systemd.Report.Uploader.

Note that we ideally should have a varlink interface definition for that
interface. if we had, we'd have noticed that earlier.
2026-06-15 20:53:36 +02:00
Yu Watanabe 430f50503a ci/mkosi: set default values on use 2026-06-15 17:05:25 +01:00
Daan De Meyer d8a625875c udev: only trigger the boot-disk loop device for optical drives
probe_gpt_boot_disk_needs_loop() sets ID_PART_GPT_AUTO_ROOT_DISK_NEEDS_LOOP
for any whole disk that holds the boot ESP/XBOOTLDR but whose partition table
the kernel cannot parse. Until now the udev rule turned that into a
systemd-loop@.service for every block device.

That is too broad: device-mapper devices also report kernel partition
scanning as disabled, but their partitions are managed in userspace by kpartx
(see 66-kpartx.rules). Setting up a loop device on top of them re-exposes the
same partition table a second time and only causes trouble.

Restrict the rule to optical drives, the one class that genuinely needs a
kernel-side loop device (El Torito GPT sector size mismatch, or drives that do
not support partition scanning) and that has no userspace partition manager of
its own.

Co-developed-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 16:00:39 +02:00
Daan De Meyer 1dc599ce41 udev-builtin-blkid: keep probing the boot disk when it needs a loop device
Since 4e0eabd401 ("udev: also trigger loop device for boot disk when
partition scanning is unsupported"), builtin_blkid() bails out entirely as
soon as probe_gpt_boot_disk_needs_loop() reports that a loop device is
needed, skipping all superblock probing. As a result whole-disk properties
such as ID_PART_TABLE_UUID and ID_FS_* are no longer set.

This regresses any whole disk whose partitions the kernel cannot expose
itself but which is otherwise perfectly probeable, most notably
device-mapper multipath disks: kernel partition scanning is disabled on them
(their partitions are managed in userspace by kpartx), so they are now
flagged as needing a loop device and lose their ID_PART_TABLE_UUID.

The early return was never necessary. The original intent was only to skip
root partition discovery on the device, and that already happens on the loop
device instead: find_gpt_root() bails when the kernel can't scan partitions,
blkid probes at the device's own logical sector size so a GPT written for a
different sector size is simply not detected, and PART_ENTRY_* is only
emitted for partitions the kernel actually registered, of which a
loop-needing whole disk has none. So keep probing the device for its
whole-disk properties unconditionally and let partition and root discovery
happen on the loop device.

Co-developed-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 16:00:39 +02:00
dongshengyuan 240b71fe1f portable: fix double-free in normalize_portable_changes()
Now that the fast path performs a deep copy identical to the general
loop (when n_changes_attached==0, found stays false for all entries),
the block is redundant. Remove it and let the general loop handle this
case.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 22:26:09 +09:00
dongshengyuan 2ef8fb91cc random-seed: fix wrong error variable in log_error_errno()
At line 285, ftruncate() failure was logged using 'r' which is 0
from the preceding successful loop_write() call. log_error_errno(0, ...)
triggers an assertion crash in developer builds (ASSERT_NON_ZERO) and
silently returns success in release builds, swallowing the ftruncate error.

Replace with errno which is set by ftruncate() on failure.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
Co-developed-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 14:16:28 +02:00
Yu Watanabe da2ed93b65 musl: fix build on 32-bit architecture
```
../src/boot/test-efi-string.c: In function 'test_xvasprintf_status':
../src/boot/test-efi-string.c:744:34: error: format '%zi' expects argument of type 'signed size_t', but argument 4 has type 'long int' [-Werror=format=]
  744 |         test_printf_one("%i %i %zi", INT_MIN, INT_MAX, SSIZE_MAX);
      |                                ~~^
      |                                  |
      |                                  int
      |                                %li
cc1: some warnings being treated as errors
ninja: subcommand failed
```
2026-06-15 14:15:46 +02:00
Samuel Holland 1460f43785 bootctl: Respect --variables from the command line
A previous refactoring failed to copy the flag from the command line
argument to the installation context object, so the flag was ignored.

Closes: https://github.com/systemd/systemd/issues/41488
Fixes: 38433a6d06 ("bootctl: rework bootctl-install.c in preparation of varlinkification")
2026-06-15 14:13:54 +02:00
Yu Watanabe 63ace603c7 ci/unit-tests: drop unnecessary RepositoryKeyFetch=yes for postmarketOS
It is enabled by default since
https://github.com/systemd/mkosi/commit/c4af878bcb8c79bf0494d022b8580bdcef4edf47
2026-06-15 10:08:15 +02:00
Valentin David 59480bb7f0 repart: Rescan after writing partition table on factory reset
If a partition gets removed due to factory reset, we will recreate it
as blkpg later. So it needs to get removed. So rescan is needed to be
done after we write the partition table for factory reset.

Fixes #42453
2026-06-15 10:03:49 +02:00
LuK1337 8d846837fc hwdb: Make Samsung download mode work out-of-the-box
https://github.com/Benjamin-Dobell/Heimdall/blob/3997d5cc607e6c603c6e7c0d07e42e9868c62af2/heimdall/source/BridgeManager.h#L69-L79
2026-06-15 08:20:14 +09:00
Marcel Ziswiler f620216633 boot: Fix gdb support for RISC-V
This will also allow debugging systemd-boot easily on RISC-V.

Note that the following much simpler variant won't work, as we might be missing
the optional 'zihintpause' extension:

    asm volatile("pause");

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@codethink.co.uk>
2026-06-15 07:23:22 +09:00
Yu Watanabe 4290607eae network: ignore stale interface renames (#42545)
Fixes #20203.
Fixes #42527.
2026-06-15 07:20:52 +09:00
Lennart Poettering 99d7ecea9d test-varlink-idl: add missing IDL files to test-varlink-idl
The test case is supposed to validate all IDLs we ship. But a bunch were
added to the tree without hooking them up here. Fix that.
2026-06-14 23:10:02 +01:00
Luca Boccassi 11bc593c68 sysupdate: reject short manifest hashes
unhexmem_full() ignores whitespace, so a 64-byte manifest digest field
can decode to fewer than 32 bytes. Reject that while parsing instead.

[   83.883087] TEST-72-SYSUPDATE.sh[5995]: systemd-sysupdate: ../src/src/sysupdate/sysupdate-resource.c:581: resource_load_from_web: Assertion `h.iov_len == sizeof(instance->metadata.sha256sum)' failed.

Follow-up for 43cc7a3ef4

Assisted-by: kres (claude-opus-4-7)
Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 06:59:24 +09:00
Chitoku 045e8f1c7b hwdb: add IMDS properties for Vultr 2026-06-14 10:34:58 +01:00
Lennart Poettering 3e8d470a94 update TODO 2026-06-14 07:13:10 +02:00
Luca Boccassi 2629c9c179 Assorted fixes (#40987) 2026-06-13 18:24:54 +01:00
Mike Yuan a9e5f5116e sd-daemon: escape notification msg using shell_escape()
Follow-up for f9e0a62392

xescape() would unconditionally emit hex escapes, rendering
\n unreadable.
2026-06-13 17:11:11 +02:00
Mike Yuan cd13dc16c3 core/execute-serialize: fix error handling 2026-06-13 17:11:11 +02:00
Mike Yuan 6f0731cf34 core/unit: refuse PrivatePIDs= + PAMName=
Fixes #40928
2026-06-13 17:11:11 +02:00
Mike Yuan 9be5a6f665 core/manager: add missing assertion on stop_notify_queue being empty
Follow-up for 1b4ab5a209
2026-06-13 17:11:10 +02:00