]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
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 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 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 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
10 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.

10 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.

11 days agoFix systemd-ssh-generator printing a bogus hint (#39578)
Zbigniew Jędrzejewski-Szmek [Thu, 6 Nov 2025 14:30:35 +0000 (15:30 +0100)] 
Fix systemd-ssh-generator printing a bogus hint (#39578)

11 days agoask-password-api: return if read_credential() failed 39591/head
David Tardon [Thu, 6 Nov 2025 13:04:32 +0000 (14:04 +0100)] 
ask-password-api: return if read_credential() failed

The current code causes assertion in strv_parse_nulstr() if
read_credential() results in an error different from ENXIO or ENOENT
(strace shows I'm getting EACCES):

 # homectl create waldo --real-name=Waldo --disk-size=200M

Before:

 Assertion 's || l <= 0' failed at src/basic/nulstr-util.c:32, function strv_parse_nulstr_full(). Aborting.

After:

 Failed to acquire password: Permission denied

Follow-up-for: 8806bb4bc7fa15d6ca46e81b8d535730209a3b66

11 days agohomectl: fix memory leak
David Tardon [Thu, 6 Nov 2025 12:54:35 +0000 (13:54 +0100)] 
homectl: fix memory leak

 # valgrind --leak-check=full homectl create waldo --real-name=Waldo --disk-size=200M --setopt=FOO=bar

Before:

==25155== HEAP SUMMARY:
==25155==     in use at exit: 12,879 bytes in 39 blocks
==25155==   total heap usage: 90 allocs, 51 frees, 53,964 bytes allocated
==25155==
==25155== 8 bytes in 1 blocks are definitely lost in loss record 4 of 38
==25155==    at 0x4845866: malloc (vg_replace_malloc.c:446)
==25155==    by 0x547FC2E: strdup (strdup.c:42)
==25155==    by 0x4B2647C: strv_env_replace_strdup_passthrough (env-util.c:435)
==25155==    by 0x42D547: parse_argv (homectl.c:3909)
==25155==    by 0x43999C: run (homectl.c:5606)
==25155==    by 0x4399F5: main (homectl.c:5613)
==25155==
==25155== LEAK SUMMARY:
==25155==    definitely lost: 8 bytes in 1 blocks

After:

==25224== HEAP SUMMARY:
==25224==     in use at exit: 12,871 bytes in 38 blocks
==25224==   total heap usage: 90 allocs, 52 frees, 53,964 bytes allocated
==25224==
==25224== LEAK SUMMARY:
==25224==    definitely lost: 0 bytes in 0 blocks

Follow-up-for: aaf057c4bbc6055040d7d2c1ec3655ff89249ebd

11 days agoprofile/systemd-osc-context: fix overriding of PROMPT_COMMAND
Zbigniew Jędrzejewski-Szmek [Thu, 6 Nov 2025 10:55:06 +0000 (11:55 +0100)] 
profile/systemd-osc-context: fix overriding of PROMPT_COMMAND

In https://github.com/systemd/systemd/issues/39114 users are reporting
that our script overrides PROMPT_COMMAND that they had. After looking
at /etc/bashrc in Fedora, I see that it only sets PROMPT_COMMAND if
[ -z "$PROMPT_COMMAND" ]. Let's adjust the script so this continues to
work.

Fixes https://github.com/systemd/systemd/issues/39114.
(This is a bit of a stretch. 39114 was originally about SecureCRT,
but that was resolved in SecureCRT. But there was a lot of dicussion
about the prompt being overriden, which this commit should fix.)

11 days agotest: expand testcases to include resolvectl --json usage 38960/head
Nick Rosbrook [Fri, 10 Oct 2025 19:56:36 +0000 (15:56 -0400)] 
test: expand testcases to include resolvectl --json usage

11 days agoresolvectl: implement --json flag for resolvectl status
Nick Rosbrook [Fri, 10 Oct 2025 19:56:36 +0000 (15:56 -0400)] 
resolvectl: implement --json flag for resolvectl status

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.

11 days agoresolve: add DumpDNSConfiguration to varlink API
Nick Rosbrook [Fri, 10 Oct 2025 19:56:35 +0000 (15:56 -0400)] 
resolve: add DumpDNSConfiguration to varlink API

Add io.systemd.Resolve.DumpDNSConfiguration. This provides the same
information as io.systemd.Resolve.Monitor.SubscribeDNSConfiguration,
but just returns the configuration once without the subscription logic.

In order to use the same definitions for DNSConfiguration et al. between
both interfaces, move the definitions to io.systemd.Resolve, and include
them in io.systemd.Resolve.Monitor.

This will be used to implement --json for resolvectl status.

11 days agowait-online: ignore unused DNSConfiguration fields when dispatching JSON
Nick Rosbrook [Fri, 17 Oct 2025 16:12:18 +0000 (12:12 -0400)] 
wait-online: ignore unused DNSConfiguration fields when dispatching JSON

The io.systemd.Resolve.Monitor.DNSConfiguration type is being expanded,
but we do not need the extra information for determining online status.

Ignore these fields when dispatching JSON to avoid "Unrecognized object field"
messages adding noise to systemd-networkd-wait-online debug output.

11 days agowait-online: dispatch DNSConfiguration with SD_JSON_ALLOW_EXTENSIONS
Nick Rosbrook [Fri, 17 Oct 2025 16:14:13 +0000 (12:14 -0400)] 
wait-online: dispatch DNSConfiguration with SD_JSON_ALLOW_EXTENSIONS

Currently if an unknown field is encountered in the JSON, it is a fatal
error. Dispatch with SD_JSON_ALLOW_EXTENSIONS to avoid this.

11 days agoresolve: add formatted address string to DNSServer
Nick Rosbrook [Fri, 10 Oct 2025 20:06:47 +0000 (16:06 -0400)] 
resolve: add formatted address string to DNSServer

Although the JSON output is mostly intended to be machine readable,
humans also consume the output through logs and scripts.

Add an addressString field to DNSServer to improve human-readability.

11 days agoresolve: add fallback servers list to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:35 +0000 (15:56 -0400)] 
resolve: add fallback servers list to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add resolv.conf mode to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:34 +0000 (15:56 -0400)] 
resolve: add resolv.conf mode to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add all protocol modes to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:34 +0000 (15:56 -0400)] 
resolve: add all protocol modes to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add DNS scope info to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:34 +0000 (15:56 -0400)] 
resolve: add DNS scope info to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add negative trust anchors to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:33 +0000 (15:56 -0400)] 
resolve: add negative trust anchors to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add delegate info to DNSConfiguration
Nick Rosbrook [Fri, 10 Oct 2025 19:56:33 +0000 (15:56 -0400)] 
resolve: add delegate info to DNSConfiguration

