Commit Graph
87720 Commits
Author SHA1 Message Date
noxiouz 329233dcbf sd-journal: make sd_journal_get_data() output params optional
Allow callers to pass NULL for ret_data and/or ret_size when they only
need to check whether a field exists.  Initialize provided output
pointers to safe defaults and update the manual page accordingly.

Propagate the NULL-ness through to journal_file_data_payload() so that
downstream helpers can optimize for the existence-check case.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 16:33:20 +02:00
Daan De Meyer f8e88be1d1 swtpm-util: Silence noise from swtpm_setup
There's no way to configure the log level for swtpm_setup, so pipe
it's logfile (which defaults to stderr) to /dev/null unless debug
logging is enabled.
2026-04-05 20:34:11 +02:00
Daan De Meyer 4753c60053 swtpm: gracefully fall back when --print-profiles output is not JSON
Older swtpm versions print --help output instead of JSON when
swtpm_setup --print-profiles is invoked. Previously, the JSON parse
failure was treated as fatal, preventing swtpm manufacture entirely on
these older versions.

Extract profile detection into a separate swtpm_find_best_profile()
helper and treat JSON parse failure as a graceful fallback: log a
notice and continue without a profile, same as when no builtin profiles
are found.
2026-04-05 19:47:26 +02:00
Daan De Meyer ba937b45be vmspawn: Fix qemu-kvm path on centos stream
Follow up for 41da1ae6a0
2026-04-05 18:51:17 +02:00
Luan Vitor Simião oliveira 39eb7fd259 hwdb: cooler master rgb controller is not a mouse 2026-04-05 17:10:13 +01:00
Christian Brauner 7ae14028d3 udev: also trigger loop device for boot disk when partition scanning is unsupported (#41509)
Previously, probe_gpt_sector_size_mismatch() would bail out early when
the GPT sector size matched the device sector size. However, some
devices (e.g. certain CD-ROM drives) do not support kernel partition
scanning even when sector sizes match. In that case, the kernel still
cannot parse the partition table, and we need to set up a loop device to
expose the partitions — just as we do for the sector size mismatch case.

Check blockdev_partscan_enabled() when sector sizes match, and only skip
the boot partition check if partition scanning is actually supported.

Also rename the function, udev property, and log messages to reflect the
broader scope:

- probe_gpt_sector_size_mismatch() -> probe_gpt_boot_disk_needs_loop()
- ID_PART_GPT_AUTO_ROOT_DISK_SECTOR_SIZE_MISMATCH ->
ID_PART_GPT_AUTO_ROOT_DISK_NEEDS_LOOP
2026-04-05 16:33:46 +02:00
Daan De Meyer c82cf5662e boot: generalize CDROM terminology to El Torito
Per UEFI specification §13.3.2, El Torito partition discovery applies to
any block device, not just optical media. Rename
disk_get_part_uuid_cdrom() to disk_get_part_uuid_eltorito() and update
all log messages and comments to say "El Torito" instead of "CDROM" to
reflect this.
2026-04-05 08:19:49 +00:00
Daan De Meyer 41da1ae6a0 vmspawn: also search for qemu binary at /usr/lib/qemu-kvm
This is the qemu binary path on CentOS Stream.
2026-04-05 09:55:09 +02:00
Daan De Meyer 4e0eabd401 udev: also trigger loop device for boot disk when partition scanning is unsupported
Previously, probe_gpt_sector_size_mismatch() would bail out early when
the GPT sector size matched the device sector size. However, some
devices (e.g. certain CD-ROM drives) do not support kernel partition
scanning even when sector sizes match. In that case, the kernel still
cannot parse the partition table, and we need to set up a loop device to
expose the partitions — just as we do for the sector size mismatch case.

Check blockdev_partscan_enabled() when sector sizes match, and only skip
the boot partition check if partition scanning is actually supported.

Also rename the function, udev property, and log messages to reflect the
broader scope:

- probe_gpt_sector_size_mismatch() -> probe_gpt_boot_disk_needs_loop()
- ID_PART_GPT_AUTO_ROOT_DISK_SECTOR_SIZE_MISMATCH -> ID_PART_GPT_AUTO_ROOT_DISK_NEEDS_LOOP
2026-04-04 22:24:47 +00:00
Lennart Poettering 51e04b7e90 shutdown: enforce a minimum uptime to make boot loops less annoying (#41215)
Fixes: #9453

Split out of #41016
2026-04-04 23:30:30 +02:00
Lennart Poettering 94430369b7 update TODO 2026-04-04 22:52:58 +02:00
Lennart Poettering 0874eea302 shutdown: enforce a minimum uptime to make boot loops less annoying
Fixes: #9453
2026-04-04 22:52:58 +02:00
Lennart Poettering 8cfae74dcd shutdown: check WATCHDOG_PID= if it is set
Alternative to: #35167
2026-04-04 22:52:58 +02:00
Lennart Poettering e7182635c6 shutdown: paranoia, switch to secure_getenv()
We have this rule in systemd that unless we are sure that getenv() is
safe and there's a reason to use it we should always prefer
secure_getenv(). Follow our own rules here, as per CODING_STYLE
document.

This really doesn't matter here, all of this is highly privileged, but
hopefully Claude & Colleagues shut up about this then, and maybe detect
the pattern better.
2026-04-04 22:49:47 +02:00
Daan De Meyer 047ae265cc udev: probe GPT sector size and trigger loop device on mismatch
When the GPT partition table uses a different sector size than the
device's native block size (e.g. 512-byte GPT on a 2048-byte CD-ROM
booted via El Torito), the kernel cannot parse the partition table.

Probe the GPT sector size upfront and configure blkid with the correct
value so it always finds the partition table. If a sector size mismatch
is detected, trigger a loop device to re-expose the device with the
correct sector size and skip root partition discovery on the original
device — it will happen on the loop device instead.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 20:03:44 +02:00
Daan De Meyer 8f5735ad50 dissect: resolve sysfs paths to devnodes in --attach
When a udev rule uses ENV{SYSTEMD_WANTS}+="systemd-loop@.service" on a
block device, the %f specifier in the service file resolves to the sysfs
path rather than the device node path. Detect sysfs paths in
parse_image_path_argument() and resolve them to the corresponding
devnode using sd_device_new_from_syspath() + sd_device_get_devname().
2026-04-04 20:03:44 +02:00
Daan De Meyer ba259f5a78 loop-util: Skip loop_device_set_autoclear() if foreign 2026-04-04 20:03:44 +02:00
Daan De Meyer 235faaad89 dissect: Don't try to set loop name if foreign 2026-04-04 20:03:44 +02:00
Daan De Meyer 05e1ca3144 boot: add El Torito CDROM partition UUID discovery
When booting from a CD-ROM via El Torito, the UEFI device path contains a
CDROM_DEVICE_PATH node instead of a HARDDRIVE_DEVICE_PATH node. Unlike the
hard drive variant, the CDROM node does not carry a partition UUID, so
systemd-boot previously could not determine the boot partition UUID in this
scenario.

Add disk_get_part_uuid_cdrom() which recovers the partition UUID by reading
the GPT from the underlying disk. Since ISO images are commonly mastered
with 512-byte GPT sectors on media with 2048-byte blocks, the function
probes for the GPT header at multiple sector sizes (512, 1024, 2048, 4096)
and matches the partition by comparing byte offsets between the CDROM node's
PartitionStart and each GPT entry's StartingLBA.

The function reuses read_gpt_entries() for GPT parsing and adds debug
logging for each failure path to aid diagnosis on real hardware.

Also adds the CDROM_DEVICE_PATH struct and MEDIA_CDROM_DP subtype constant
to device-path.h, and fixes disk_get_part_uuid() to preserve the original
device path pointer so it can be passed to the CDROM fallback.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 20:03:44 +02:00
Daan De Meyer 37b852c948 boot: Split out read_gpt_entries() 2026-04-04 20:03:44 +02:00
Daan De Meyer 4e5c605d4b boot: use EFI_DISK_IO_PROTOCOL instead of EFI_BLOCK_IO_PROTOCOL for disk reads
EFI_DISK_IO_PROTOCOL (UEFI spec section 13.7,
https://uefi.org/specs/UEFI/2.10/13_Protocols_Media_Access.html#disk-i-o-protocol)
supports reads at arbitrary byte offsets with no alignment requirements on the
buffer. The UEFI spec mandates that firmware produces this protocol on every
handle that also has EFI_BLOCK_IO_PROTOCOL, so it is always available.

This is a better fit than EFI_BLOCK_IO_PROTOCOL for our GPT parsing and
BitLocker detection because Block I/O requires that both the read offset (LBA)
and the buffer are aligned to the media's IoAlign value. Meeting that
constraint forces us to use xmalloc_aligned_pages() with
PHYSICAL_ADDRESS_TO_POINTER(), page-granularity allocations, and manual size
rounding (ALIGN_TO). Disk I/O handles all of that internally, so callers can
use plain xmalloc() or even stack buffers and read exactly the number of bytes
they need.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 20:03:44 +02:00
Daan De Meyer 0245bf7d7e repart: Split out El Torito boot catalog writing into context_eltorito()
Writing the El Torito boot catalog should be independent of writing the
partition table. Previously, the El Torito logic was embedded in
context_write_partition_table(), which meant it was skipped when the
partition table hadn't changed. Extract it into a separate
context_eltorito() function and invoke it after
context_write_partition_table() so the boot catalog is always written
when enabled.

Also move the overlap verification to be done as soon as we have all
the necessary information to do the check and before doing any expensive
work;
2026-04-04 20:01:46 +02:00
David Santamaría Rogado 4ae4bd34d7 hwdb: sensor: aquarius improve comments
Differentiate Cmp NS483 v2 accel variants.
2026-04-04 18:26:59 +01:00
Zbigniew Jędrzejewski-Szmek 71c15cdbea TEST-74-AUX-UTILS: check for failed units after capsule test
TEST-74-AUX-UTILS has a number of subtests.
test/units/TEST-74-AUX-UTILS.capsule.sh runs first and starts and stops
capsule@foobar.service. Looking at the test, the unit is cleanly stopped.
But later test/units/TEST-74-AUX-UTILS.machine-id-setup.sh tests for
failed units. capsule@foobar.service is listed as failed, causing the
second subtest to fail.

Add the same test in test/units/TEST-74-AUX-UTILS.capsule.sh to see
if the failed test really originates from there.
2026-04-04 18:18:30 +01:00
Christian Brauner afb64f1f11 TEST-70-TPM2: Suppress PCR public key auto-loading in basic tests (#41496)
When systemd-cryptenroll --tpm2-device=auto is called on a system where
a tpm2-pcr-public-key.pem exists it automatically creates tokens with a
signed PCR policy. Unlocking such a token via --unlock-tpm2-device=auto
requires a tpm2-pcr-signature.json file, which is not present.

This creates a race with systemd-tpm2-setup.service at boot: if the
service completes before the test, the key exists and the subsequent
--unlock-tpm2-device=auto calls fail, which I believe is the cause of
the test flakiness.

This also seems to mesh with the fact that this only flakes on Debian
CI, since that's built with ukify which installs a public key.

Let's hopefully fix this by passing --tpm2-public-key= to all
--tpm2-device= enrollment calls that aren't explicitly intended to test
signed PCR policy behaviour.
2026-04-04 15:03:07 +02:00
Zbigniew Jędrzejewski-Szmek ca745e1914 Convert more programs to the new option and verb parsers (#41458) 2026-04-04 10:21:14 +02:00
Lennart Poettering 1741cc4e6b repart: smaller iso9660 tweaks (#41477) 2026-04-04 10:12:39 +02:00
Lennart Poettering d2d7bd13db update TODO 2026-04-04 08:21:35 +02:00
Lennart Poettering 56245fe67f iso9660: line break overly long parameter list 2026-04-04 08:21:35 +02:00
Lennart Poettering 4c1e269f00 iso9660: validate a bunch func params via assert() 2026-04-04 08:18:10 +02:00
Lennart Poettering a678bc69f9 iso9660: small iso9660_set_string() clean-ups 2026-04-04 08:18:10 +02:00
Lennart Poettering d723bb753e iso9660: add extra size regarding buffer size 2026-04-04 08:18:10 +02:00
Lennart Poettering 8953262390 iso9660: add extra paranoia when converting dates
the ISO9660 date range and the "struct tm" range are quite different,
let's add extra paranoia checks that we can always convert the dates
without issues or fail cleanly.
2026-04-04 08:18:10 +02:00
Lennart Poettering b0d52a8101 iso9660: rename all functions so that they are prefixed by iso9660 2026-04-04 08:18:10 +02:00
Lennart Poettering 7632fa1da2 iso9660: prefer uint8_t for 'arbitrary bytes' 2026-04-04 08:18:10 +02:00
Chris Down cd18656d47 TEST-70-TPM2: Suppress PCR public key auto-loading in basic tests
When systemd-cryptenroll --tpm2-device=auto is called on a system where
a tpm2-pcr-public-key.pem exists it automatically creates tokens with a
signed PCR policy. Unlocking such a token via --unlock-tpm2-device=auto
requires a tpm2-pcr-signature.json file, which is not present.

This creates a race with systemd-tpm2-setup.service at boot: if the
service completes before the test, the key exists and the subsequent
--unlock-tpm2-device=auto calls fail, which I believe is the cause of
the test flakiness.

This also seems to mesh with the fact that this only flakes on Debian
CI, since that's built with ukify which installs a public key.

Let's hopefully fix this by passing --tpm2-public-key= to all
--tpm2-device= enrollment calls that aren't explicitly intended to test
signed PCR policy behaviour.
2026-04-04 11:17:12 +09:00
Daan De Meyer 1cc7353dcf fd-util: Add missing assert() 2026-04-03 23:22:14 +02:00
Luca Boccassi ba74a144c4 Translations update from Fedora Weblate (#41499)
Translations update from [Fedora
Weblate](https://translate.fedoraproject.org) for
[systemd/main](https://translate.fedoraproject.org/projects/systemd/main/).



Current translation status:

![Weblate translation
status](https://translate.fedoraproject.org/widget/systemd/main/horizontal-auto.svg)
2026-04-03 21:17:13 +01:00
Marek Adamski 02fcb8f544 po: Translated using Weblate (Polish)
Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: Marek Adamski <maradam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pl/
Translation: systemd/main
2026-04-03 19:58:48 +00:00
Balázs Meskó 055b64e039 po: Translated using Weblate (Hungarian)
Currently translated at 100.0% (266 of 266 strings)

Co-authored-by: Balázs Meskó <meskobalazs@mailbox.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/hu/
Translation: systemd/main
2026-04-03 19:58:47 +00:00
Zbigniew Jędrzejewski-Szmek 6baa064d8e report: add more metrics to the Varlink metrics API (#41078) 2026-04-03 19:55:24 +02:00
Zbigniew Jędrzejewski-Szmek 926167301c many: final set of coccinelle check-pointer-deref tweaks (#41426)
This is a followup to https://github.com/systemd/systemd/pull/41400 with
the final set of tweaks so that the new coccinelle `check-pinters-deref`
checker runs without failures.

It also includes a commit with some fixes for redundant asserts and the
final commit to make the assert() in the inner loop of qsort
POINTER_MAY_BE_NULL which will become a no-op - that is probably the
most controversial one, I hope the commit message explains the
trade-offs, I'm happy to drop it, I have no strong opinion either way.

Please see the individual commits/commit messages for more details, most
is (hopefully) relatively boring/mechanical.
2026-04-03 19:27:09 +02:00
Daan De Meyer 2d75149348 test: Add El Torito boot catalog dissection test
Verify that GPT images with an ISO9660 El Torito boot catalog are
dissected via the GPT partition table rather than being treated as a
single iso9660 filesystem.

Follow-up for e33eb053fb ("dissect-image: Drop
blkid_probe_filter_superblocks_usage() call from probe_blkid_filter()")
2026-04-03 19:13:24 +02:00
Daan De Meyer ef0afed651 dissect-image: Drop blkid_probe_filter_superblocks_usage() call from probe_blkid_filter()
probe_blkid_filter() sets up a blkid superblock filter to restrict
filesystem detection to a known-safe set of types (btrfs, erofs, ext4,
f2fs, squashfs, vfat, xfs). It does so via two consecutive calls:

  1. blkid_probe_filter_superblocks_type(BLKID_FLTR_ONLYIN, ...)
  2. blkid_probe_filter_superblocks_usage(BLKID_FLTR_NOTIN, BLKID_USAGE_RAID)

However, both filter functions share the same internal bitmap in libblkid.
Each call goes through blkid_probe_get_filter(), which zeroes the entire
bitmap before applying the new filter. This means the second call (usage
filter) silently destroys the type filter set by the first call.

The result is that only RAID superblocks end up being filtered, while all
other filesystem types — including iso9660 — pass through unfiltered.

This causes ISO images (e.g. those with El Torito boot catalogs and GPT)
to be incorrectly dissected: blkid detects the iso9660 superblock on
the whole device (since iso9660 is marked BLKID_IDINFO_TOLERANT and can
coexist with partition tables), the code enters the unpartitioned
single-filesystem path, and then mounting fails because iso9660 is not
in the allowed filesystem list:

  "File system type 'iso9660' is not allowed to be mounted as result
   of automatic dissection."

Fix this by dropping the blkid_probe_filter_superblocks_usage() call.
The BLKID_FLTR_ONLYIN type filter already restricts probing to only
the listed types, which implicitly excludes RAID superblocks as well,
making the usage filter redundant.

Follow-up for 72bf86663c ("dissect: use blkid_probe filters to restrict
probing to supported FSes and no raid")
2026-04-03 19:13:24 +02:00
Daan De Meyer 8f2ec65871 dissect-image: add crypto_LUKS and swap to blkid probe filter
allowed_fstypes() returns the list of filesystem types that we are
willing to mount. However, the blkid probe filter needs to detect
additional non-mountable types: crypto_LUKS (so that LUKS-encrypted
partitions can be identified and decrypted) and swap (so that swap
partitions can be identified).

Without these types in the BLKID_FLTR_ONLYIN filter, blkid reports
"No type detected" for encrypted and swap partitions, causing
image policy checks to fail (e.g. "encrypted was required") and
mount operations to fail with "File system type not supported".

Note that verity types (DM_verity_hash, verity_hash_signature) do
not need to be added here because their fstype is assigned directly
during partition table parsing, not via blkid probing.

Follow-up for e33eb053fb.
2026-04-03 19:13:24 +02:00
Daan De Meyer 4ded480ea5 repart: Use --shrink with mkfs.btrfs to get a minimal filesystem
Avoids populating the filesystem twice similar to read-only
filesystems.
2026-04-03 19:12:46 +02:00
Luca Boccassi 4725767730 Fix build with -fno-semantic-interposition
Fixes https://github.com/systemd/systemd/issues/41494

Follow-up for 44cc82bfbf
2026-04-03 19:10:05 +02:00
Daan De Meyer 6a9888c4c6 vmspawn: add --cxl= option and memory hotplug support
Add --cxl=BOOL option to enable CXL (Compute Express Link) support in
the virtual machine. CXL is a high-speed interconnect standard that
allows CPUs to access memory attached to devices such as accelerators
and memory expanders, enabling flexible memory pooling and expansion
beyond what is physically installed on the motherboard. When enabled,
adds cxl=on to the QEMU machine configuration. Only supported on x86_64
and aarch64 architectures.

This is added for testing purposes and for feature parity with mkosi's
CXL= setting.

Extend --ram= to accept an optional maximum size for memory hotplug,
using the syntax --ram=SIZE[:MAXSIZE] (e.g. --ram=2G:8G). When a
maximum is specified, the maxmem key is added to the QEMU memory
configuration section to enable memory hotplug up to the given limit.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 16:31:42 +02:00
Zbigniew Jędrzejewski-Szmek b98d532a6c core: do not GC units that have FDs stored (#41435)
If a unit has FileDescriptorStorePreserve=yes we'll keep its FDs around
in case it starts again. But if there are no reverse dependencies
referencing it, we'll also GC it and lose all the FDs, which defeats the
point of the setting (which is opt-in).

Do not GC units that have FDs stored to avoid this.

Follow-up for b9c1883a9c
2026-04-03 14:30:07 +02:00
Clayton Craft d3d142e5fd updatectl: fix unexpected polkit prompt on update
When running `updatectl update` since f0b2ea63, Install() was called
with the version resolved by Acquire() rather than the originally
requested (empty) version, causing the stricter update-to-version polkit
action to be used instead of the update polkit action.
2026-04-03 14:26:17 +02:00