]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 days agoacl-util: fall back to fchmod() if libacl is not around, too 39637/head
Mike Yuan [Sat, 8 Nov 2025 05:01:57 +0000 (06:01 +0100)] 
acl-util: fall back to fchmod() if libacl is not around, too

7 days agoacl-util: drop now unused fd_acl_make_writable()
Mike Yuan [Sat, 8 Nov 2025 03:27:17 +0000 (04:27 +0100)] 
acl-util: drop now unused fd_acl_make_writable()

7 days agocore/exec-credential: remove no longer needed per-cred atomic update logic
Mike Yuan [Sat, 8 Nov 2025 02:20:13 +0000 (03:20 +0100)] 
core/exec-credential: remove no longer needed per-cred atomic update logic

Now that we guarantee at higher level that we work on unique
credential dir, this becomes unnecessary.

7 days agocore/exec-credential: work around tmpfs reconfigure bug
Mike Yuan [Sat, 8 Nov 2025 19:26:31 +0000 (20:26 +0100)] 
core/exec-credential: work around tmpfs reconfigure bug

7 days agocore/exec-credential: port to new mount API, ensure atomicity for creds installation
Mike Yuan [Fri, 7 Nov 2025 20:53:02 +0000 (21:53 +0100)] 
core/exec-credential: port to new mount API, ensure atomicity for creds installation

This allows us to kill a great deal of complexity imposed
by the mountns and workspace reuse.

7 days agomount-util: introduce fsmount_credentials_fs()
Mike Yuan [Fri, 7 Nov 2025 22:06:03 +0000 (23:06 +0100)] 
mount-util: introduce fsmount_credentials_fs()

While at it, remove effectively unused size and ro params.

7 days agocreds-util: use U64_* macros where appropriate
Mike Yuan [Sat, 8 Nov 2025 05:39:43 +0000 (06:39 +0100)] 
creds-util: use U64_* macros where appropriate

7 days agocore/exec-credential: do not pass CGroupContext deep down the stack
Mike Yuan [Fri, 7 Nov 2025 20:49:38 +0000 (21:49 +0100)] 
core/exec-credential: do not pass CGroupContext deep down the stack

The repetitive re-evaluation of device_nodes_restricted() is wasteful.
Just pre-determine whether we need to always go by IPC and store it
in a bool.

7 days agotest: ignore EC from the second `systemctl status -a` as well
Frantisek Sumsal [Mon, 10 Nov 2025 18:26:43 +0000 (19:26 +0100)] 
test: ignore EC from the second `systemctl status -a` as well

There is a TOCTOU in the `systemctl status` where a unit might change
its state during the initial ListUnitsByPatterns call and the subsequent
individual GetAll calls, which then makes the systemctl call fail even
if the unit that was originally pulled in was active/running:

[ 1922.040463] TEST-26-SYSTEMCTL.sh[117]: + systemctl status -a --state active,running,plugged
[ 1922.051423] systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=ListUnitsByPatterns  cookie=1 reply_cookie=0 signature=asas error-name=n/a error-message=n/a
[ 1922.052501] systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=a(ssssssouso) error-name=n/a error-message=n/a
[ 1922.052650] systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/_2d_2emount interface=org.freedesktop.DBus.Properties member=GetAll  cookie=2 reply_cookie=0 signature=s error-name=n/a error-message=n/a
...
[ 1922.222061] systemd-hostnamed[424]: Idle for 30s, exiting.
...
[ 1922.224961] systemd[1]: systemd-hostnamed.service: Got notification message from PID 424: STOPPING=1, STATUS=Shutting down...
[ 1922.224983] systemd[1]: systemd-hostnamed.service: Changed running ->stop-sigterm
...
[ 1922.228984] systemd[1]: Got message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1/unit/systemd_2dhostnamed_2eservice interface=org.freedesktop.DBus.Properties member=GetAll  cookie=41 reply_cookie=0 signature=s error-name=n/a error-message=n/a
[ 1922.234402] systemd[1]: Sent message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a cookie=43 reply_cookie=41 signature=a{sv} error-name=n/a error-message=n/a

Since in this case we care mostly about the code paths the command
triggers, ignore its exit code as we do for the previous one.

Resolves: #39612