This is one of several commits to expand the DNSConfiguration varlink
type to include the necessary information for resolvectl status output.

11 days agoresolve: add {global,link}_dns_configuration_json_append() helpers
Nick Rosbrook [Fri, 10 Oct 2025 19:56:33 +0000 (15:56 -0400)] 
resolve: add {global,link}_dns_configuration_json_append() helpers

No functional change, just add these helpers to improve readability in
dns_configuration_json_append(). This is preparation for later commits.

11 days agoman: clarify what “failed” means
Christoph Anton Mitterer [Sun, 2 Nov 2025 19:13:35 +0000 (20:13 +0100)] 
man: clarify what “failed” means

systemd.service(5)’s documentation of `ExecCondition=` uses “failed” with
respect to the unit active state.
In particular the unit won’t be considered failed when `ExecCondition=`’s
command exits with a status of 1 through 254 (inclusive). It will however, when
it exits with 255 or abnormally (e.g. timeout, killed by a signal, etc.).

The table “Defined $SERVICE_RESULT values” in systemd.exec(5) uses “failed”
however rather with respect to the condition.

Tests seem to have shown that, if the exit status of the `ExecCondition=`
command is one of 1 through 254 (inclusive), `$SERVICE_RESULT` will be
`exec-condition`, if it is 255, `$SERVICE_RESULT` will be `exit-code` (but
`$EXIT_CODE` and `$EXIT_STATUS` will be empty or unset), if it’s killed because
of `SIGKILL`, `$SERVICE_RESULT` will `signal` and if it times out,
`$SERVICE_RESULT` will be `timeout`.

