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

24 hours 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

26 hours 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

28 hours 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.

28 hours 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)

32 hours 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

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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.

32 hours 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>
32 hours 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.

33 hours 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.

43 hours 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.

43 hours 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
44 hours 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)

46 hours 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

2 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)

2 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

2 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

2 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

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

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

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

2 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
2 days agocore/manager: small cleanups (#39562)
Yu Watanabe [Wed, 5 Nov 2025 12:17:54 +0000 (21:17 +0900)] 
core/manager: small cleanups (#39562)

2 days agocore/manager: rearrange several struct fields 39562/head
Mike Yuan [Sun, 26 Oct 2025 20:26:58 +0000 (21:26 +0100)] 
core/manager: rearrange several struct fields

2 days agocore/manager: drop unneeded "struct"
Mike Yuan [Sun, 26 Oct 2025 20:23:34 +0000 (21:23 +0100)] 
core/manager: drop unneeded "struct"

2 days agocore/manager: kill unused default_unit_job_id field
Mike Yuan [Sun, 26 Oct 2025 20:23:55 +0000 (21:23 +0100)] 
core/manager: kill unused default_unit_job_id field

While at it, make sure the "Queued ... job for default target"
message is always logged, i.e. also when we fall back to
start job instead of isolate.

2 days agotpm2-setup: fix typo
Yu Watanabe [Wed, 5 Nov 2025 09:18:46 +0000 (18:18 +0900)] 
tpm2-setup: fix typo

Follow-up for 8a6e77f1a8088bb6c7877e256bcc1f1e71552819.

2 days agotar-util: fix typo
Yu Watanabe [Wed, 5 Nov 2025 09:17:20 +0000 (18:17 +0900)] 
tar-util: fix typo

Follow-up for 4ded7f7a434c59534f65a0f9d391c55961eb110d.

2 days agotree-wide: cleanup headers (#39559)
Daan De Meyer [Wed, 5 Nov 2025 07:41:14 +0000 (08:41 +0100)] 
tree-wide: cleanup headers (#39559)

2 days agoTEST-64-UDEV-STORAGE: generate debugging logs
Yu Watanabe [Tue, 4 Nov 2025 18:18:25 +0000 (03:18 +0900)] 
TEST-64-UDEV-STORAGE: generate debugging logs

Let's see if it provides something useful for debugging issue #39544.

2 days agosd-dns-resolver: move header to src/systemd 39559/head
Yu Watanabe [Sun, 2 Nov 2025 08:45:43 +0000 (17:45 +0900)] 
sd-dns-resolver: move header to src/systemd

This also adds missing license header.

Follow-up for ee2108dcd5f62593a3081b57cc92b3535d8096fa.

2 days agolibsystemd: drop unused header
Yu Watanabe [Tue, 4 Nov 2025 17:42:19 +0000 (02:42 +0900)] 
libsystemd: drop unused header

Follow-up for 2dbf1c0f1556bcf8fbab2491ec0f23a85884c551.

2 days agotree-wide: add missing '#pragma once'
Yu Watanabe [Sun, 2 Nov 2025 08:43:14 +0000 (17:43 +0900)] 
tree-wide: add missing '#pragma once'

2 days agotest: rework dmsetup test to wait for device to disappear
Luca Boccassi [Tue, 4 Nov 2025 16:54:11 +0000 (16:54 +0000)] 
test: rework dmsetup test to wait for device to disappear

There might be a delay between an umount and a refcounted device
to disappear, so the test can be flaky:

[   36.107128] TEST-50-DISSECT.sh[1662]: ++ dmsetup ls
[   36.108314] TEST-50-DISSECT.sh[1663]: ++ grep loop
[   36.109283] TEST-50-DISSECT.sh[1664]: ++ grep -c verity
[   36.110284] TEST-50-DISSECT.sh[1360]: + test 1 -eq 1
[   36.111555] TEST-50-DISSECT.sh[1360]: + umount -R /tmp/TEST-50-IMAGES.hxm/mount
[   36.112237] TEST-50-DISSECT.sh[1668]: ++ dmsetup ls
[   36.113039] TEST-50-DISSECT.sh[1669]: ++ grep loop
[   36.113833] TEST-50-DISSECT.sh[1670]: ++ grep -c verity
[   36.114517] TEST-50-DISSECT.sh[1360]: + test 0 -eq 1
[   36.116734] TEST-50-DISSECT.sh[1000]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-50-DISSECT.dissect.sh failed'

https://github.com/systemd/systemd/actions/runs/19062162467/job/54444112653?pr=39540#logs

Switch to searching for the dm entry and check for it specifically,
and wait for it to disappear before checking that it is no longer
in the dm table.

Follow-up for 10fc43e504da5962fa5f04341ae8ba92a9981be9

3 days agocore/service: reload fixlets (#39376)
Yu Watanabe [Tue, 4 Nov 2025 17:54:38 +0000 (02:54 +0900)] 
core/service: reload fixlets (#39376)

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

3 days agocore/exec-invoke: gracefully handle lack of privilege for initgroups() in user mode...
Yu Watanabe [Tue, 4 Nov 2025 17:53:05 +0000 (02:53 +0900)] 
core/exec-invoke: gracefully handle lack of privilege for initgroups() in user mode (#39039)

Fixes #39038

3 days agosysext: Check for /etc/initrd-release in given --root= tree (#39473)
Yu Watanabe [Tue, 4 Nov 2025 17:51:25 +0000 (02:51 +0900)] 
sysext: Check for /etc/initrd-release in given --root= tree (#39473)

3 days agosd-json: accept NULL path in sd_json_parse_file_at() too, port one manual fdopen...
Yu Watanabe [Tue, 4 Nov 2025 16:40:27 +0000 (01:40 +0900)] 
sd-json: accept NULL path in sd_json_parse_file_at() too, port one manual fdopen() to it (#39538)

3 days agocgls: print error messages when --unit and --user-unit are used together
jouyouyun [Tue, 4 Nov 2025 08:10:31 +0000 (16:10 +0800)] 
cgls: print error messages when --unit and --user-unit are used together

Mixing the `--unit` and `--user-unit` options will result in error messages.
During the parsing phase, only the `arg_show_unit` record of the last
occurrence of the option is used; all names are placed in the same `arg_names`,
thus mixing the two types of units in the query.

For example, `-u foo --user-unit bar` will also treat `foo` as a user unit and
query it in the user service.

3 days agosystemctl: Fix shutdown time parsing across DST changes
Chris Down [Tue, 4 Nov 2025 10:19:07 +0000 (18:19 +0800)] 
systemctl: Fix shutdown time parsing across DST changes

When parsing an absolute time specification like `hh:mm` for the
`shutdown` command, the code interprets a time in the past as "tomorrow
at this time". It currently implements this by adding a fixed 24-hour
duration (`USEC_PER_DAY`) to the timestamp.

This assumption breaks across DST transitions, as the day might not be
24 hours long. This can cause the shutdown to be scheduled at the wrong
time (typically off by one hour in either direction).

Change the logic to perform calendar arithmetic instead of timestamp
arithmetic. If the calculated time is in the past, we increment
`tm.tm_mday` and call `mktime_or_timegm_usec()` a second time.

This delegates all date normalization logic to `mktime()`, which
correctly handles all edge cases, including DST transitions, month-end
rollovers, and leap years.

Fixes: https://github.com/systemd/systemd/issues/39232
3 days agonss-myhostname: use FAMILY_ADDRESS_SIZE instead of the integer 16 when copying ip...
jouyouyun [Tue, 4 Nov 2025 12:59:01 +0000 (20:59 +0800)] 
nss-myhostname: use FAMILY_ADDRESS_SIZE instead of the integer 16 when copying ip addr

To avoid copying extra characters when using IPv4.

3 days agomachined/import: allow running in per-user mode (#38728)
Daan De Meyer [Tue, 4 Nov 2025 16:27:43 +0000 (17:27 +0100)] 
machined/import: allow running in per-user mode (#38728)

3 days agocore: use proper service type of TEST-07-PID.user-namespace-path.sh
Quentin Deslandes [Tue, 4 Nov 2025 13:45:15 +0000 (14:45 +0100)] 
core: use proper service type of TEST-07-PID.user-namespace-path.sh

TEST-07-PID.user-namespace-path.sh is flaky as Type=simple is used
(implicitly), explicitly use Type=exec instead to ensure the namespaces
are created before starting another service reusing the same namespaces.

Fixes #39546.

3 days agotest: stop piping post-test journalctl commands to /failed
Luca Boccassi [Tue, 4 Nov 2025 12:51:09 +0000 (12:51 +0000)] 
test: stop piping post-test journalctl commands to /failed

We can't see what the actual issues are when tests fail at that point, eg:

https://github.com/systemd/systemd/actions/runs/19034752357/job/54356278052

3 days agoupdate TODO 38728/head
Lennart Poettering [Wed, 27 Aug 2025 09:29:43 +0000 (11:29 +0200)] 
update TODO

3 days agotest: add test case
Lennart Poettering [Mon, 25 Aug 2025 15:07:20 +0000 (17:07 +0200)] 
test: add test case

3 days agotar-util: squash high UIDs in user mode
Lennart Poettering [Fri, 22 Aug 2025 15:28:50 +0000 (17:28 +0200)] 
tar-util: squash high UIDs in user mode

3 days agotar-util: add support for acls
Lennart Poettering [Fri, 22 Aug 2025 09:05:38 +0000 (11:05 +0200)] 
tar-util: add support for acls

3 days agotar-util: add support for file flags
Lennart Poettering [Thu, 21 Aug 2025 20:40:59 +0000 (22:40 +0200)] 
tar-util: add support for file flags

3 days agotar-util: properly deal with sparse files
Lennart Poettering [Thu, 21 Aug 2025 17:08:01 +0000 (19:08 +0200)] 
tar-util: properly deal with sparse files

The extractor already deals with sparse files properly (because
archive_read_data_into_fd() does).

Let's also make sure the archiver also does this, and attaches the
necessary sparse file metadata to each file.

3 days agotar-util: recognize hardlinks when generating tarballs
Lennart Poettering [Thu, 21 Aug 2025 12:27:54 +0000 (14:27 +0200)] 
tar-util: recognize hardlinks when generating tarballs

3 days agotar-util: include xattrs in generated tarballs
Lennart Poettering [Thu, 21 Aug 2025 10:28:06 +0000 (12:28 +0200)] 
tar-util: include xattrs in generated tarballs

We can already unpack them, let's pack them up to.

3 days agoacl-util: add new acl_set_perm() helper
Lennart Poettering [Fri, 22 Aug 2025 09:04:56 +0000 (11:04 +0200)] 
acl-util: add new acl_set_perm() helper

3 days agosysext: Check for /etc/initrd-release in given --root= tree 39473/head
Kai Lueke [Tue, 28 Oct 2025 11:56:45 +0000 (20:56 +0900)] 
sysext: Check for /etc/initrd-release in given --root= tree

Both sysext and confext used the host's /etc/initrd-release file even
when --root=/somewhere was specified. A workaround was the
SYSTEMD_IN_INITRD= env var but without knowing this it was quite
confusing. Aside from users validating their extensions, the primary
use case for this to matter is when the extensions are set up from the
initrd where the initrd-release file is present when running but we want
to prepare the extensions for the final system and thus should match
for the right scope.
Make systemd-sysext check for /etc/initrd-release inside the given
--root= tree. An alternative would be to always ignore the
initrd-release check when --root= is passed but this way it is more
consistent. The image policy logic for EFI-loader-passed extensions
won't take effect when --root= is used, though.

3 days agotest: Add missing test cleanup for the last sysext test
Kai Lueke [Tue, 28 Oct 2025 15:08:42 +0000 (00:08 +0900)] 
test: Add missing test cleanup for the last sysext test

The last sysext test leaked things into new tests added later,
uncovered by any new tests leftover check.
Remove the mutable folder state through a trap as done in other tests.

3 days agovarlink-idl: add infra to test our enum parsers against varlink IDL enums
Lennart Poettering [Tue, 4 Nov 2025 09:35:00 +0000 (10:35 +0100)] 
varlink-idl: add infra to test our enum parsers against varlink IDL enums

In many cases we want to expose enums for which we have the usual
xyz_to_string()/xyz_from_string() via Varlink as enums. Let's add some
infra to test the tables against each other, to automatically detect
when they deviate.

In order to implement this properly, let's export/introduce clean
json_underscorefy()/json_dashify(), for dealing with the fact that our
enums usually use dash separates ames, but Varlink doesn't allow that.

(This does not add the test cases for all enum types we expose right
now, but only adds the general infra).

3 days agoTEST-80-NOTIFYACCESS: add test case for #37515 39376/head
Mike Yuan [Tue, 21 Oct 2025 23:34:04 +0000 (01:34 +0200)] 
TEST-80-NOTIFYACCESS: add test case for #37515

3 days agocore/service: rework ExecReload= + Type=notify-reload interaction, add ExecReloadPost=
Mike Yuan [Sun, 19 Oct 2025 21:23:17 +0000 (23:23 +0200)] 
core/service: rework ExecReload= + Type=notify-reload interaction, add ExecReloadPost=

When Type=notify-reload got introduced, it wasn't intended to be
mutually exclusive with ExecReload=. However, currently ExecReload=
is immediately forked off after the service main process is signaled,
leaving states in between essentially undefined. Given so broken
it is I doubt any sane user is using this setup, hence I took a stab
to rework everything:

1.  Extensions are refreshed (unchanged)
2.  ExecReload= is forked off without signaling the process
3a. If RELOADING=1 is sent during the ExecReload= invocation,
    we'd refrain from signaling the process again, instead
    just transition to SERVICE_RELOAD_NOTIFY directly and
    wait for READY=1
3b. If not, signal the process after ExecReload= finishes
    (from now on the same as Type=notify-reload w/o ExecReload=)
4.  To accomodate the use case of performing post-reload tasks,
    ExecReloadPost= is introduced which executes after READY=1

The new model greatly simplifies things, as no control processes
will be around in SERVICE_RELOAD_SIGNAL and SERVICE_RELOAD_NOTIFY
states.

See also: https://github.com/systemd/systemd/issues/37515#issuecomment-2891229652

3 days agomacro: add 21st case for IN_SET
Mike Yuan [Sun, 19 Oct 2025 23:03:12 +0000 (01:03 +0200)] 
macro: add 21st case for IN_SET

3 days agoman/org.freedesktop.systemd1: fix typo (ExecStop -> -Post)
Mike Yuan [Sun, 19 Oct 2025 23:35:08 +0000 (01:35 +0200)] 
man/org.freedesktop.systemd1: fix typo (ExecStop -> -Post)

3 days agocore/service: fix missing error handling for refresh-extensions control process
Mike Yuan [Sun, 19 Oct 2025 23:42:57 +0000 (01:42 +0200)] 
core/service: fix missing error handling for refresh-extensions control process

3 days agocore/service: reset all reload-related states once a cycle completes
Mike Yuan [Sun, 19 Oct 2025 20:34:42 +0000 (22:34 +0200)] 
core/service: reset all reload-related states once a cycle completes

Fixes #37515

3 days agocore/service: consolidate where to initialize reload_result
Mike Yuan [Sun, 19 Oct 2025 20:33:03 +0000 (22:33 +0200)] 
core/service: consolidate where to initialize reload_result

3 days agocore/service: forbid reverting STOPPING=1
Mike Yuan [Sun, 19 Oct 2025 19:35:52 +0000 (21:35 +0200)] 
core/service: forbid reverting STOPPING=1

We don't permit state transition from STOPPING back to RUNNING,
hence refrain from resetting notify_state too.

3 days agocore/service: split out service_notify_message_process_state()
Mike Yuan [Sun, 19 Oct 2025 19:32:59 +0000 (21:32 +0200)] 
core/service: split out service_notify_message_process_state()

No functional change, preparation for later changes.

3 days agocore/service: add missing serialization for notify_state
Mike Yuan [Sun, 19 Oct 2025 19:56:33 +0000 (21:56 +0200)] 
core/service: add missing serialization for notify_state

This really should be persisted across daemon-reload since
it might contain deferred state transitions.

3 days agocore/service: remove effectively unused NOTIFY_UNKNOWN state
Mike Yuan [Sun, 19 Oct 2025 19:47:54 +0000 (21:47 +0200)] 
core/service: remove effectively unused NOTIFY_UNKNOWN state

We usually use _INVALID enum value as placeholder.

While at it, reset notify_state in service_enter_dead() for consistency.

3 days agocore/service: avoid duplicate unit_add_to_dbus_queue() call
Mike Yuan [Sun, 19 Oct 2025 19:26:48 +0000 (21:26 +0200)] 
core/service: avoid duplicate unit_add_to_dbus_queue() call

If we're changing state anyways, service_set_state() -> unit_notify()
will take care of dbus signaling for us.

3 days agocore/service: introduce SERVICE_STATE_WITH_WATCHDOG
Mike Yuan [Sun, 19 Oct 2025 18:27:42 +0000 (20:27 +0200)] 
core/service: introduce SERVICE_STATE_WITH_WATCHDOG

3 days agocore: drop redundant pidref_done() calls
Mike Yuan [Sun, 19 Oct 2025 18:14:08 +0000 (20:14 +0200)] 
core: drop redundant pidref_done() calls

{service,socket}_unwatch_control_pid() -> unit_unwatch_pidref_done()
is unconditionally called everywhere.

3 days agocore/service: merge service_enter_reload_mounting() into _refresh_extensions()
Mike Yuan [Sun, 19 Oct 2025 17:41:13 +0000 (19:41 +0200)] 
core/service: merge service_enter_reload_mounting() into _refresh_extensions()

3 days agocore/service: restore spuriously changed comment
Mike Yuan [Sun, 19 Oct 2025 18:16:05 +0000 (20:16 +0200)] 
core/service: restore spuriously changed comment

Not sure why dfdeb0b1cbb05a213f0965eedfe0e7ef06cd39d3
touched it at all.

3 days agocore/service: do not set reload_begin_usec when refreshing confexts
Mike Yuan [Sun, 19 Oct 2025 16:37:41 +0000 (18:37 +0200)] 
core/service: do not set reload_begin_usec when refreshing confexts

reload_begin_usec is a barrier for determining whether RELOADING=1
came after the main process got signaled, unrelated to refreshing.

3 days agocore/service: no need for STATUS_TEXT_MAX to reside in header
Mike Yuan [Sun, 19 Oct 2025 19:43:27 +0000 (21:43 +0200)] 
core/service: no need for STATUS_TEXT_MAX to reside in header

3 days agocore/job: use UNIT_IS_* helpers
Mike Yuan [Wed, 22 Oct 2025 18:16:55 +0000 (20:16 +0200)] 
core/job: use UNIT_IS_* helpers

3 days agocore/job: drop pure qualifier for static inline functions
Mike Yuan [Wed, 22 Oct 2025 18:53:15 +0000 (20:53 +0200)] 
core/job: drop pure qualifier for static inline functions

The impl is directly visible to the compiler so it can apply
all sorts of optimizations wherever it sees fit. And with
the previous commit they are actually "const".

3 days agocore/job: mark job_type_lookup_merge() and _is_redundant() as const
Mike Yuan [Wed, 22 Oct 2025 18:50:17 +0000 (20:50 +0200)] 
core/job: mark job_type_lookup_merge() and _is_redundant() as const

They don't take pointers, hence are eligible for stronger guarantees.

3 days agocore: Add UserNamespacePath=
Quentin Deslandes [Fri, 17 Oct 2025 13:37:02 +0000 (15:37 +0200)] 
core: Add UserNamespacePath=

This allows a service to reuse the user namespace created for an
existing service, similarly to NetworkNamespacePath=. The configuration
is the initial user namespace (e.g. ID mapping) is preserved.

3 days agosysupdated: port to sd_json_parse_file_at() 39538/head
Mike Yuan [Mon, 3 Nov 2025 21:16:46 +0000 (22:16 +0100)] 
sysupdated: port to sd_json_parse_file_at()

3 days agosd-json: accept NULL path in sd_json_parse_file_at() too
Mike Yuan [Mon, 3 Nov 2025 21:06:53 +0000 (22:06 +0100)] 
sd-json: accept NULL path in sd_json_parse_file_at() too

3 days agofileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen()
Mike Yuan [Mon, 3 Nov 2025 20:59:34 +0000 (21:59 +0100)] 
fileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen()

in a similar fashion as xopenat_full()

4 days agomkosi: update fedora commit reference to 8e2833a5b64f7e2ce62ea0a2d0ec9e393e718dfa
Zbigniew Jędrzejewski-Szmek [Mon, 3 Nov 2025 11:19:37 +0000 (12:19 +0100)] 
mkosi: update fedora commit reference to 8e2833a5b64f7e2ce62ea0a2d0ec9e393e718dfa

8e2833a5b6 Automatically figure out the name of the top-level tar dir
dffbf2beba Make sure fallback source is listed first
1d3b892105 Enable sysupdate and sysupdated

4 days agobacklight: fix typo
jouyouyun [Mon, 3 Nov 2025 08:04:33 +0000 (16:04 +0800)] 
backlight: fix typo

4 days agobootctl: fix typo
jouyouyun [Mon, 3 Nov 2025 06:17:35 +0000 (14:17 +0800)] 
bootctl: fix typo

4 days agokernel-install: move staging area to /var/tmp/
Lennart Poettering [Sun, 2 Nov 2025 08:32:16 +0000 (09:32 +0100)] 
kernel-install: move staging area to /var/tmp/

The generated files (UKIs...) can potentially be huge, hence create them
in /var/tmp/, rather than /tmp/.

4 days agoAdd support for nvindex-based additional PCRs for TPM2, aka "NvPCRs" (#39463)
Lennart Poettering [Mon, 3 Nov 2025 08:00:41 +0000 (09:00 +0100)] 
Add support for nvindex-based additional PCRs for TPM2, aka "NvPCRs"  (#39463)

This is based on the code from #33276, but is cleaned up, and goes for a
modified approach:

the original PR allocated nvindexes fully dynamically, and that created
big headaches, because the assignments needed to be propagated into the
early boot process, and that meant stuffing them as sidecards to the
boot UKIs.

The TCG then offered us a fixed nvindex range assigned to us, and
happily said yes to that, but since then the discussion stalled, we
couldn't get any answer from TCG on this anymore.

This code uses the range that was hinted to us to use, but not
officially assigned to us by default, but makes it build time
configurable so that downstreams can change this.

(This does *not* make it runtime configurable, because that's really
hard, because of the early boot issue again).

This PR comes with a CI test and full docs. And I think this is really a
version should that be merged.

Fixes: https://github.com/systemd/systemd/issues/29877
4 days agodoc: document NvPCRs briefly 39463/head
Lennart Poettering [Fri, 31 Oct 2025 17:16:07 +0000 (18:16 +0100)] 
doc: document NvPCRs briefly

4 days agoci: add some test for the new nvpcr infra
Lennart Poettering [Mon, 27 Oct 2025 11:55:02 +0000 (12:55 +0100)] 
ci: add some test for the new nvpcr infra

4 days agoci: never go to raw tpm device, always go via resource manager
Lennart Poettering [Mon, 27 Oct 2025 15:15:41 +0000 (16:15 +0100)] 
ci: never go to raw tpm device, always go via resource manager