Commit Graph
84675 Commits
Author SHA1 Message Date
Mike Yuan 4175cd4f40 acl-util: drop now unused fd_acl_make_writable() 2025-11-10 23:06:14 +01:00
Mike Yuan bc48ac39c4 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.
2025-11-10 23:06:14 +01:00
Mike Yuan 44f23805b0 core/exec-credential: work around tmpfs reconfigure bug 2025-11-10 23:06:14 +01:00
Mike Yuan d796c6b7c6 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.
2025-11-10 23:06:14 +01:00
Mike Yuan e4c7e4c27a mount-util: introduce fsmount_credentials_fs()
While at it, remove effectively unused size and ro params.
2025-11-10 22:38:21 +01:00
Mike Yuan c7b5f7f30f creds-util: use U64_* macros where appropriate 2025-11-10 22:38:21 +01:00
Mike Yuan 4338440c97 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.
2025-11-10 22:38:21 +01:00
Frantisek Sumsal b131e8d3a4 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
2025-11-10 21:31:09 +00:00
Luca Boccassi 69ab56aa19 systemd-analyze shell completion improvements (#39673) 2025-11-10 20:06:09 +00:00
Jelle van der Waa 1e29036afc shell-completion: zsh: add completion for systemd-analyze inspect-elf 2025-11-10 20:10:06 +01:00
Jelle van der Waa 49ff5ad6e6 shell-completion: bash: add systemd-analyze image-policy completion 2025-11-10 20:09:53 +01:00
Jelle van der Waa 7112e08cec shell-completion: zsh: add missing completions for systemd-analyze
Adds missing simple verbs which already exist in bash completion.
2025-11-10 20:09:42 +01:00
Jelle van der Waa 60c68080b7 shell-completion: zsh: add systemd-analyze architectures completion 2025-11-10 20:09:01 +01:00
Frantisek Sumsal 6a05abb9b4 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
2025-11-10 18:30:55 +00:00
Gero Schwäricke 032ea7ca12 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.
2025-11-10 23:22:08 +09:00
Yu Watanabe 9485379850 resolve: several follow-ups for json output (#39605)
Follow-ups for #38960.
2025-11-10 22:32:28 +09:00
Yu Watanabe ecf3c8702d test-ndisc-rs: drop unused verbose flag and log in the debug level 2025-11-10 20:49:21 +09:00
Yu Watanabe 1d17b23dd6 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'
```
2025-11-10 20:49:00 +09:00
Yu Watanabe 39adbedafc various: assorted cleanups for safe_fork (#39661) 2025-11-10 18:40:16 +09:00
Yu Watanabe f50f785737 dissect: getenv_fstype() is unused when LIBBLKID support is disabled
Follow-up for aad0d11e7c.
2025-11-10 18:38:32 +09:00
Yu Watanabe b1a95a3aa7 resolvectl: drop an empty line between function call and error handling
Follow-up for 0536b37629.
2025-11-10 11:02:51 +09:00
Yu Watanabe f2f89678ec resolvectl: use string table
Follow-up for 0536b37629.
2025-11-10 11:02:51 +09:00
Yu Watanabe fa05718dea resolvectl: rename STATUS_PRIVATE -> STATUS_DNS_OVER_TLS 2025-11-10 11:02:51 +09:00
Yu Watanabe 6f841e58b1 resolve: do not dump cache entries when not necessary
Follow-up for 306375c368.
2025-11-10 11:02:51 +09:00
Mike Yuan 1be6068c48 notify: raise log level for safe_fork() 2025-11-10 03:02:47 +01:00
Yu Watanabe 76c674ec25 resolve: use enum for several fields
Unfortunately, we have already exposed dnssec with hyphen, so we cannot
change it as enum.
2025-11-10 11:02:33 +09:00
Yu Watanabe c6b6ac63ea resolve: drop unnecessary preparation of empty arrays 2025-11-10 11:01:39 +09:00
Yu Watanabe a37239d05f resolve: use JSON_BUILD_PAIR_TRISTATE_NON_NULL for default_route 2025-11-10 11:01:38 +09:00
Yu Watanabe a45bc4a1be core/namespace: hide the correct credentials tree when running in user scope (#39651) 2025-11-10 11:01:16 +09:00
Hosted Weblate 2ddd030b6a 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
2025-11-10 11:00:40 +09:00
Dr. David Alan Gilbert 72afecf1f6 network: Typo fix configur*a*d
configurad->configured
2025-11-10 10:58:11 +09:00
Mike Yuan d9f993dd86 hostname-setup: prefix helper process name with "sd-" 2025-11-10 02:55:40 +01:00
Yu WatanabeandEvgeny Vereshchagin a736d4ec9c 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>
2025-11-10 10:45:42 +09:00
Mike Yuan 686117e5b0 process-util: prefix FORK_PID_ONLY with _ to signify it is internal 2025-11-10 02:44:57 +01:00
Yu Watanabe e3ea1cfd5e tree-wide: add several missing includes
- test-reread-partition-table.c: sys/file.h for LOCK_EX
- coredump: unistd.h for STDIN_FILENO
2025-11-10 09:36:52 +09:00
Mike Yuan 6a5e38c3b9 TEST-54-CREDS: add test case for credential dir masking 2025-11-09 23:38:59 +01:00
Mike Yuan 9876309cfe 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.
2025-11-09 22:39:42 +01:00
Mike Yuan a07c1ed05f core/namespace: hide the correct credentials tree when running in user scope 2025-11-09 22:39:42 +01:00
Yu Watanabe 97ad10c9aa profile: skip setting PS0 when PROMPT_COMMAND= is cleared
Fixes #39639.
2025-11-10 06:05:15 +09:00
Maximilian Bosch 4dabc30050 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] a145623bc4
2025-11-10 05:27:00 +09:00
Yu Watanabe 96e5612d9f core/import-creds: trivial modernizations (#39652) 2025-11-10 05:26:37 +09:00
Mike Yuan 40054039e6 labeler: catch up with recent changes (#39653) 2025-11-09 20:25:45 +01:00
Mike Yuan c2715eed58 labaler: add "shell profile" 2025-11-09 18:57:20 +01:00
Mike Yuan dcb717a53a labeler: match per-user machined units too 2025-11-09 18:57:01 +01:00
Mike Yuan 4f7695fa21 labeler: be more specific when matching for "import" 2025-11-09 18:56:15 +01:00
Mike Yuan 63edae360f core/import-creds: use RET_GATHER 2025-11-09 18:46:37 +01:00
Mike Yuan 61e018dfad core/import-creds: use FOREACH_ARRAY at one more place 2025-11-09 18:46:37 +01:00
Mike Yuan d0fcb614cb 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.
2025-11-09 18:46:36 +01:00
Yu Watanabe 445b7073c7 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
2025-11-10 01:52:19 +09:00
Chris Down 2091caddb8 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")
2025-11-09 21:14:22 +08:00