This commit clarifies the table at least for the case of an exit status of 1
through 254 (inclusive).
The others (signal, timeout and 255 are probably also still ambiguous (e.g.
`signal` uses “A service process”, which could be considered as the actual
service process only).

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
11 days agosystemctl.xml: unify ellipsis (#39586)
Managor [Thu, 6 Nov 2025 09:34:57 +0000 (11:34 +0200)] 
systemctl.xml: unify ellipsis (#39586)

The reverts in #39423 brought this back. This PR will unify the page.

11 days agossh-generator: filter out bogus vsock addresses 39578/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 Nov 2025 17:39:09 +0000 (18:39 +0100)] 
ssh-generator: filter out bogus vsock addresses

When VirtIO VSOCK device is not present, IOCTL_VM_SOCKETS_GET_LOCAL_CID
returns VMADDR_CID_LOCAL/1, and we issue a hint to connect to vsock%1.
This does not work. Filter out VMADDR_CID_LOCAL and VMADDR_CID_HOST,
those are not real addresses that can be used from the outside.

12 days agonss-resolve: fix the ip addr family validity check method
jouyouyun [Wed, 5 Nov 2025 10:03:34 +0000 (18:03 +0800)] 
nss-resolve: fix the ip addr family validity check method

`i` only counts the number of matches with the current family,
while `n_addresses` counts the number of matches with the family INET or INET6.
If the address contains both INET and INET6, `assert(i == n_addresses)` will fail.

12 days agosystemctl: Support --timestamp for otherwise named properties
Chris Down [Wed, 5 Nov 2025 09:46:40 +0000 (17:46 +0800)] 
systemctl: Support --timestamp for otherwise named properties

`systemctl show`'s `--timestamp` flag is supposed to reformat all
timestamp-based properties. However, the logic for detecting these
properties was incomplete and only checked if the name ended in
Timestamp.

Expand the check to explicitly include some non-"timestamp" named
properties that really are timestamps.

Fixes: https://github.com/systemd/systemd/issues/39282
12 days agoman: fix username prefix mentioned in manual for capsule users (#39573)
Nils K [Wed, 5 Nov 2025 22:33:56 +0000 (23:33 +0100)] 
man: fix username prefix mentioned in manual for capsule users (#39573)

12 days agotest: wait until the nspawn process is completely dead (#39576)
Luca Boccassi [Wed, 5 Nov 2025 19:39:10 +0000 (19:39 +0000)] 
test: wait until the nspawn process is completely dead  (#39576)

Before calling io.systemd.MachineImage.List.

The systemd-nspawn process takes a lock in the run() function in
nspawn.c and holds it for the entire runtime of that function. If we
call `machinectl terminate` the machine gets unregistered _before_ we
release the lock, so the original `machinectl status` check would return
early, allowing for a race where we call io.systemd.MachineImage.List
over Varlink when systemd-nspawn still holds the lock because the
process is still running.:

```
[   41.691826] TEST-13-NSPAWN.sh[1102]: + machinectl terminate long-running
[   41.695009] systemd-nspawn[2171]: Trying to halt container by sending TERM to container PID 1. Send SIGTERM again to trigger immediate termination.
[   41.698235] systemd-machined[1192]: Machine long-running terminated.
[   41.709520] TEST-13-NSPAWN.sh[1102]: + systemctl kill --signal=KILL systemd-nspawn@long-running.service
[   41.709169] systemd-nspawn[2171]: Failed to unregister machine: No machine 'long-running' known
[   41.720869] TEST-13-NSPAWN.sh[2346]: + varlinkctl --more call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{}'
[   41.723359] TEST-13-NSPAWN.sh[2347]: + grep long-running
...
[   41.735453] TEST-13-NSPAWN.sh[2352]: + varlinkctl call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{"name":"long-running", "acquireMetadata": "yes"}'
[   41.736222] TEST-13-NSPAWN.sh[2353]: + grep OSRelease
[   41.739500] TEST-13-NSPAWN.sh[2352]: Method call io.systemd.MachineImage.List() failed: Device or resource busy
[   41.740641] systemd[1]: Received SIGCHLD.
[   41.740670] systemd[1]: Child 2171 (systemd-nspawn) died (code=killed, status=9/KILL)
[   41.740725] systemd[1]: systemd-nspawn@long-running.service: Child 2171 belongs to systemd-nspawn@long-running.service.
[   41.740748] systemd[1]: systemd-nspawn@long-running.service: Main process exited, code=killed, status=9/KILL
[   41.740755] systemd[1]: systemd-nspawn@long-running.service: Will spawn child (service_enter_stop_post): systemd-nspawn
[   41.740872] systemd[1]: systemd-nspawn@long-running.service: About to execute: systemd-nspawn --cleanup --machine=long-running
...
```

Let's mitigate this by waiting until the corresponding
systemd-nspawn@.service instance enters the 'inactive' state where the
lock should be properly released.

Resolves: https://github.com/systemd/systemd/issues/39547

12 days agotest-network: fix issues when running with sanitizers (#39572)
Luca Boccassi [Wed, 5 Nov 2025 17:40:29 +0000 (17:40 +0000)] 
test-network: fix issues when running with sanitizers (#39572)

12 days agotest: wait for the backgrounded socat job
Frantisek Sumsal [Wed, 5 Nov 2025 14:47:46 +0000 (15:47 +0100)] 
test: wait for the backgrounded socat job

It should exit on its own anyway and this will work even if the job has
already finished* (unlike kill).

[*] assuming job control is off, as it's the case when running the
    test suite

Resolves: #39543

12 days agobasic/vsock: report result of IOCTL_VM_SOCKETS_GET_LOCAL_CID
Zbigniew Jędrzejewski-Szmek [Fri, 24 Oct 2025 08:29:03 +0000 (10:29 +0200)] 
basic/vsock: report result of IOCTL_VM_SOCKETS_GET_LOCAL_CID

12 days agotest: wait until the nspawn process is completely dead 39576/head
Frantisek Sumsal [Wed, 5 Nov 2025 17:13:58 +0000 (18:13 +0100)] 
test: wait until the nspawn process is completely dead

Before calling io.systemd.MachineImage.List.

The systemd-nspawn process takes a lock in the run() function in
nspawn.c and holds it for the entire runtime of that function. If we
call `machinectl terminate` the machine gets unregistered _before_ we
release the lock, so the original `machinectl status` check would return
early, allowing for a race where we call io.systemd.MachineImage.List
over Varlink when systemd-nspawn still holds the lock because the
process is still running.:

[   41.691826] TEST-13-NSPAWN.sh[1102]: + machinectl terminate long-running
[   41.695009] systemd-nspawn[2171]: Trying to halt container by sending TERM to container PID 1. Send SIGTERM again to trigger immediate termination.
[   41.698235] systemd-machined[1192]: Machine long-running terminated.
[   41.709520] TEST-13-NSPAWN.sh[1102]: + systemctl kill --signal=KILL systemd-nspawn@long-running.service
[   41.709169] systemd-nspawn[2171]: Failed to unregister machine: No machine 'long-running' known
[   41.720869] TEST-13-NSPAWN.sh[2346]: + varlinkctl --more call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{}'
[   41.723359] TEST-13-NSPAWN.sh[2347]: + grep long-running
...
[   41.735453] TEST-13-NSPAWN.sh[2352]: + varlinkctl call /run/systemd/machine/io.systemd.MachineImage io.systemd.MachineImage.List '{"name":"long-running", "acquireMetadata": "yes"}'
[   41.736222] TEST-13-NSPAWN.sh[2353]: + grep OSRelease
[   41.739500] TEST-13-NSPAWN.sh[2352]: Method call io.systemd.MachineImage.List() failed: Device or resource busy
[   41.740641] systemd[1]: Received SIGCHLD.
[   41.740670] systemd[1]: Child 2171 (systemd-nspawn) died (code=killed, status=9/KILL)
[   41.740725] systemd[1]: systemd-nspawn@long-running.service: Child 2171 belongs to systemd-nspawn@long-running.service.
[   41.740748] systemd[1]: systemd-nspawn@long-running.service: Main process exited, code=killed, status=9/KILL
[   41.740755] systemd[1]: systemd-nspawn@long-running.service: Will spawn child (service_enter_stop_post): systemd-nspawn
[   41.740872] systemd[1]: systemd-nspawn@long-running.service: About to execute: systemd-nspawn --cleanup --machine=long-running
...

Let's mitigate this by waiting until the corresponding
systemd-nspawn@.service instance enters the 'inactive' state where the
lock should be properly released.

Resolves: #39547

12 days agotest: terminate the test containers cleanly on SIGTERM
Frantisek Sumsal [Wed, 5 Nov 2025 17:12:39 +0000 (18:12 +0100)] 
test: terminate the test containers cleanly on SIGTERM

So they exit with 0 instead of 143 when we call `machinectl terminate`
on them.

12 days agocore/exec-invoke: pass the correct pid (1) to processes in pidns 39575/head
Mike Yuan [Wed, 5 Nov 2025 16:42:28 +0000 (17:42 +0100)] 
core/exec-invoke: pass the correct pid (1) to processes in pidns

12 days agocore/service: do not pass $MANAGERPID and friends if pidns is employed
Mike Yuan [Wed, 5 Nov 2025 16:27:56 +0000 (17:27 +0100)] 
core/service: do not pass $MANAGERPID and friends if pidns is employed

12 days agocore/socket: fix alignment, extract common conditions
Mike Yuan [Tue, 4 Nov 2025 10:04:50 +0000 (11:04 +0100)] 
core/socket: fix alignment, extract common conditions

12 days agotest-network: disable several more sandbox features when running with sanitizers 39572/head
Yu Watanabe [Wed, 5 Nov 2025 15:03:16 +0000 (00:03 +0900)] 
test-network: disable several more sandbox features when running with sanitizers

These settings also imply seccomp.
Hopefully fixes #39567.

12 days agotest-network: read default values from environment variables
Yu Watanabe [Wed, 5 Nov 2025 15:21:22 +0000 (00:21 +0900)] 
test-network: read default values from environment variables

Nowadays, the test script is run as a service, and no argument about
sanitizers are passed. Let's read them from the environment variables.

12 days agocore: Only apply unprivileged userns logic to user managers
Chris Down [Wed, 5 Nov 2025 10:41:17 +0000 (18:41 +0800)] 
core: Only apply unprivileged userns logic to user managers

Commit 38748596f078 ("core: Make DelegateNamespaces= work for user
managers with CAP_SYS_ADMIN") refactored the logic for when an
unprivileged process should create a new user namespace for sandboxing.

This refactor inadvertently removed a check (`params->runtime_scope !=
RUNTIME_SCOPE_USER`) that differentiated between system services and user
services.

This causes a regression in rootless containers where systemd runs
unprivileged. When starting a system service (like `dbus-broker`) that
uses sandboxing features (eg. with `PrivateTmp=yes`), systemd now
incorrectly creates a new, minimal `PRIVATE_USERS_SELF` namespace.

This new namespace only maps UID/GID 0. When dbus-broker attempts to
drop privileges to the `dbus` user (GID 81), the `setresgid(81, 81, 81)`
call fails because GID 81 is not mapped.

Restore the check to ensure that the special unprivileged sandboxing
logic is only applied to user services, as was the original intent.
System services in a rootless context will now correctly run in the
container's main user namespace, where all necessary UIDs/GIDs are
mapped.

Fixes: https://github.com/systemd/systemd/issues/39563
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2391343