Commit Graph
89987 Commits
Author SHA1 Message Date
Luca Boccassi 32a162dbb9 core: add method to enqueue multiple jobs in a single call (#42182)
Currently only a single job for a single unit can be enqueued
atomically,
so there is no guarantee that, e.g., starting a unit and its socket
at the same time will happen in the same transaction. That forces
callers to 'know' the right order in which to start new units being
installed, or failures will occur. It also means some ordering
constraints are ignored, in case the separate calls are done
in the wrong manual order.

Add a new EnqueueUnitJobMany() D-Bus method that takes a list of units
to start.
2026-06-22 21:35:17 +01:00
Luca Boccassi 7034441827 test: add coverage for multi-unit transactions
Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-22 21:19:16 +01:00
Luca Boccassi e2e0d610ba portablectl: use new EnqueueUnitJobMany() when available 2026-06-22 21:19:16 +01:00
Luca Boccassi 8b25e0f85e systemctl: use new EnqueueUnitJobMany() when available
Fixes https://github.com/systemd/systemd/issues/7877
Replaces https://github.com/systemd/systemd/pull/7947
2026-06-22 21:19:16 +01:00
dongshengyuan 294458fd00 homed: fix min_free tracking in manager_rebalance_calculate()
min_free is supposed to track the minimum free space across all home
directories to scale the next rebalance interval. However, it was
incorrectly assigned h->rebalance_size (the home's current total
allocation) instead of new_free (the remaining allocatable space).

This caused the rebalance interval to be computed from allocation sizes
rather than free space, so a nearly-full home would not trigger the
shorter intervals it should, delaying response to low-space conditions.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
2026-06-22 22:06:05 +02:00
Lennart Poettering 33bb855f3a repart: Sort the partition list by partition offset (#42488)
Currently the partition list is ordered like this: First come the
partitions that exist as definition files (could be pre-existing
partitions or could be new ones), then come the pre-existing partitions
that aren't matched to a definition file.

This ordering is visible to the user when we print our partition table,
and it doesn't really make sense from a UX perspective: Partition tables
are usually either presented in order of the partition indices, or in
order of the partition offsets. Arguably the latter would be nicer here,
since the visualization below is already ordered by physical offsets.

So reorder the list after we assigned the new partitions to their
respective free areas, according to the physical offset (or, for
partitions to newly create, the order that we will allocate them in).

Another potential upside of this is that we could rely on the partition
order in the code now more, too.

To ensure it keeps working, also add a test in the integration tests for
it.

Screenshot before:
<img width="2853" height="686" alt="Screenshot From 2026-06-05 00-58-07"
src="https://github.com/user-attachments/assets/7f24b527-7d79-49c4-916b-52faa892d4eb"
/>

Screenshot after:

<img width="2853" height="686" alt="Screenshot From 2026-06-05 00-58-16"
src="https://github.com/user-attachments/assets/4505ec5e-cab4-4ac1-95f0-b5af3991509e"
/>
2026-06-22 22:05:37 +02:00
dongshengyuan 7020bd3d82 oci-util: fix and harden oci_registry_is_valid()
- Pass colon+1 (port string) instead of s (hostname) to safe_atou16,
  so host:port registries are no longer always rejected.
- Switch to safe_atou16_full() with base-10 and strict flags to reject
  non-decimal port forms (hex, octal, leading whitespace, sign prefix)
  that would produce malformed URL authorities.
- Reject empty host explicitly via isempty() guard (covers both NULL
  and empty-string input), and guard colon == n to reject ':port' form,
  since dns_name_is_valid('') == 1 (DNS root) would otherwise accept
  empty host as valid.
- Wrap overlong line to fit 109-column limit.
- Add test coverage for oci_registry_is_valid().

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
2026-06-22 21:59:15 +02:00
Gabriel 983f8610b7 Add handling for '-1' when parsing vsock CID (#42654)
Currently `systemd-ssh-generator` supports
`systemd.ssh_listen=vsock::22` and aliases the "empty CID" towards
`VMADDR_CID_ANY`. VMADDR_CID_ANY is -1, so it's confusing from a user
experience that `systemd.ssh_listen=vsock:-1:22` isn't supported.
2026-06-22 21:57:03 +02:00
Luca Boccassi 4729d4514b Translations update from Fedora Weblate (#42699)
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-06-22 19:22:37 +01:00
Fedora Weblate user 1831 413cbc99f3 po: Translated using Weblate (Romanian)
Currently translated at 74.4% (213 of 286 strings)

Co-authored-by: Fedora Weblate user 1831 <atony076@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ro/
Translation: systemd/main
2026-06-22 17:44:40 +00:00
김인수 47cbfc8258 po: Translated using Weblate (Korean)
Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ko/
Translation: systemd/main
2026-06-22 17:44:39 +00:00
Zbigniew Jędrzejewski-Szmek 0c6186695a manager: make systemd+executor a multicall binary
Allow systemd-executor to be compiled into a single binary.
The existing -Dlink-executor-shared=true|false is extended to also
allow -Dlink-executor-shared=single (*). The new mode is opt-in,
to allow experimentation and introduce this smoothly.

This saves a little space, but not as much as I expected:
$ ls -l build/{systemd,systemd-executor} build-new/systemd
-rwxr-xr-x 1 zbyszek zbyszek  631520 May 25 22:44 build/systemd
-rwxr-xr-x 1 zbyszek zbyszek  670464 May 25 22:44 build/systemd-executor
-rwxr-xr-x 1 zbyszek zbyszek 1214488 May 25 22:45 build-new/systemd
(This is with -Dbuildtype=debugoptimized -Db_lto=true).
The combined binary is slightly smaller than the sum of the separate
ones, but not much. In both cases, the binaries are linked to
libsystemd-core which is 10MB, so the size of the binaries themselves
doesn't make much of a difference. The executor needs exec-invoke.c
which is huge and not shared with anything else.

Longer term, I want to allow systemd to be linked statically. In
that case, having systemd-executor separate would be very painful.
So the option to use a multicall binary will be necessary.

Previously, we stored the resolved path to systemd-executor and
used it argv[0]. I don't think this was useful. After all, normally
we would use the non-resolved original path as argv[0]. So that
part is dropped, and the resolved path is only logged, but
"systemd-executor" is always used as argv[0]. This makes the
multicall binary work reliably, no matter what the actual file
name is.

(*) This means that compat as the commandline level is maintained:
'meson setup build -Dlink-executor-shared=true …' works as before.
Unfortunately, when using an existing build directory, meson chokes
on the type change and refuses to reconfigure the directory or change
the option or do anything useful. I think meson is DTWT here, but
this is hard to fix. So the build directory probably needs to be
recreated.
2026-06-22 17:19:54 +02:00
Lennart Poettering 710d5aebbb sysupdate: keep database of installed files/patterns, and use to GC them (#42646)
Transfer files might come and go, components might be enabled and
disabled. Patterns might change. Let's keep track of what we install, so
that we can automatically gc everything no longer owned by any enabled
transfer.
2026-06-22 17:19:46 +02:00
Luca Boccassi 4dc1e31ce8 machine-tags: extend syntax to support key/value pairs (#42618)
This is a minor extension, to move the machine tags concept more closely
towards what higher-level solutions support for tagging machines, such
as kubernetes, simply to reduce the conceptual impedance mismatch.
2026-06-22 14:47:20 +01:00
Luca Boccassi 6e0c73b6f6 resolved: load libcrypto/libssl lazily on first use and make them optional (#42681)
Currently they are marked as required, as resolved aborts on startup if
dns-over-tls is built in, even if it is not enabled in the config.
Change initialization to be done lazily on first use, so that if the
config is not enabled, it never runs, and the libraries are never
dlopened, so they can be downgraded to recommends.
2026-06-22 14:15:39 +01:00
Luca Boccassi 01c0aa8061 Expand specifiers in MakeSymlinks= target in repart.d (#42694)
Closes #42693. Specifiers are now expanded in symlink targets
(previously, they were only expanded in the source) - this is
technically a breaking change, but I'd be very surprised if anyone was
relying on this.

No other simplification is applied to the target (unlike the source,
which goes through `path_simplify_and_warn`).

Also a few minor changes:

- rename local `path` variable to `source` to match documentation
convention
- document that `MakeSymlinks=` accepts specifiers
- fix error message to print `MakeSymlinks=` option instead of
`Subvolumes=`
2026-06-22 14:08:21 +01:00
Luca Boccassi ee7c04873e systemctl: add --kernel-cmdline-reuse option
kexec-tools has a --reuse-cmdline option which is very convenient
when doing a lot of reboots, add the same to systemctl.
Dedup options, letting the last one wins in case of duplicates,
so that 'systemctl kexec --reuse-cmdline' can be chained many times
without continuosly expanding the cmdline with duplicates from
the boot entry.
2026-06-22 14:02:52 +01:00
Lennart Poettering 5efc3f5f13 ci: add test-case for new cleanup logic 2026-06-22 14:45:18 +02:00
Lennart Poettering 7201ca4e12 sysupdate: port to new help-util.[ch] apis
As usual for stuff we touch, let's modernize the --help texts to our new
APIs.
2026-06-22 14:44:51 +02:00
Lennart Poettering d82e256bb9 sysupdate: introduce "installdb" that keeps track of installed resources
Let's make sure we keep track of any file we drop into the system via a
database in /var/. This database is implemented based on symlinks, i.e.
reuses the fs as a simple database. Given the database most likely will
have <= 10 entries only (as we store *patterns* of installed file paths in
them, not the file paths themselves), this should be very efficient.

For implementation details see comments at top of
src/sysupdate/sysupdate-cleanup.c.
2026-06-22 14:44:51 +02:00
Lennart Poettering 39ff56374c sysupdate: some smaller clean-ups
Nothing earth shattering, just some minor tweaks.
2026-06-22 14:42:30 +02:00
Lennart Poettering 180893f9d7 sysupdate: split out component validation/enumeration into sysupdate-util.[ch]
Just some refactoring.

The code is slightly updated, for example it now uses string_is_safe().
But mostly this just splits out code from one large file to a smaller
one.
2026-06-22 14:42:08 +02:00
Lennart Poettering dbd35fdc81 string-util: introduce STRING_FILENAME_PART flag for string_is_safe()
Whenever we are validating a string that shall appear in a filename
eventually we want to use filename_part_is_valid() rather than file
filename_is_valid(). Let's add explicit support for that to
string_is_safe(), since it's actually a really common case.
2026-06-22 14:41:16 +02:00
Lennart Poettering 90d285ade7 recurse-dir: optionally, only enumerate dentries of a specific type
At various places we filter directory enumerations by inode type. Let's
add explicit support for that, so that the "struct dirent" array we
return already suppresses them.

This shortens code and makes things more robust.
2026-06-22 14:40:16 +02:00
Lennart Poettering fe83c5be7f sha256: add sha256_direct_hex() helper
A various places we need a SHA256SUM of something as a string. Let's add
a simple helper for this that does this generically.
2026-06-22 14:39:50 +02:00
Luca BoccassiandMichal Koutný 7d3b32daef core: add method to enqueue multiple jobs in a single call
Currently only a single job for a single unit can be enqueued atomically,
so there is no guarantee that, e.g., starting a unit and its socket
at the same time will happen in the same transaction. That forces
callers to 'know' the right order in which to start new units being
installed, or failures will occur. It also means some ordering
constraints are ignored, in case the separate calls are done
in the wrong manual order.

Add a new EnqueueUnitJobMany() D-Bus method that takes a list of units
to start.

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

Co-authored-by: Michal Koutný <mkoutny@suse.com>
2026-06-22 13:01:17 +01:00
Luca Boccassi f8a1943758 btrfs-util,rm-rf: clean up subvolumes without user_subvol_rm_allowed
Without CAP_SYS_ADMIN and without the 'user_subvol_rm_allowed' mount
option, BTRFS_IOC_SNAP_DESTROY is rejected with EPERM (or EROFS for a
read-only subvolume), so rm_rf_subvolume() left subvolumes behind.
test-btrfs thus accumulated leftover subvolumes in /var/tmp on every
unprivileged run on a btrfs filesystem.

An unprivileged owner can however clear the RDONLY flag, empty a
subvolume and rmdir() it. So clear the RDONLY flag on EPERM/EACCES too
(not just EROFS) to leave the subvolume writable, and let rm_rf() fall
through on EPERM/EACCES to empty the subvolume recursively and rmdir()
it, matching what rm_rf_at() already did.

Fixes https://github.com/systemd/systemd/issues/42674
2026-06-22 12:33:18 +01:00
Luca Boccassi 454591065c report-basic, networkd: add Version, KernelTimestamp, Address metrics (#42315)
This PR adds some more useful metrics:
- io.systemd.Network.Address
- io.systemd.Basic.KernelTimestamp.{Realtime,Monotonic}
- io.systemd.Basic.Version
2026-06-22 11:54:38 +01:00
Luca Boccassi f38a53410d ssl-util: support OpenSSL 4 (#42676)
OpenSSL 4 broke ABI, so we need to look for both SONAMEs.

Follow-up for
https://github.com/systemd/systemd/commit/ccdd42351f79cbb9c2e034a96280a1ded40a2f95

Fixes https://github.com/systemd/systemd/issues/42675
2026-06-22 11:49:18 +01:00
dongshengyuan 5e39866868 resolve: fix transaction leak in dns_transaction_new() error path
hashmap_replace() failure left t in s->manager->dns_transactions with
t->scope still NULL, causing the destructor to skip hashmap_remove().
Add the missing cleanup mirroring the earlier error path in the same
function.

Signed-off-by: dongshengyuan <dongshengyuan@uniontech.com>
2026-06-22 11:21:47 +01:00
Luca Boccassi c8c83bde01 resolved: load libcrypto/libssl lazily on first use and make them optional
Currently they are marked as required, as resolved aborts on startup if
dns-over-tls is built in, even if it is not enabled in the config.
Change initialization to be done lazily on first use, so that if the
config is not enabled, it never runs, and the libraries are never
dlopened, so they can be downgraded to recommends.
2026-06-22 10:56:10 +01:00
Luca Boccassi 34f71b81b6 ssl-util: add cleanup helper for SSL_CTX 2026-06-22 10:54:49 +01:00
Luca Boccassi 8ff1bdf827 journal: add catalog message for missing dlopen dep 2026-06-22 10:54:49 +01:00
Luca Boccassi a8e5746ef3 log: add log_struct_once macro
Combines log_once and log_struct
2026-06-22 10:54:49 +01:00
Daan De Meyer 6b158b72f5 tree-wide: Beef up openssl logging
Let's translate openssl's errors to proper errnos 
where we can instead of returning EIO for everything.
Let's also make log_openssl_errors() public so we can
use it everywhere and migrate the rest of the codebase
to use it.
2026-06-22 11:40:57 +02:00
Lennart Poettering d5d3fbce10 repart: make vfat creation reproducible (#42446)
Two fixes to get this byte-stable:

- `fd_copy_directory()` was using `FOREACH_DIRENT_ALL`, which doesn't
give stable ordering. Read all paths, sort, then iterate.
- `mcopy -s` depends on `readdir()` ordering and thus isn't
reproducible. Implement the recursion/sorting here and only invoke
mcopy/mmd per dir.

First change increases memory usage, as we don't stream the paths
anymore, second increases the number of context switches when invoking
external tools. Both should be fine given the ESP content should usually
be pretty limited.

I'd like to write a test for this, but didn't come up with a way that
doesn't require privileges and would surface the error reliably.
2026-06-22 11:40:27 +02:00
Chris Coulson 93e9c2c974 shared/tpm2: support chunked reads of NV indexes
The TPM2_NV_Read commands returns the requested data in a
TPM2B_MAX_NV_BUFFER type, the maximum size of which is TPM-specific and
can be determined by querying the value of the TPM_PT_NV_BUFFER_MAX
property.

The value of this may be smaller than the payload size of some NV
indexes, particularly when that payload is a X509 certificate with a RSA
public key. Eg, the manufacturer supplied RSA EK certificate on my own
machine has a size of 1035 bytes, and the value of TPM_PT_NV_BUFFER_MAX
is 1024.

To handle this case and make it possible to read any EK certificate from
the TPM, make tpm2_read_nv_index support chunked reads when the payload
size is larger than what the TPM can return in a single command.
2026-06-22 11:30:09 +02:00
Luca Boccassi 7be9032019 ssl-util: prefer OpenSSL 4
For the next version we can switch to preferring the new version
2026-06-22 09:54:09 +01:00
Luca Boccassi 6caa50183e ssl-util: support OpenSSL 4
OpenSSL 4 broke ABI, so we need to look for both SONAMEs.
Try libssl.so.3 first, and fallback to libssl.so.4,
so that the older and more stable version is used if both
are installed, giving distros time to fix regressions.

Follow-up for ccdd42351f

Fixes https://github.com/systemd/systemd/issues/42675
2026-06-22 09:54:09 +01:00
Lennart Poettering 7a4436ea32 core: create abstraction/more properties for the "Exec" part of Unit.StartTransient (#42360)
This is a bit of an RFC (but I hope I got it mostly right), @daandemeyer
suggested in
https://github.com/systemd/systemd/pull/42161#pullrequestreview-4336323314
to improve the abstractions around the Exec= in
io.systemd.Unit.StartTransient as we will add a bunch more of those. So
this PR adds first a better abstraction and then uses it. See the
individual commits for details.
2026-06-22 10:39:42 +02:00
Kai Wohlfahrt 9028d3a778 Add NEWS entry
This is a breaking change, even if it is unlikely that anyone is relying
on it.
2026-06-22 10:39:36 +02:00
Kai Wohlfahrt 7efb51b0e1 repart: expand specifiers in MakeSymlinks= target
Previously, they were only expanded in the source part of the arguments.
No other validation is applied to the target component.
2026-06-22 10:24:26 +02:00
Jonas Dreßler 9c57f703d2 repart: Sort the partition list by partition offset
Currently the partition list is ordered like this: First come the partitions that
exist as definition files (could be pre-existing partitions or could be new ones),
then come the pre-existing partitions that aren't matched to a definition file.

This ordering is visible to the user when we print our partition table, and it
doesn't really make sense from a UX perspective: Partition tables are usually
either presented in order of the partition indices, or in order of the partition
offsets. Arguably the latter would be nicer here, since the visualization below
is already ordered by physical offsets.

So reorder the list after we assigned the new partitions to their respective free
areas, according to the physical offset (or, for partitions to newly create, the
order that we will allocate them in).

Another potential upside of this is that we could rely on the partition order in
the code now more, too.

To ensure it keeps working, also add a test in the integration tests for it.
2026-06-22 00:26:14 +01:00
Jonas Dreßler cc74f8bf36 repart: Always print underline in the last row of the partition table
Claude found a small bug with the partition table we print: We filter out
partitions with p->dropped while making the table, but we want to put an
underline after the last row of the table. In the case where the last entry
in the context->partitions list is a dropped partition, the check for
!p->partitions_next returns FALSE when it actually *is* the last row in the
table.

So move to a check that's based on a pre-counted number of partitions to
print rather than checking for !p->partitions_next.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 00:26:14 +01:00
Michael Vogt 54fd64db20 core: add _parameters_init for the Unit.StartTransient dispatch
This commit extracts the initialization of the transient parameters
for io.systemd.Unit.StartTransient into a set of helpers that follow
the _parameters_init() pattern. This way the code is more uniform
and easier to extend and less fragile. It also means there is a
single (logical) place to init the fields.
2026-06-21 20:47:17 +02:00
Michael Vogt cc348856de core: add more settable properties to varlink Unit.StartTransient()
This commit uses the abstractions added in the previous commit to
add a bunch more properties to the io.systemd.StartTransient()
to showcase how straightforward this is now.

New helpers for tristate bools and an init helper are added. A
dedicated dispatcher for LogLevelMax parses the string-form name
("info", "debug" etc.) declared in the varlink IDL.

The new properties are: DynamicUser, IgnoreSIGPIPE, LockPersonality,
MemoryDenyWriteExecute, NoNewPrivileges, OOMScoreAdjust, RemoveIPC,
RestrictRealtime, RestrictSUIDSGID, RootEphemeral, UMask.

The remaining ProtectKernel*, Private*, ProtectClock properties are
declared as STRING in the varlink IDL (matching the modern *Ex/enum
form) so a bool dispatcher does not pass schema validation. Those
need a string-parsing dispatcher and will be added in a follow-up.

This brings us closer to parity with the D-Bus code (still a long
way to go though).
2026-06-21 20:47:17 +02:00
Michael Vogt 4f0b27922f core: create abstraction for the "Exec" part of Unit.StartTransient
The handling of the `Exec` parameters for the varlink
`io.systemd.Unit.StartTransient()` became a bit unwieldy. So
this commit creates another abstraction to handle the various
fields in the `Exec` part of the StartTransient code.

Each Exec property is now described by a single TransientExecProperty
entry and adding a new property is just a single entry there plus
an apply function.

Thanks to Ivan Kruglov for many useful suggestions.
2026-06-21 20:17:51 +02:00
Skye Soss a4f7c9589e tmpfiles: add %D specifier resolution
systemd-tmpfiles now resolves the %D specifier to /usr/share
(for the system manager) or $XDG_DATA_HOME (for the user manager).

Closes: https://github.com/systemd/systemd/issues/42010
Signed-off-by: Skye Soss <skye@soss.website>
2026-06-21 18:20:53 +01:00
Luca Boccassi 1a8a470048 Translations update from Fedora Weblate (#42682)
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-06-21 13:18:04 +01:00
Martin Srebotnjak 00f941b616 po: Translated using Weblate (Slovenian)
Currently translated at 100.0% (286 of 286 strings)

Co-authored-by: Martin Srebotnjak <miles@filmsi.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sl/
Translation: systemd/main
2026-06-21 11:10:29 +00:00