7 days agosystemd-analyze shell completion improvements (#39673)
Luca Boccassi [Mon, 10 Nov 2025 20:06:09 +0000 (20:06 +0000)] 
systemd-analyze shell completion improvements (#39673)

7 days agoshell-completion: zsh: add completion for systemd-analyze inspect-elf 39673/head
Jelle van der Waa [Mon, 10 Nov 2025 18:34:46 +0000 (19:34 +0100)] 
shell-completion: zsh: add completion for systemd-analyze inspect-elf

7 days agoshell-completion: bash: add systemd-analyze image-policy completion
Jelle van der Waa [Mon, 10 Nov 2025 18:23:21 +0000 (19:23 +0100)] 
shell-completion: bash: add systemd-analyze image-policy completion

7 days agoshell-completion: zsh: add missing completions for systemd-analyze
Jelle van der Waa [Mon, 10 Nov 2025 16:21:11 +0000 (17:21 +0100)] 
shell-completion: zsh: add missing completions for systemd-analyze

Adds missing simple verbs which already exist in bash completion.

7 days agoshell-completion: zsh: add systemd-analyze architectures completion
Jelle van der Waa [Mon, 10 Nov 2025 16:05:31 +0000 (17:05 +0100)] 
shell-completion: zsh: add systemd-analyze architectures completion

7 days agotest: don't register short-living containers with machined
Frantisek Sumsal [Mon, 10 Nov 2025 16:42:06 +0000 (17:42 +0100)] 
test: don't register short-living containers with machined

As registering the container creates a scope which might not be cleaned
up completely before we run a next command in the same container,
causing intermittent test fails:

[   63.424739] TEST-13-NSPAWN.sh[4231]: + systemd-nspawn --directory=/var/lib/machines/TEST-13-NSPAWN.sanity.zH2 bash -xec '[[ $USER == root ]]'
[   63.427504] systemd-nspawn[4381]: ░ Spawning container TEST-13-NSPAWN.sanity.zH2 on /var/lib/machines/TEST-13-NSPAWN.sanity.zH2.
[   63.437154] systemd[1]: Started TEST-13-NSPAWN.sanity.zH2.scope - Container TEST-13-NSPAWN.sanity.zH2.
[   63.437765] systemd-machined[1164]: New machine TEST-13-NSPAWN.sanity.zH2.
[   63.440311] TEST-13-NSPAWN.sh[4381]: + [[ root == root ]]
[   63.442046] systemd[1]: TEST-13-NSPAWN.sanity.zH2.scope: Killed unit cgroup '/machine.slice/TEST-13-NSPAWN.sanity.zH2.scope' with SIGKILL on client request.
[   63.442583] systemd-nspawn[4381]: Container TEST-13-NSPAWN.sanity.zH2 exited successfully.
[   63.443073] systemd-machined[1164]: Machine TEST-13-NSPAWN.sanity.zH2 terminated.
[   63.448728] TEST-13-NSPAWN.sh[4231]: + systemd-nspawn --directory=/var/lib/machines/TEST-13-NSPAWN.sanity.zH2 --user=testuser bash -xec '[[ $USER == testuser ]]'
[   63.451209] systemd-nspawn[4385]: ░ Spawning container TEST-13-NSPAWN.sanity.zH2 on /var/lib/machines/TEST-13-NSPAWN.sanity.zH2.
[   63.455295] systemd-nspawn[4385]: Failed to allocate scope: Unit TEST-13-NSPAWN.sanity.zH2.scope was already loaded or has a fragment file.
[   63.456139] systemd[1]: TEST-13-NSPAWN.sanity.zH2.scope: Deactivated successfully.
[   63.461292] TEST-13-NSPAWN.sh[2839]: + at_exit

Since even systemd-nspawn's man page suggests not to register containers
with systemd-machined if they don't run a service manager, let's do just
that to mitigate the race.

Resolves: #39629

7 days agorules: add rule to generate unique symlinks for gpio devices
Gero Schwäricke [Fri, 7 Nov 2025 15:09:17 +0000 (16:09 +0100)] 
rules: add rule to generate unique symlinks for gpio devices

Regular generated paths make it hard to identify individual GPIO
devices. This is a challenge when using multiple USB-to-GPIO adapters
like Diolan DLN2.

The unique symlinks from this rule can be used, e.g., with gpiod tools.

7 days agoresolve: several follow-ups for json output (#39605)
Yu Watanabe [Mon, 10 Nov 2025 13:32:28 +0000 (22:32 +0900)] 
resolve: several follow-ups for json output (#39605)

Follow-ups for #38960.

7 days agotest-ndisc-rs: drop unused verbose flag and log in the debug level
Yu Watanabe [Mon, 10 Nov 2025 10:18:00 +0000 (19:18 +0900)] 
test-ndisc-rs: drop unused verbose flag and log in the debug level

7 days agotest: avoid service name collision
Yu Watanabe [Mon, 10 Nov 2025 10:01:32 +0000 (19:01 +0900)] 
test: avoid service name collision

The same service name was accidentally used for two invocations:
```
[ 1801.197993] H TEST-04-JOURNAL.sh[20563]: + assert_rc 0 journalctl -q -D /run/log/journal/e30adae55e664d328af442bf5df694c8/ -u test-23833.service --grep service=test-23833.service
[ 1801.198527] H TEST-04-JOURNAL.sh[20685]: + set +ex
[ 1801.222676] H TEST-04-JOURNAL.sh[20686]: Nov 10 03:18:51 H systemd[1]: test-23833.service: About to execute: /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync"
[ 1801.222676] H TEST-04-JOURNAL.sh[20686]: Nov 10 03:18:51 H systemd[1]: Started test-23833.service - [systemd-run] /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync".
[ 1801.222676] H TEST-04-JOURNAL.sh[20686]: Nov 10 03:18:51 H (bash)[20681]: test-23833.service: Executing: /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync"
[ 1801.222676] H TEST-04-JOURNAL.sh[20686]: Nov 10 03:18:51 H bash[20681]: service=test-23833.service invocation=1866f15e95924a688dcecde72bf345f6
[ 1801.227878] H TEST-04-JOURNAL.sh[20563]: + assert_rc 1 journalctl -q -D /var/log/journal/e30adae55e664d328af442bf5df694c8/ -u test-23833.service --grep service=test-23833.service
[ 1801.228265] H TEST-04-JOURNAL.sh[20689]: + set +ex
[ 1801.253412] H TEST-04-JOURNAL.sh[20690]: Nov 10 03:18:49 H systemd[1]: test-23833.service: About to execute: /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync"
[ 1801.253412] H TEST-04-JOURNAL.sh[20690]: Nov 10 03:18:49 H systemd[1]: Started test-23833.service - [systemd-run] /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync".
[ 1801.253412] H TEST-04-JOURNAL.sh[20690]: Nov 10 03:18:49 H (bash)[20581]: test-23833.service: Executing: /usr/bin/bash -c "echo service=test-23833.service invocation=\$INVOCATION_ID; journalctl --sync"
[ 1801.253412] H TEST-04-JOURNAL.sh[20690]: Nov 10 03:18:49 H bash[20581]: service=test-23833.service invocation=a3089a62b5624d21bac0a75a3995d8b5
[ 1801.258158] H TEST-04-JOURNAL.sh[20692]: FAIL: expected: '1' actual: '0'
```

7 days agovarious: assorted cleanups for safe_fork (#39661)
Yu Watanabe [Mon, 10 Nov 2025 09:40:16 +0000 (18:40 +0900)] 
various: assorted cleanups for safe_fork (#39661)

7 days agodissect: getenv_fstype() is unused when LIBBLKID support is disabled
Yu Watanabe [Mon, 10 Nov 2025 02:16:13 +0000 (11:16 +0900)] 
dissect: getenv_fstype() is unused when LIBBLKID support is disabled

Follow-up for aad0d11e7c6f1f7dcc7b00173140c74b8abf88cc.

8 days agoresolvectl: drop an empty line between function call and error handling 39605/head
Yu Watanabe [Thu, 6 Nov 2025 18:11:38 +0000 (03:11 +0900)] 
resolvectl: drop an empty line between function call and error handling

Follow-up for 0536b37629c163af268975fcc3017cad823b1e9b.

8 days agoresolvectl: use string table
Yu Watanabe [Thu, 6 Nov 2025 18:07:28 +0000 (03:07 +0900)] 
resolvectl: use string table

Follow-up for 0536b37629c163af268975fcc3017cad823b1e9b.

8 days agoresolvectl: rename STATUS_PRIVATE -> STATUS_DNS_OVER_TLS
Yu Watanabe [Thu, 6 Nov 2025 18:05:15 +0000 (03:05 +0900)] 
resolvectl: rename STATUS_PRIVATE -> STATUS_DNS_OVER_TLS

8 days agoresolve: do not dump cache entries when not necessary
Yu Watanabe [Thu, 6 Nov 2025 17:56:13 +0000 (02:56 +0900)] 
resolve: do not dump cache entries when not necessary

Follow-up for 306375c36804c5c85cd9b77b353f40edf116521d.

8 days agonotify: raise log level for safe_fork() 39661/head
Mike Yuan [Mon, 10 Nov 2025 02:02:47 +0000 (03:02 +0100)] 
notify: raise log level for safe_fork()

8 days agoresolve: use enum for several fields
Yu Watanabe [Thu, 6 Nov 2025 17:31:14 +0000 (02:31 +0900)] 
resolve: use enum for several fields

Unfortunately, we have already exposed dnssec with hyphen, so we cannot
change it as enum.

8 days agoresolve: drop unnecessary preparation of empty arrays
Yu Watanabe [Thu, 6 Nov 2025 16:27:48 +0000 (01:27 +0900)] 
resolve: drop unnecessary preparation of empty arrays

8 days agoresolve: use JSON_BUILD_PAIR_TRISTATE_NON_NULL for default_route
Yu Watanabe [Thu, 6 Nov 2025 16:21:56 +0000 (01:21 +0900)] 
resolve: use JSON_BUILD_PAIR_TRISTATE_NON_NULL for default_route

8 days agocore/namespace: hide the correct credentials tree when running in user scope (#39651) 39665/head
Yu Watanabe [Mon, 10 Nov 2025 02:01:16 +0000 (11:01 +0900)] 
core/namespace: hide the correct credentials tree when running in user scope (#39651)

8 days agopo: Update translation files
Hosted Weblate [Mon, 10 Nov 2025 01:31:00 +0000 (01:31 +0000)] 
po: Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/
Translation: systemd/main

8 days agonetwork: Typo fix configur*a*d
Dr. David Alan Gilbert [Sat, 8 Nov 2025 01:49:10 +0000 (01:49 +0000)] 
network: Typo fix configur*a*d

configurad->configured

8 days agohostname-setup: prefix helper process name with "sd-"
Mike Yuan [Mon, 10 Nov 2025 01:55:40 +0000 (02:55 +0100)] 
hostname-setup: prefix helper process name with "sd-"

8 days agooss-fuzz: install libcrypt-dev in i386 image
Yu Watanabe [Sun, 9 Nov 2025 21:40:20 +0000 (06:40 +0900)] 
oss-fuzz: install libcrypt-dev in i386 image

This is preparation for bumping base image of oss-fuzz to Ubuntu 24.04.

Closes #39395.

Co-authored-by: Evgeny Vereshchagin <evvers@ya.ru>
8 days agoprocess-util: prefix FORK_PID_ONLY with _ to signify it is internal
Mike Yuan [Mon, 10 Nov 2025 01:44:13 +0000 (02:44 +0100)] 
process-util: prefix FORK_PID_ONLY with _ to signify it is internal

8 days agotree-wide: add several missing includes
Yu Watanabe [Sun, 9 Nov 2025 21:21:59 +0000 (06:21 +0900)] 
tree-wide: add several missing includes

- test-reread-partition-table.c: sys/file.h for LOCK_EX
- coredump: unistd.h for STDIN_FILENO

8 days agoTEST-54-CREDS: add test case for credential dir masking 39651/head
Mike Yuan [Sun, 9 Nov 2025 17:22:26 +0000 (18:22 +0100)] 
TEST-54-CREDS: add test case for credential dir masking

8 days agorun: make sure we send out READY=1 when --wait
Mike Yuan [Sun, 9 Nov 2025 19:14:01 +0000 (20:14 +0100)] 
run: make sure we send out READY=1 when --wait

Let's skip bus_wait_for_jobs_one() when --wait as well,
as it surpasses the start job and allows for
run_context_check_started() to fire.

8 days agocore/namespace: hide the correct credentials tree when running in user scope
Mike Yuan [Sat, 8 Nov 2025 00:59:01 +0000 (01:59 +0100)] 
core/namespace: hide the correct credentials tree when running in user scope

8 days agoprofile: skip setting PS0 when PROMPT_COMMAND= is cleared
Yu Watanabe [Sun, 9 Nov 2025 18:31:32 +0000 (03:31 +0900)] 
profile: skip setting PS0 when PROMPT_COMMAND= is cleared

Fixes #39639.

8 days agoservice: setup credentials for ExecCondition
Maximilian Bosch [Sat, 8 Nov 2025 18:16:50 +0000 (19:16 +0100)] 
service: setup credentials for ExecCondition

Closes #35788

This gives access to credentials within ExecCondition=. As described in
ticket #35788, I do have a use-case for this and as noted in the
commit that dropped this[1], this is OK to be revisited if there are
use-cases.

[1] a145623bc403e410f41808a8e5cb31d29a52567c

8 days agocore/import-creds: trivial modernizations (#39652)
Yu Watanabe [Sun, 9 Nov 2025 20:26:37 +0000 (05:26 +0900)] 
core/import-creds: trivial modernizations (#39652)

8 days agolabeler: catch up with recent changes (#39653)
Mike Yuan [Sun, 9 Nov 2025 19:25:45 +0000 (20:25 +0100)] 
labeler: catch up with recent changes (#39653)

8 days agolabaler: add "shell profile" 39653/head
Mike Yuan [Sun, 9 Nov 2025 17:57:20 +0000 (18:57 +0100)] 
labaler: add "shell profile"

8 days agolabeler: match per-user machined units too
Mike Yuan [Sun, 9 Nov 2025 17:57:01 +0000 (18:57 +0100)] 
labeler: match per-user machined units too

8 days agolabeler: be more specific when matching for "import"
Mike Yuan [Sun, 9 Nov 2025 17:56:15 +0000 (18:56 +0100)] 
labeler: be more specific when matching for "import"

8 days agocore/import-creds: use RET_GATHER 39652/head
Mike Yuan [Wed, 11 Sep 2024 15:21:30 +0000 (17:21 +0200)] 
core/import-creds: use RET_GATHER

8 days agocore/import-creds: use FOREACH_ARRAY at one more place
Mike Yuan [Wed, 11 Sep 2024 15:20:50 +0000 (17:20 +0200)] 
core/import-creds: use FOREACH_ARRAY at one more place

8 days agocore/import-creds: rename import_credentials_context_free() to _done()
Mike Yuan [Wed, 11 Sep 2024 15:15:19 +0000 (17:15 +0200)] 
core/import-creds: rename import_credentials_context_free() to _done()

This is allocated on stack, hence rename as per our coding style.
While at it, make sure the struct name is consistent with funcs.

8 days agorepart: Correctly handle btrfs compression (#39597)
Yu Watanabe [Sun, 9 Nov 2025 16:52:19 +0000 (01:52 +0900)] 
repart: Correctly handle btrfs compression (#39597)

systemd-repart is incorrectly choosing the loop-mount
code path to copy files after formatting, instead of using the --rootdir
path, which is required by mkfs.btrfs to apply compression (since it's
on files, not the fs).

So two fixes (and an integ test):

1. If Btrfs compression is requested without a root directory (e.g.,
Compression= without CopyFiles=), we now log a warning and skip the
--compress flag. This prevents the mkfs.btrfs failure, and it's
meaningless anyway without any files.
2. The logic in repart now uses the --rootdir code path whenever the
partition is btrfs and compression is requested. Otherwise it still
won't work even in the legitimate case because use the loop mounting
code, which is too late to use --compress.

Fixes: https://github.com/systemd/systemd/issues/39584
8 days agotest: Add integration test for btrfs compression in repart 39597/head
Chris Down [Thu, 6 Nov 2025 15:36:19 +0000 (23:36 +0800)] 
test: Add integration test for btrfs compression in repart

Add testcase_btrfs_compression() to verify that btrfs partitions with
Compression= and CopyFiles= directives work correctly.

The test verifies the fix for issue #39584, where mkfs.btrfs would fail
with "ERROR: --compression must be used with --rootdir" when repart
tried to create compressed btrfs filesystems.

The test creates a partition definition with Format=btrfs,
Compression=zstd, and CopyFiles=, then validates:

1. systemd-repart output shows "Rootdir from:" and "Compress:",
   confirming that the --rootdir code path is used
2. mkfs.btrfs is invoked with both --compress and --rootdir options
3. The file is successfully copied to the filesystem
4. Compression is actually applied (verified via compsize output
   containing "zstd")

8 days agobpf-compat: coding style cleanups
Yu Watanabe [Sun, 9 Nov 2025 01:22:23 +0000 (10:22 +0900)] 
bpf-compat: coding style cleanups

8 days agoreread-partition-table: fix error code check
Yu Watanabe [Sun, 9 Nov 2025 01:14:11 +0000 (10:14 +0900)] 
reread-partition-table: fix error code check

flock() sets EAGAIN rather than EBUSY when a node is already locked.

Follow-up for d8e38d4aaac23cb27cc7e0f410449c3a6034db4f.
Fixes #39544.

8 days agolibarchive-util: several cleanups
Yu Watanabe [Sat, 8 Nov 2025 23:44:25 +0000 (08:44 +0900)] 
libarchive-util: several cleanups

- use loop for checking existence of functions,
- rename HAVE_LIBARCHIVE_XYZ -> HAVE_ARCHIVE_XYZ to make them match with
  the function name,
- do not conditionally include user-util.h in libarchive-util.h,
- sort library function symbols.

8 days agomeson: several cleanups (#39644)
Yu Watanabe [Sun, 9 Nov 2025 09:05:22 +0000 (18:05 +0900)] 
meson: several cleanups (#39644)

9 days agomeson: refuse to build when gcrypt support is enabled bu libgpg-error not found 39644/head
Yu Watanabe [Sun, 9 Nov 2025 00:20:41 +0000 (09:20 +0900)] 
meson: refuse to build when gcrypt support is enabled bu libgpg-error not found

Follow-up for 066e603ac641e22b1827ce36c9d55311fa44be6e.

9 days agomeson: drop redundant HAVE_ZLIB check
Yu Watanabe [Sat, 8 Nov 2025 20:42:18 +0000 (05:42 +0900)] 
meson: drop redundant HAVE_ZLIB check

ENABLE_IMPORTD requires HAVE_ZLIB, and it is already checked at the very
beginning of the file.

9 days agoREADME: align features after 'for'
Yu Watanabe [Sat, 8 Nov 2025 19:53:46 +0000 (04:53 +0900)] 
README: align features after 'for'

9 days agoREADME: memory_hugetlb_accounting is since kernel v6.7
Yu Watanabe [Sat, 8 Nov 2025 19:52:14 +0000 (04:52 +0900)] 
README: memory_hugetlb_accounting is since kernel v6.7

https://github.com/torvalds/linux/commit/8cba9576df601c384abd334a503c3f6e1e29eefb

9 days agonsresource: allow multiple userns from the same process in parallel
Lennart Poettering [Thu, 6 Nov 2025 09:46:58 +0000 (10:46 +0100)] 
nsresource: allow multiple userns from the same process in parallel

When generating a name for a transient userns automatically we so far
just included our PID to make it unique. That doens't really work if
multiple userns shall be kept in parallel by a single process. Let's hence
include a counter as well.

9 days agoimport: various smaller tweaks and fixes, preparation for OCI download support in...
Lennart Poettering [Sat, 8 Nov 2025 17:31:11 +0000 (18:31 +0100)] 
import: various smaller tweaks and fixes, preparation for OCI download support in importd (#39620)

9 days agopull-job: port .payload field to struct iovec 39620/head
Lennart Poettering [Fri, 7 Nov 2025 12:52:38 +0000 (13:52 +0100)] 
pull-job: port .payload field to struct iovec

struct iovec is really how we should encode any form of arbitrary blob
data

9 days agopull-job: use http_status_etag_exists() at a second place
Lennart Poettering [Thu, 6 Nov 2025 08:32:22 +0000 (09:32 +0100)] 
pull-job: use http_status_etag_exists() at a second place

9 days agopull: there's no need to keep the downloaded image in memory, except for the sha256su...
Lennart Poettering [Wed, 5 Nov 2025 21:28:08 +0000 (22:28 +0100)] 
pull: there's no need to keep the downloaded image in memory, except for the sha256sums/gpg file

This seems to be a mistake, in place since the first commit: we only
want the downloaded data in memory if this is a sha256sums or gpg file,
which we need to prorcess ourselves.

9 days agopull: use ASSERT_PTR() to shorten code a tiny bit
Lennart Poettering [Wed, 5 Nov 2025 21:27:33 +0000 (22:27 +0100)] 
pull: use ASSERT_PTR() to shorten code a tiny bit

9 days agopull: now that PullJob can verify expected digests, let's rely on it for tar/raw...
Lennart Poettering [Wed, 5 Nov 2025 21:24:01 +0000 (22:24 +0100)] 
pull: now that PullJob can verify expected digests, let's rely on it for tar/raw pulling

Instead of authenticating the downloaded image explicity in the tar and
in the raw downloader, we can now rely on the checksum checking in the
generic PullJob code. Hence do so: drop tep the checksum field from
TarPull and RawPull, and just initialized the ->expected_checksum in the
relevant PullJob instead.

9 days agopull-job: optionally store an expected checksum in PullJob object
Lennart Poettering [Wed, 5 Nov 2025 16:45:09 +0000 (17:45 +0100)] 
pull-job: optionally store an expected checksum in PullJob object

9 days agoimport: rework pull logic to store download digests in binary form rather than string
Lennart Poettering [Wed, 5 Nov 2025 16:31:24 +0000 (17:31 +0100)] 
import: rework pull logic to store download digests in binary form rather than string

We generally want to store data in parsed form, not formatted form,
hence let's follow our own rules on this, and store the message digest
as "struct iovec" rather than as string. This is generally more
efficient and safer, simply because of case issues.

9 days agopull-job: optionally take expected content length and compare it with what we are...
Lennart Poettering [Wed, 5 Nov 2025 15:58:09 +0000 (16:58 +0100)] 
pull-job: optionally take expected content length and compare it with what we are downloading

9 days agopull-job: always implicitly NUL terminate downloaded payload stored in memory
Lennart Poettering [Wed, 5 Nov 2025 15:48:24 +0000 (16:48 +0100)] 
pull-job: always implicitly NUL terminate downloaded payload stored in memory

Just as a safety measure, let's always NUL terminate what we are
downloading, maybe future code will parse it as string, and is sloppy by
accident.

(We have similar logic in read_full_file(), and I think it's a really
good rule, to always implicitly NUL terminate blobs we acquire that
might very well be used as text later on)

10 days agomeson: drop dangling reference to gcrypt
Mike Yuan [Sat, 8 Nov 2025 01:09:59 +0000 (02:09 +0100)] 
meson: drop dangling reference to gcrypt

... which was also a typo ;)

Follow-up for e9d4b88b817b9711291d8734cffdd4faf94b584a

10 days agomeson: sysupdate requires systemd-pull and friends
Yu Watanabe [Fri, 7 Nov 2025 22:01:11 +0000 (07:01 +0900)] 
meson: sysupdate requires systemd-pull and friends

Fixes #39635.

10 days agocore/execute: morph exec_output_is_* to _forward_to_*
Mike Yuan [Fri, 7 Nov 2025 16:57:58 +0000 (17:57 +0100)] 
core/execute: morph exec_output_is_* to _forward_to_*

Follow-up for 379d9ae222c52f93692e06d5b33fb341791b9688

After the commit, the functions are only used to determine
whether journals shall be forwarded to selected targets,
hence rename as such and remove effectively unused condition
on EXEC_OUTPUT_TTY.

10 days agotest: rotate journal before invocation test
Luca Boccassi [Fri, 7 Nov 2025 20:12:47 +0000 (20:12 +0000)] 
test: rotate journal before invocation test

Occasionally there are truncated journals failing this test:

[  884.181701] H TEST-04-JOURNAL.sh[12104]: ++ journalctl --no-hostname -n 1 -t bash --invocation=fe8122a7d8eb42c7bf357ac5fafa95e1
[  884.181749] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1' 'Nov 06 17:27:10 bash[11985]: invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1'
[  884.181773] H TEST-04-JOURNAL.sh[12105]: + set +ex
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + read -r idx invocation _
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + i=2
[  884.181865] H TEST-04-JOURNAL.sh[12106]: ++ journalctl --no-hostname -n 1 -t bash --invocation=2 -u invocation-id-test-20992
[  884.181865] H TEST-04-JOURNAL.sh[12106]: Journal file /var/log/journal/936183a66e7c47939693ae37a967e4fd/system.journal is truncated, ignoring file.
[  884.181865] H TEST-04-JOURNAL.sh[12106]: No journal entry found for the invocation (+2).
[  884.181952] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 2 07d0bd6b5c654b148541d798abccaa96' ''
[  884.181972] H TEST-04-JOURNAL.sh[12107]: + set +ex
[  884.181972] H TEST-04-JOURNAL.sh[12107]: FAIL: 'invocation 2 07d0bd6b5c654b148541d798abccaa96' not found in:

Rotate it at the beginning of the test case to try and avoid this.

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

10 days agocore: assign TTY to PAM context when TTYPath= is specified
Yu Watanabe [Fri, 7 Nov 2025 16:03:12 +0000 (01:03 +0900)] 
core: assign TTY to PAM context when TTYPath= is specified

Fixes #38486 again, which was fixed by
1405d46bf998b5a4b6f572a14ac88890828a405d, but regressed again by
f875a8026ec2dfa6026da3ee216782e9f7c04a43.

This also make it use exec_input_is_terminal().

Follow-up for f875a8026ec2dfa6026da3ee216782e9f7c04a43.

10 days agotest: move the system time to exactly the timer's elapse time
Frantisek Sumsal [Fri, 7 Nov 2025 16:02:09 +0000 (17:02 +0100)] 
test: move the system time to exactly the timer's elapse time

When we moved the time to 1 minute after the timer would've elapsed,
systemd could pick RandomizedDelaySec= <= 1 minute which would then
cause the timer to elapse immediately and the InactiveExitTimestamp=
to get recalculated including a new next elapse time that would be for
the next "window":

systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 3.634672s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Fri 2025-11-07 00:10:03 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Timer elapsed.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed waiting -> running
systemd[1]: Found unit timer-RandomizedDelaySec-30785.timer at /run/systemd/system/timer-RandomizedDelaySec-30785.timer (regular file)
systemd[1]: Preset files say disable timer-RandomizedDelaySec-30785.timer.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Got notified about unit deactivation.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 8h 39min 26.166418s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Sat 2025-11-08 08:49:26 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed running -> waiting
...
TEST-53-TIMER.sh[1008]: InactiveExitTimestamp=Thu 2025-11-06 23:00:00 UTC
TEST-53-TIMER.sh[1010]: ++ systemctl show -P NextElapseUSecRealtime timer-RandomizedDelaySec-30785.timer
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME='Sat 2025-11-08 08:49:26 UTC'
TEST-53-TIMER.sh[1011]: ++ date '--date=Sat 2025-11-08 08:49:26 UTC' +%s
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME_S=1762591766
TEST-53-TIMER.sh[905]: + : 'Next elapse timestamp should be Fri 2025-11-07 00:10:00 UTC <= Sat 2025-11-08 08:49:26 UTC <= Fri 2025-11-07 22:10:00 UTC'
TEST-53-TIMER.sh[905]: + assert_ge 1762591766 1762474200
TEST-53-TIMER.sh[1012]: + set +ex
TEST-53-TIMER.sh[905]: + assert_le 1762591766 1762553400
TEST-53-TIMER.sh[1013]: + set +ex
TEST-53-TIMER.sh[1013]: FAIL: '1762591766' > '1762553400'

Technically, the race is still there, but the window for it should be
_much_ smaller now (< 1s on a reasonably fast system). Let's hope that's
enough.

Resolves: #39594

10 days agonetwork: fix typo
Yu Watanabe [Fri, 7 Nov 2025 19:27:42 +0000 (04:27 +0900)] 
network: fix typo

Follow-up for dd2934d44e2c9cd1a92ae0fd6806985c4bc031e6.

10 days agoNEWS: announce RootImageOptions= et al. incompatible changes
Luca Boccassi [Sat, 25 Oct 2025 19:15:53 +0000 (20:15 +0100)] 
NEWS: announce RootImageOptions= et al. incompatible changes

10 days agocore/exec-invoke: pass the correct pid (1) to processes in pidns (#39575)
Yu Watanabe [Fri, 7 Nov 2025 17:41:14 +0000 (02:41 +0900)] 
core/exec-invoke: pass the correct pid (1) to processes in pidns (#39575)

10 days agotar-util: make sure we can unpack hardlinked symlinks (#39619)
Yu Watanabe [Fri, 7 Nov 2025 15:08:44 +0000 (00:08 +0900)] 
tar-util: make sure we can unpack hardlinked symlinks (#39619)

10 days agonetwork: expose Describe Varlink, use for networkctl list & status
Anton Tiurin [Mon, 8 Sep 2025 19:31:23 +0000 (12:31 -0700)] 
network: expose Describe Varlink, use for networkctl list & status

Both `list` and `status` with `--json=pretty|short` show the description.
It is fetched via D-Bus by org.freedesktop.network1.Manager.Describe

This change exposes the same data via Varlink API `io.systemd.Network.Describe`
and migrates networkctl list and status commands to use Varlink API.

Update GetStates IDL to use enums for link states.

10 days agoFixes for the OSC prompt script (#39588)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Nov 2025 13:53:13 +0000 (14:53 +0100)] 
Fixes for the OSC prompt script (#39588)

10 days agoprofile/osc-context: move and extend check for TERM=dumb 39588/head
Zbigniew Jędrzejewski-Szmek [Thu, 6 Nov 2025 10:56:01 +0000 (11:56 +0100)] 
profile/osc-context: move and extend check for TERM=dumb

Let's do the check early and skip most of the file if appropriate. Also, treat
missing $TERM same as "dumb". We're almost certainly at a dump terminal in that
case.

10 days agomodules-load: implement parallel module loading
Francesco Valla [Sun, 27 Jul 2025 21:50:06 +0000 (23:50 +0200)] 
modules-load: implement parallel module loading

Load modules in parallel using a pool of worker threads. The number of
threads is equal to the number of CPUs, with a maximum of 16 (to avoid
too many threads being started during boot on systems with many an high
core count, since the number of modules loaded on boot is usually on
the small side).

The number of threads can optionally be specified manually using the
SYSTEMD_MODULES_LOAD_NUM_THREADS environment variable; in this case,
no limit is enforced. If SYSTEMD_MODULES_LOAD_NUM_THREADS is set to 0,
probing happens sequentially.

Co-authored-by: Eric Curtin <ecurtin@redhat.com>
10 days agopcrextend: fix wrong format in log
jouyouyun [Fri, 7 Nov 2025 08:32:40 +0000 (16:32 +0800)] 
pcrextend: fix wrong format in log

`name` is string type, should use `%s` replace `%u`

10 days agotar-util: make sure we can unpack hardlinked symlinks 39619/head
Lennart Poettering [Thu, 6 Nov 2025 09:47:26 +0000 (10:47 +0100)] 
tar-util: make sure we can unpack hardlinked symlinks

This is something ostree does. Yuck. But let's make t work.

10 days agochase: fix typo in log message
Lennart Poettering [Thu, 6 Nov 2025 08:31:58 +0000 (09:31 +0100)] 
chase: fix typo in log message

(While we are at it, add quotes around user provided strings)

10 days agorepart: Force --rootdir population for btrfs with compression
Chris Down [Thu, 6 Nov 2025 15:17:01 +0000 (23:17 +0800)] 
repart: Force --rootdir population for btrfs with compression

When a btrfs partition is configured with both Compression= and
CopyFiles=, we need to ensure files are copied during filesystem
creation using mkfs.btrfs --rootdir, rather than copying files
afterwards via loop device mounting.

This is required because mkfs.btrfs can only apply compression settings
when files are provided via --rootdir during filesystem creation. If we
format the filesystem first and then mount it to copy files, the
compression setting is meaningless.

Modify the partition_needs_populate() condition to force the --rootdir
code path when the format is btrfs and compression is requested.

This ensures that partition_populate_directory() runs and creates a
temporary directory with the files, which is then passed to
make_filesystem() as the root parameter, allowing mkfs.btrfs to create
the filesystem with compression applied.

Fixes: https://github.com/systemd/systemd/issues/39584
10 days agomkfs-util: Ignore btrfs compression when there is no dir to copy
Chris Down [Thu, 6 Nov 2025 15:11:55 +0000 (23:11 +0800)] 
mkfs-util: Ignore btrfs compression when there is no dir to copy

mkfs.btrfs requires that the --compress option be used together with
--rootdir, as compression only makes sense in that context (because
compression is not a persistent setting).

Right now, If --compress is specified without --rootdir, mkfs.btrfs
fails with:

  ERROR: --compression must be used with --rootdir

This can occur when repart is configured with Compression= but the
partition populate logic doesn't use the --rootdir code path (eg. when
using loop device mounting to copy files after mkfs).

Add a defensive check to skip compression and emit a user-friendly
warning when compression is requested but no root directory is
provided. The warning message references the repart directive names
(Compression= and CopyFiles=) rather than low-level mkfs options to
help users understand the requirement.

This prevents crashes but doesn't enable compression, that requires
ensuring the --rootdir code path is used, which it currently is not and
will be addressed in the next patch.

Fixes: https://github.com/systemd/systemd/issues/39584
11 days agoreread-partition-table: trigger change events when we failed to lock device
Yu Watanabe [Thu, 6 Nov 2025 15:35:34 +0000 (00:35 +0900)] 
reread-partition-table: trigger change events when we failed to lock device

Before aa47d8ade18cc4a079fef5a1aaa37d763507104e, when we failed to lock
the device node, we simply trigger change events for the device and its
partitions. But the commit killed the fallback logic. Let's restore that.

Fixes #39544.

11 days agologind: handle session leader termination during deserialization more gracefully...
Yu Watanabe [Fri, 7 Nov 2025 07:35:32 +0000 (16:35 +0900)] 
logind: handle session leader termination during deserialization more gracefully (#39607)

Closes https://github.com/systemd/systemd/issues/39556

11 days agoman: systemd-measure. Remove 'tpm2-pcrs=' from cryptenroll command (#39590)
cvlc12 [Thu, 6 Nov 2025 20:54:06 +0000 (21:54 +0100)] 
man: systemd-measure. Remove 'tpm2-pcrs=' from cryptenroll command (#39590)

This is now default since 4b840414be3b2d6520599d86d2b718a37574aabf.

11 days agoTwo fixes for homectl (#39591)
Yu Watanabe [Thu, 6 Nov 2025 20:52:20 +0000 (05:52 +0900)] 
Two fixes for homectl (#39591)

11 days agotest: ensure test checking status runs first
Luca Boccassi [Thu, 6 Nov 2025 17:13:16 +0000 (17:13 +0000)] 
test: ensure test checking status runs first

The test messes a bit with the ESP, which might cause bootctl status output to change.
Run the test that simply checks status without changing anything first.

[  188.633908] TEST-87-AUX-UTILS-VM.sh[1101]: + bootctl status --quiet
[  188.681082] TEST-87-AUX-UTILS-VM.sh[1155]: System:
[  188.681082] TEST-87-AUX-UTILS-VM.sh[1155]:       Firmware: UEFI 2.70 (EDK II 1.00)
[  188.681082] TEST-87-AUX-UTILS-VM.sh[1155]:  Firmware Arch: x64
[  188.681082] TEST-87-AUX-UTILS-VM.sh[1155]:    Secure Boot: enabled (user)
<...>
[  198.938717] TEST-87-AUX-UTILS-VM.sh[1679]: ++ printf '\6\0\0\0\1'
[  198.939235] TEST-87-AUX-UTILS-VM.sh[1678]: + cmp /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c /dev/fd/63
[  198.944957] TEST-87-AUX-UTILS-VM.sh[1678]: + cmp /sys/firmware/efi/efivars/SetupMode-8be4df61-93ca-11d2-aa0d-00e098032b8c /dev/fd/63
[  198.945808] TEST-87-AUX-UTILS-VM.sh[1681]: ++ printf '\6\0\0\0\0'
[  198.950459] TEST-87-AUX-UTILS-VM.sh[1684]: + bootctl status
[  198.951357] TEST-87-AUX-UTILS-VM.sh[1685]: + grep -q 'Secure Boot: enabled'
[  199.004142] TEST-87-AUX-UTILS-VM.sh[1086]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-87-AUX-UTILS-VM.bootctl.sh failed'

Follow-up for 5ae58ac2b93a4046fbae4e0c825b8cc9d03d10d8

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

11 days agoreread-part: fix error propagation
Luca Boccassi [Thu, 6 Nov 2025 18:04:40 +0000 (18:04 +0000)] 
reread-part: fix error propagation

[   49.514556] (udev-synth)[1385]: Assertion '(_error) != 0' failed at src/shared/reread-partition-table.c:260, function reread_partition_table_full(). Aborting.

Follow-up for 757887d01dd96125be1774f4b23b12f2fbda9a8b

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

11 days agonss-systemd: fix memory leak
jouyouyun [Thu, 6 Nov 2025 03:18:10 +0000 (11:18 +0800)] 
nss-systemd: fix memory leak

11 days agologind: handle session leader termination during deserialization more gracefully 39607/head
Mike Yuan [Tue, 4 Nov 2025 20:13:49 +0000 (21:13 +0100)] 
logind: handle session leader termination during deserialization more gracefully

We track session leaders by pidfd precisely to make restarts reliable,
as leader exiting before deserialization is somewhat expected.
Such case is already handled gracefully (we'd GC sessions without leader
before kicking off the new cycle), but let's also tweak the log message
a bit to reduce annoyance.

Closes #39556

11 days agologind: fix potential fd leak in deliver_session_leader_fd_consume()
Mike Yuan [Thu, 6 Nov 2025 18:31:18 +0000 (19:31 +0100)] 
logind: fix potential fd leak in deliver_session_leader_fd_consume()

Follow-up for 45eea629e3b3a640bf6a5cd13f4c73c86b426b11

11 days agotest: sync journal after the test unit finishes
Frantisek Sumsal [Thu, 6 Nov 2025 13:40:56 +0000 (14:40 +0100)] 
test: sync journal after the test unit finishes

In these two cases we need to sync the journal _after_ the unit finishes
as well, because we try to match messages from systemd itself, not
(only) from the unit, and the messages about units are dispatched
asynchronously.

That is, in the first case (silent-success.service) we want to make sure
that LogLevelMax= filters out messages _about_ units (from systemd) as
well, including messages like "Deactivated..."  and "Finished...", which
are sent out only when/after the unit is stopped.

In the second case we try to match messages with the "systemd" syslog
tag, but these messages come from systemd (obviously) and are sent out
asynchronously, which means they might not reach the journal before we
call `journalctl --sync` from the test unit itself, like happened here:

[ 1754.150391] TEST-04-JOURNAL.sh[13331]: + systemctl start verbose-success.service
[ 1754.172256] bash[13692]: success
[ 1754.221210] TEST-04-JOURNAL.sh[13694]: ++ journalctl -b -q -u verbose-success.service -t systemd
[ 1754.221493] TEST-04-JOURNAL.sh[13331]: + [[ -n '' ]]
[ 1754.175709] systemd[1]: Starting verbose-success.service - Verbose successful service...
[ 1754.221697] TEST-04-JOURNAL.sh[122]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-04-JOURNAL.journal.sh failed'
[ 1754.221697] TEST-04-JOURNAL.sh[122]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-04-JOURNAL.journal.sh failed
[ 1754.221697] TEST-04-JOURNAL.sh[122]: + return 1
[ 1754.205408] systemd[1]: verbose-success.service: Deactivated successfully.
[ 1754.205687] systemd[1]: Finished verbose-success.service - Verbose successful service.

By syncing the journal after the unit is stopped we have much bigger
chance that the systemd messages already reached the journal - the race
is technically still there, but the chance we'd hit it should be pretty
negligible.

Resolves: #39555

11 days agoresolvectl: add --json support for status commands (#38960)
Zbigniew Jędrzejewski-Szmek [Thu, 6 Nov 2025 14:34:10 +0000 (15:34 +0100)] 
resolvectl: add --json support for status commands (#38960)

Add --json support for all status commands in resolvectl by making use
of the new DumpDNSConfiguration varlink method. E.g,

```
$ resolvectl --json=pretty status eth0
[
        {
                "ifname" : "eth0",
                "ifindex" : 9,
                "defaultRoute" : true,
                "currentServer" : {
                        "addressString" : "10.148.181.1",
                        "address" : [
                                10,
                                148,
                                181,
                                1
                        ],
                        "family" : 2,
                        "port" : 53,
                        "ifindex" : 9,
                        "accessible" : true
                },
                "servers" : [
                        {
                                "addressString" : "10.148.181.1",
                                "address" : [
                                        10,
                                        148,
                                        181,
                                        1
                                ],
                                "family" : 2,
                                "port" : 53,
                                "ifindex" : 9,
                                "accessible" : true
                        }
                ],
                "searchDomains" : [
                        {
                                "name" : "local",
                                "routeOnly" : false,
                                "ifindex" : 9
                        }
                ],
                "dnssec" : "allow-downgrade",
                "dnsOverTLS" : "no",
                "llmnr" : "no",
                "mDNS" : "no",
                "scopes" : [
                        {
                                "protocol" : "dns",
                                "ifindex" : 9,
                                "ifname" : "eth0",
                                "dnssec" : "allow-downgrade",
                                "dnsOverTLS" : "no"
                        }
                ]
        }
]
```

Like the regular status output, fields are omitted all together when
empty, unless explicitly requested via one of the sub-commands dns,
domain, nta, etc.

Closes https://github.com/systemd/systemd/issues/33036.