]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 months agostat-util: add statx_verify_directory() helper, similar to stat_verify_directory...
Lennart Poettering [Thu, 5 Feb 2026 15:42:20 +0000 (16:42 +0100)] 
stat-util: add statx_verify_directory() helper, similar to stat_verify_directory() but for statx

2 months agomountpoint-util: use xstatx() a bit more
Lennart Poettering [Thu, 5 Feb 2026 15:41:50 +0000 (16:41 +0100)] 
mountpoint-util: use xstatx() a bit more

2 months agodirent-util: use xstatx_full() some more
Lennart Poettering [Thu, 5 Feb 2026 15:40:57 +0000 (16:40 +0100)] 
dirent-util: use xstatx_full() some more

2 months agoreport: many smaller clean-ups/tweaks to systemd-report (#40598)
Zbigniew Jędrzejewski-Szmek [Mon, 9 Feb 2026 09:28:29 +0000 (10:28 +0100)] 
report: many smaller clean-ups/tweaks to systemd-report (#40598)

/cc @keszybz

2 months agokernel-install: allocate "Context" object only in verb_xyz() functions, not already... 40610/head
Lennart Poettering [Mon, 8 Sep 2025 08:40:43 +0000 (10:40 +0200)] 
kernel-install: allocate "Context" object only in verb_xyz() functions, not already in run()

We soon want to add a Varlink interface to this, but that means that the
various paramaters for the Context object will be sourced from a Varlink
message not from the command line. Hence split apart the parsing logic
so that we alway parse the command line into arg_xyz first, and then,
inside the verb_abc() calls copy the data from there into the Context
object.

This matches a similar pattern in bootctl.

2 months agokernel-install: rework in preparation for varlink
Lennart Poettering [Fri, 5 Sep 2025 20:12:48 +0000 (22:12 +0200)] 
kernel-install: rework in preparation for varlink

This reworks things a bit, so that the "Context" object can later be
allocated for each Varlink call separately. For example we define a
more precise CONTEXT_NULL that invalidates truly all fields, so that we
can discern "defaults" from "unspecified" later on.

Other minor rearrangements too

2 months agobootctl parts of installer PR (#40447)
Daan De Meyer [Mon, 9 Feb 2026 08:46:39 +0000 (09:46 +0100)] 
bootctl parts of installer PR (#40447)

This contains the "bootctl install" related work from the #38764 split
out, but also includes the preparatory work already split out into
#40446.

I'll rebase this PR once the prep work is merged.

This has a simple CI test already, and has docs

2 months agojournal-send: check if $LOG_NAMESPACE denotes our /run/systemd/journal/ is already...
Mike Yuan [Sat, 7 Feb 2026 20:22:56 +0000 (21:22 +0100)] 
journal-send: check if $LOG_NAMESPACE denotes our /run/systemd/journal/ is already namespaced properly

2 months agodocs: note step to update obs workflow file on release
Luca Boccassi [Fri, 6 Feb 2026 17:22:15 +0000 (17:22 +0000)] 
docs: note step to update obs workflow file on release

2 months agoREADME: note that we now have packages built from stable branch too
Luca Boccassi [Fri, 6 Feb 2026 17:05:37 +0000 (17:05 +0000)] 
README: note that we now have packages built from stable branch too

2 months agomeson: use printf instead of echo
Mike Gilbert [Mon, 9 Feb 2026 00:12:30 +0000 (19:12 -0500)] 
meson: use printf instead of echo

The echo builtin provided by some shells (mksh) will interpret \x2d as
an escape sequence. This causes meson to fail:

```
test/fuzz/meson.build:93:52: ERROR: File fuzz-unit-file/dm-back-slash.swap does not exist.
```

Bug: https://bugs.gentoo.org/969789

2 months agoupdate TODO
Lennart Poettering [Mon, 9 Feb 2026 08:33:07 +0000 (09:33 +0100)] 
update TODO

2 months agotree-wide: use path_split_prefix_filename() where appropriate 40608/head
Mike Yuan [Mon, 9 Feb 2026 01:30:38 +0000 (02:30 +0100)] 
tree-wide: use path_split_prefix_filename() where appropriate

2 months agopath-util: unify path_extract_filename/directory into path_split_prefix_filename()
Mike Yuan [Mon, 9 Feb 2026 00:25:39 +0000 (01:25 +0100)] 
path-util: unify path_extract_filename/directory into path_split_prefix_filename()

2 months agopath-util: drop redundant condition in path_find_last_component()
Mike Yuan [Sun, 8 Feb 2026 23:29:18 +0000 (00:29 +0100)] 
path-util: drop redundant condition in path_find_last_component()

Follow-up for 3a7ba9f6b9d9a80c7f909bfbf24b5fc8c99a3176

2 months agosnapshot-util: include shared-forward.h
Mike Yuan [Wed, 4 Feb 2026 18:57:42 +0000 (19:57 +0100)] 
snapshot-util: include shared-forward.h

2 months agooomd: implement a prekill hook (#38584)
Lennart Poettering [Mon, 9 Feb 2026 07:43:13 +0000 (08:43 +0100)] 
oomd: implement a prekill hook (#38584)

When a cgroup is selected for termination, send varlink messages to
hooks registered in `/run/systemd/oomd.prekill-hooks/`.
oomd waits up to `PreKillTimeoutSec=` seconds for response before
proceeding with the kill.

2 months agodocs/INCOMPATIBILITIES: fix typo
Mike Yuan [Tue, 3 Feb 2026 23:39:34 +0000 (00:39 +0100)] 
docs/INCOMPATIBILITIES: fix typo

2 months agomailmap: deduplicate Lennart and Daan @Amutable
Mike Yuan [Wed, 4 Feb 2026 18:59:57 +0000 (19:59 +0100)] 
mailmap: deduplicate Lennart and Daan @Amutable

2 months agooomd: implement a prekill varlink event 38584/head
Matteo Croce [Mon, 25 Aug 2025 15:13:00 +0000 (17:13 +0200)] 
oomd: implement a prekill varlink event

When a cgroup is selected for termination, send varlink messages
to hooks registered in `/run/systemd/oomd.prekill-hooks/`.
oomd waits up to `PreKillHookTimeoutSec=` seconds for response
before proceeding with the kill.

2 months agoRevert "oomd: move check if processes can be killed into oomd_cgroup_kill()"
Matteo Croce [Mon, 24 Nov 2025 11:58:07 +0000 (12:58 +0100)] 
Revert "oomd: move check if processes can be killed into oomd_cgroup_kill()"

This reverts commit 332bce5bd7a9294c3b414b6da72b09986af69d6b.

The revert is needed because with the PreKill hook, oomd_cgroup_kill()
is not goint to really kill processes but it just creates the callbacks.
So the check is deferred to the real kill.

2 months agooomd: Make OomdCGroupContext reference counted
Daan De Meyer [Tue, 28 Oct 2025 12:02:32 +0000 (13:02 +0100)] 
oomd: Make OomdCGroupContext reference counted

Preparation for adding oomd hooks.

2 months agoudev: Introduce uaccess for remote graphical sessions (#38516)
Lennart Poettering [Sun, 8 Feb 2026 20:41:21 +0000 (21:41 +0100)] 
udev: Introduce uaccess for remote graphical sessions (#38516)

When systemd is compiled with group-render-mode=0660, only the active
seat gets access to the render devices through uaccess. Remote desktop
sessions like gnome-remote-desktop would be left with no hardware
rendering, because those sessions are not associated with a seat.

We solve the issue by granting uaccess to specifically tagged devices on
session start, if the session is marked with
XDG_SESSION_EXTRA_DEVICE_ACCESS.

udev-builtin-uaccess is refactored to grant multiple users access to a
device, taking into account the device's seat and all the active
EXTRA_DEVICE_ACCESS sessions.

2 months agomkosi: always install util-linux-script in Fedora
Luca Boccassi [Sun, 8 Feb 2026 13:29:23 +0000 (13:29 +0000)] 
mkosi: always install util-linux-script in Fedora

F41 is EOL, so we can unconditionally install this package, so that we
don't have to add a new version every time a new release is branched

Fixes test issues such as:

TEST-74-AUX-UTILS.sh[1363]: .//usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.networkctl.sh: line 55: script: command not found

2 months agoTODO: add some items about report/metrics 40598/head
Lennart Poettering [Sat, 7 Feb 2026 22:55:23 +0000 (23:55 +0100)] 
TODO: add some items about report/metrics

2 months agoman: add super basic man page
Lennart Poettering [Sat, 7 Feb 2026 22:34:09 +0000 (23:34 +0100)] 
man: add super basic man page

2 months agoreport: rework limits logic
Lennart Poettering [Sat, 7 Feb 2026 22:26:21 +0000 (23:26 +0100)] 
report: rework limits logic

Let's count how many sources we skip, and output that as a summary, and
return an error exit code in this case.

Let's also put a limit on the metrics collected, not just the sources.

Also, our macros that put limits on things are usually called XYZ_MAX,
follow the same scheme here.

2 months agoreport: don't claim no reporting sockets were found, when it's no metrics that were...
Lennart Poettering [Sat, 7 Feb 2026 22:12:30 +0000 (23:12 +0100)] 
report: don't claim no reporting sockets were found, when it's no metrics that were found

Let's add a proper message about missing sources, and call them
"sources", i.e. take a more high-level view on things.

2 months agoreport: keep track of varlink connections inside of Context object
Lennart Poettering [Sat, 7 Feb 2026 22:10:54 +0000 (23:10 +0100)] 
report: keep track of varlink connections inside of Context object

Let's also move the Varlink connection management into the Context
object. Let's also switch to Set* for it, so that we get get
auto-expanding behaviour.

2 months agoreport: move event loop object into Context
Lennart Poettering [Sat, 7 Feb 2026 22:01:00 +0000 (23:01 +0100)] 
report: move event loop object into Context

It's one of the primary objects that make up the program "context"
conceptually, hence it also should be part of the Context object. This
allows us to just have it available if the Context object is seen.

2 months agoreport: pass Context as first argument to metrics_call()
Lennart Poettering [Sat, 7 Feb 2026 21:57:41 +0000 (22:57 +0100)] 
report: pass Context as first argument to metrics_call()

Typically the context object should be the first one. And the return
parameters should be the last ones.

2 months agoreport: -p is not defined
Lennart Poettering [Fri, 6 Feb 2026 22:43:31 +0000 (23:43 +0100)] 
report: -p is not defined

2 months agoreport: do not treat an empty report dir as an issue
Lennart Poettering [Fri, 6 Feb 2026 22:42:36 +0000 (23:42 +0100)] 
report: do not treat an empty report dir as an issue

We should permit that the report varlink dir is created on the fly when
the first socket is bound there. Hence, let's treat a non-existant dir
equivalent to an empty one.

We usually do this in our tree like this, do it here too.

2 months agoreport: use sd_json_variant_unref_many()
Lennart Poettering [Fri, 6 Feb 2026 22:42:15 +0000 (23:42 +0100)] 
report: use sd_json_variant_unref_many()

2 months agoreport: add the usual --json= argument
Lennart Poettering [Fri, 6 Feb 2026 22:42:02 +0000 (23:42 +0100)] 
report: add the usual --json= argument

2 months agobash-completion/sysext: add missing candidates for --always-refresh
Yu Watanabe [Fri, 6 Feb 2026 15:48:38 +0000 (00:48 +0900)] 
bash-completion/sysext: add missing candidates for --always-refresh

Follow-up for 23115eeaf10ab551b44b7de68b8c23923bcf28e9.

2 months agodaemon-util: downgrade log level on ECONNREFUSED and friends
Yu Watanabe [Fri, 6 Feb 2026 16:07:33 +0000 (01:07 +0900)] 
daemon-util: downgrade log level on ECONNREFUSED and friends

This partially reverts 36c557f7d41441bbd98a8965348dfe8050fc9c98, which
introduced notify_remove_fd() that logs in LOG_DEBUG. However,
notify_remove_fd_warn() is still called other library functions, e.g.
notify_push_fd(), and produces warning message about the failure in
removing fd from fdstore on shutdown.

During shutdown process, we get the following logs:
```
systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused
systemd-udevd[370]: Failed to remove file descriptor "config-serialization" from the store, ignoring: Connection refused
systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused
systemd-udevd[370]: Failed to push serialization fd to service manager: Connection refused
```
Here, the 1st, 3rd, and 4th messages are in LOG_DEBUG, but the 2nd one
was in LOG_WARNING before this commit, and this makes it also in LOG_DEBUG.

Follow-up for 472404aca5357b7e65cdddf418342070b0ccd4d2.

2 months agoresolvectl: include ifindex when printing link-local DNS server
Nick Rosbrook [Fri, 6 Feb 2026 16:38:47 +0000 (11:38 -0500)] 
resolvectl: include ifindex when printing link-local DNS server

Historically, resolvectl status has not included the interface
specification for DNS servers with an IPv6 link-local address, since it
is technically somewhat redundant. But, adding this extra bit of
information makes it easier to copy-and-paste to use elsewhere, etc.

For example, the previous output:

 Link 2 (enp34s0)
     Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
          Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
 Current DNS Server: fe80::861e:a3ff:feb1:f8e7
        DNS Servers: 192.168.1.12 192.168.1.13 fe80::861e:a3ff:feb1:f8e7
         DNS Domain: lan

now becomes:

 Link 2 (enp34s0)
     Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
          Protocols: +DefaultRoute LLMNR=resolve -mDNS -DNSOverTLS DNSSEC=no/unsupported
 Current DNS Server: fe80::861e:a3ff:feb1:f8e7%2
        DNS Servers: 192.168.1.12 192.168.1.13 fe80::861e:a3ff:feb1:f8e7%2
         DNS Domain: lan

2 months agobootctl: add comments emphasizing that certain functions do not touch the file read... 40447/head
Lennart Poettering [Fri, 6 Feb 2026 21:31:53 +0000 (22:31 +0100)] 
bootctl: add comments emphasizing that certain functions do not touch the file read pointer

2 months agobootctl: add test case for bootctl install via varlink
Lennart Poettering [Fri, 23 Jan 2026 12:09:08 +0000 (13:09 +0100)] 
bootctl: add test case for bootctl install via varlink

2 months agobootctl: return recognizable Varlink error when we cannot determine the boot entry...
Lennart Poettering [Fri, 23 Jan 2026 20:04:55 +0000 (21:04 +0100)] 
bootctl: return recognizable Varlink error when we cannot determine the boot entry token

When running "bootctl install" on an empty --root= dir, we don't know
which token to use, and the operation will fail. Make sure to return an
explicit error about this.

This introduces a recognizable low-level error for this (EUNATCH), and
then turns this into a recognizable Varlink error.

(I made sure that the old low-level error EINVAL wasn't load-bearing,
and it is safe to change this.)

2 months agobootctl: optionally include backing disk name in efi boot option description
Lennart Poettering [Sat, 20 Sep 2025 06:38:51 +0000 (08:38 +0200)] 
bootctl: optionally include backing disk name in efi boot option description

2 months agobootctl: parse install source via our usual string table helpers
Lennart Poettering [Mon, 8 Sep 2025 08:16:22 +0000 (10:16 +0200)] 
bootctl: parse install source via our usual string table helpers

2 months agobootctl: add Install() varlink API
Lennart Poettering [Wed, 3 Sep 2025 10:11:19 +0000 (12:11 +0200)] 
bootctl: add Install() varlink API

Fixes: #11221
2 months agobootctl: rework bootctl-install.c in preparation of varlinkification
Lennart Poettering [Wed, 3 Sep 2025 10:11:00 +0000 (12:11 +0200)] 
bootctl: rework bootctl-install.c in preparation of varlinkification

This primarily introduces a context object for each operation, so that
we later can instantiate one for each varlink op we execute, and can
safely lifecycle all operation parameters for each subequent call.

This also reworks the root dir handling to be fd based.

This drops explicit CHASE_TRIGGER_AUTOFS from a bunch of chase() calls
that operate within the ESP/XBOOTLDR, while it keeps them in place for the
chase() calls that find the top-level ESP/XBOOTLDR inode. This reflects
the fact that we explicitly support autofs for the ESP/XBOOTLDR itself,
but below it expect no further mounts, just plain VFAT.

This changes behaviour of the interaction of $KERNEL_INSTALL_CONF_ROOT
and --root=: the former will now be taken relative to the host root, and
will no longer be affected by --root=. This follows similar behaviour in
kernel-install, where it is very explicitly documented in the man page
(the bootclt man page does not document this). This is strictly speaking
a compat breakage, but i think a very minor, niche one, and I think the
pain afflicted by this change is probably neglible compare to the
unsystematic behaviour comapred to kernel-install.

2 months agotests: don't use dd anymore for allocating empty test disk images (#40583)
Lennart Poettering [Fri, 6 Feb 2026 20:03:55 +0000 (21:03 +0100)] 
tests: don't use dd anymore for allocating empty test disk images (#40583)

2 months agoCODING_STYLE: document how to handle kernel compat
Lennart Poettering [Fri, 6 Feb 2026 11:15:23 +0000 (12:15 +0100)] 
CODING_STYLE: document how to handle kernel compat

Let's define a way how to mark codepaths that are subject to
deletion once the kernel baseline reaches a certain version, to make it
easier to find these cases.

WHile we are at it, introuce a whole section in CODING_STYLE about
kernel version compat.

I followed the new scheme in #39621, but we can merge the coding style
guidelines on this already.

2 months agoinhibit: drop redundant table_set_header() caller
Lennart Poettering [Fri, 6 Feb 2026 15:16:14 +0000 (16:16 +0100)] 
inhibit: drop redundant table_set_header() caller

The immediately following table_print_with_pager() call already
processes arg_legend, no need to do this manually first.

2 months agotest: bump disk sizes for some test cases 40583/head
Lennart Poettering [Fri, 6 Feb 2026 11:16:15 +0000 (12:16 +0100)] 
test: bump disk sizes for some test cases

In my testing I switched building my locally run CI integration tests to
ArchLinux and realized that for that the default sizes don't work
anymore, the images are larger than the space allocated. Let's bump the
size by 50% for the relevant disk images.

2 months agotests: don't use "dd" to allocate empty files
Lennart Poettering [Fri, 6 Feb 2026 10:16:48 +0000 (11:16 +0100)] 
tests: don't use "dd" to allocate empty files

Let's use truncate -s … to create empty files (if they can be sparse)

Let's use fallocate -l … to create empty non-sparse files.

This should reduce the disk footprint of our tests a bit, given that in
most cases we won't use the allocate disk space in full, not even
remotely.

2 months agoman/sd-login: Document the uaccess and xaccess udev tags 38516/head
Alessandro Astone [Fri, 6 Feb 2026 09:29:29 +0000 (10:29 +0100)] 
man/sd-login: Document the uaccess and xaccess udev tags

Fixes: #4288
2 months agoman: Update docs for ExtraDeviceAccess
Alessandro Astone [Wed, 26 Nov 2025 17:20:30 +0000 (18:20 +0100)] 
man: Update docs for ExtraDeviceAccess

2 months agorules: Tag DRM render nodes with xaccess
Alessandro Astone [Wed, 26 Nov 2025 16:30:52 +0000 (17:30 +0100)] 
rules: Tag DRM render nodes with xaccess

When systemd is compiled with group-render-mode=0660, only the active seat
gets access to the render devices through uaccess. Remote desktop sessions
like gnome-remote-desktop would be left with no hardware rendering, because
those sessions are not associated with a seat.

Tag the render nodes with "xaccess" so that access is also granted to remote
sessions created with XDG_SESSION_EXTRA_DEVICE_ACCESS=1

2 months agoudev: Grant sessions access to devices tagged with xaccess
Alessandro Astone [Wed, 26 Nov 2025 16:26:53 +0000 (17:26 +0100)] 
udev: Grant sessions access to devices tagged with xaccess

Grant access to devices tagged with "xaccess" on session start, if the session
was created with XDG_SESSION_EXTRA_DEVICE_ACCESS=1.

udev-builtin-uaccess is refactored to grant multiple users access to a device,
taking into account the device's seat and all the active EXTRA_DEVICE_ACCESS
sessions.

2 months agologin: Add XDG_SESSION_EXTRA_DEVICE_ACCESS variable for additional access
Alessandro Astone [Wed, 26 Nov 2025 16:23:13 +0000 (17:23 +0100)] 
login: Add XDG_SESSION_EXTRA_DEVICE_ACCESS variable for additional access

A session created with XDG_SESSION_EXTRA_DEVICE_ACCESS will be granted
additional powers.
Exactly which powers are granted is going to be defined by udevd.

2 months agometrics: fix typo
Yu Watanabe [Fri, 6 Feb 2026 06:19:51 +0000 (15:19 +0900)] 
metrics: fix typo

Follow-up for fd73cd6c912a4d31f404d54700654d8398ea8f27.

2 months agoudev: fix typo
Yu Watanabe [Fri, 6 Feb 2026 06:17:21 +0000 (15:17 +0900)] 
udev: fix typo

Follow-up for b7363d33302fa86fe46e03b500e729fea3277ed7.

2 months agojournal-remote test: add -Z for mkdir in general
Cathy Hu [Fri, 23 Jan 2026 09:52:36 +0000 (10:52 +0100)] 
journal-remote test: add -Z for mkdir in general

Otherwise on SELinux enabled systems with the "targeted" policy
the type is not set correctly when run via unconfined user and
the test fails.

2 months agohwdb: several fixes for sensor (#40576)
Yu Watanabe [Fri, 6 Feb 2026 06:13:54 +0000 (15:13 +0900)] 
hwdb: several fixes for sensor (#40576)

Let's respect for some devices that the accelerometer values must follow
the normal orientation of the panel and not the device one.

2 months agopcrextend: fix varlink API to match what we actually take
Lennart Poettering [Thu, 5 Feb 2026 15:01:08 +0000 (16:01 +0100)] 
pcrextend: fix varlink API to match what we actually take

(Change test case slightly, to ensure we don't regress on this)

2 months agoportablectl: Strip .v or .raw.v when extracting prefix
Louis Stagg [Tue, 3 Feb 2026 18:48:59 +0000 (18:48 +0000)] 
portablectl: Strip .v or .raw.v when extracting prefix

This allows a plain "portablectl attach foobar.raw.v" without needing to
specify a prefix.

2 months agohwdb: sensor: remove Asus T101HA and T101HAF 40576/head
David Santamaría Rogado [Thu, 5 Feb 2026 17:06:39 +0000 (18:06 +0100)] 
hwdb: sensor: remove Asus T101HA and T101HAF

T101HA reports corect values in monitor-sensor when no mount matrix is
defined and was added to correct KDE display output.

T101HAF original bug report stated that it corrects the display in KDE
so indeed this is wrong.

2 months agohwdb: sensor: recover Duet 3 10IGL5 normal and LTE
David Santamaría Rogado [Thu, 5 Feb 2026 16:59:54 +0000 (17:59 +0100)] 
hwdb: sensor: recover Duet 3 10IGL5 normal and LTE

The mount matrix was as intended, normal is when the device is in panel
orientation, not in device orientation.

2 months agohwdb: sensor: correct D330 respecting panel mount
David Santamaría Rogado [Thu, 5 Feb 2026 15:08:22 +0000 (16:08 +0100)] 
hwdb: sensor: correct D330 respecting panel mount

The matrix before was setting accel values to follow normal device
orientation, but the accel values must match the panel orientation that
in these devices is 90 degrees CCW.

Indicate how the panel is mounted in the comment. Could be interesting
to do it also for other devices because when desktop enviroments do it
right the user could be unaware of the panel mounting and could think
monitor-sensor output is bogus.

2 months agostat-util: introduce xstatx() (#40507)
Mike Yuan [Thu, 5 Feb 2026 15:51:57 +0000 (16:51 +0100)] 
stat-util: introduce xstatx() (#40507)

2 months agoupdate TODO
Lennart Poettering [Thu, 29 Jan 2026 11:11:40 +0000 (12:11 +0100)] 
update TODO

2 months agoVarious fixes related to mountfsd (#40564)
Daan De Meyer [Thu, 5 Feb 2026 15:39:28 +0000 (16:39 +0100)] 
Various fixes related to mountfsd (#40564)

2 months agopidfd-util: Remove unused include
Daan De Meyer [Thu, 5 Feb 2026 14:32:40 +0000 (15:32 +0100)] 
pidfd-util: Remove unused include

This snuck in when CI was broken.

2 months agonsresourced: Ensure that all user namespaces are cleaned-up
Christian Brauner [Wed, 4 Feb 2026 22:24:31 +0000 (23:24 +0100)] 
nsresourced: Ensure that all user namespaces are cleaned-up

The code here assumes that free_user_ns() is called for every single
user namespace. That however has never been the case and the logic for
free_user_ns() is a bit more involved.

A nested user namespace pins its parent user namespace. IOW, the
lifetime of the parent user namespaces is at least as long as the child
user namespaces.

If a parent user namespace becomes unused (no namespace file descriptors
or task using it anymore) then it will stick around and its lifetime
still bound to the child user namespace.

free_user_ns() takes advantage of that behavior. If a child user
namespace is freed and its parent user namespace is already unused then
then free_user_ns() will free both the child and the parent user
namespace. This means a single free_user_ns() frees two user namespaces.
Hence, the bpf program never sees the parent user namespace being freed.

We can fix this by piggy-backing on another function that is called for
every single user namespace being freed. This requires CONFIG_SYSCTL but
systemd doesn't work without that anyway.

The return type needs to change to a scalar type as required by libbpf.

Long-term what we need is appropriate LSM infrastructure for this
including hooks that get called on namespace destruction.

Thanks to Daan DeMeyer for figuring out that the cast is needed.

Signed-off-by: Christian Brauner <brauner@kernel.org>
2 months agonsresourced: Add comment about mknod() hook covering regular files 40564/head
Daan De Meyer [Mon, 26 Jan 2026 20:39:34 +0000 (21:39 +0100)] 
nsresourced: Add comment about mknod() hook covering regular files

2 months agonsresourced: Fix typo
Daan De Meyer [Sun, 25 Jan 2026 20:21:22 +0000 (21:21 +0100)] 
nsresourced: Fix typo

2 months agomountfsd: Always open_tree() in mount namespace of peer
Daan De Meyer [Sat, 24 Jan 2026 19:52:14 +0000 (20:52 +0100)] 
mountfsd: Always open_tree() in mount namespace of peer

open_tree() will fail with EINVAL when passed a directory file descriptor
that comes from another mount namespace. While this should be fixed in a
future kernel, let's workaround the issue for now by entering the mount
namespace of the peer if needed and calling open_tree() there and then
passing the fd back to the mountfsd process.

2 months agoudev: fix performance regression in resolving event dependencies (#40364)
Daan De Meyer [Thu, 5 Feb 2026 13:14:47 +0000 (14:14 +0100)] 
udev: fix performance regression in resolving event dependencies (#40364)

Fixes #39583.
Fixes #39817.

2 months agostat-util: drop now unused statx_warn_mount_{id,root}() 40507/head
Mike Yuan [Thu, 29 Jan 2026 09:59:42 +0000 (10:59 +0100)] 
stat-util: drop now unused statx_warn_mount_{id,root}()

2 months agovarious: use xstatx()
Mike Yuan [Thu, 29 Jan 2026 09:48:43 +0000 (10:48 +0100)] 
various: use xstatx()

2 months agoREADME: list STATX_MNT_ID_UNIQUE and AT_HANDLE_MNT_ID_UNIQUE
Mike Yuan [Thu, 5 Feb 2026 04:37:29 +0000 (05:37 +0100)] 
README: list STATX_MNT_ID_UNIQUE and AT_HANDLE_MNT_ID_UNIQUE

2 months agomountpoint-util: rework name_to_handle_at() unique mount id handling
Mike Yuan [Thu, 5 Feb 2026 00:32:59 +0000 (01:32 +0100)] 
mountpoint-util: rework name_to_handle_at() unique mount id handling

name_to_handle_at_try_unique_mntid_fid() in its current form is
ill-designed for various reasons:

* AT_HANDLE_FID requires file system support, while unique mount id
  is a VFS concept hence is always available if supported. Hence
  the fallback for AT_HANDLE_MNT_ID_UNIQUE should be independent
  of fid.
* The request for AT_HANDLE_MNT_ID_UNIQUE can be identified via
  specifying ret_unique_mnt_id, no need for opening up the control
  to caller (and currently the function simply doesn't handle
  mismatch between ret params and flags).
* The caller cannot realistically differentiate whether the returned
  mount id is actually unique.
* The path_get_unique_mnt_id() fallback did not handle AT_SYMLINK_FOLLOW.

Let's instead move the statx() fallback into name_to_handle_at_loop()
directly, and revamp interaction of ret_mnt_id/ret_unique_mnt_id:
if both are set, it indicates that the caller can handle both, hence
set what we have and return 0/1 for whether we managed to acquire
the unique one.

The !ret_handle && ret_mnt_id logic is removed. Let's not rely on
undocumented bizaare behavior and it's unused anyways.
path_get_mnt_id_at() exists for a reason...

2 months agomountpoint-util: port to xstatx(), support XAT_FDROOT
Mike Yuan [Thu, 29 Jan 2026 09:20:00 +0000 (10:20 +0100)] 
mountpoint-util: port to xstatx(), support XAT_FDROOT

2 months agostat-util: introduce xstatx()
Mike Yuan [Thu, 29 Jan 2026 08:23:35 +0000 (09:23 +0100)] 
stat-util: introduce xstatx()

2 months agobasic: add generated statx_mask_one_to_name()/statx_attribute_to_name()
Mike Yuan [Wed, 4 Feb 2026 22:30:42 +0000 (23:30 +0100)] 
basic: add generated statx_mask_one_to_name()/statx_attribute_to_name()

2 months agofd-util: add generic resolve_xat_fdroot()
Mike Yuan [Thu, 29 Jan 2026 10:27:40 +0000 (11:27 +0100)] 
fd-util: add generic resolve_xat_fdroot()

As suggested in
https://github.com/systemd/systemd/pull/40500#discussion_r2740921215

2 months agoshared/find-esp: STATX_MNT_ID is no longer needed as we rely on _ATTR_MOUNT_ROOT
Mike Yuan [Thu, 29 Jan 2026 09:49:56 +0000 (10:49 +0100)] 
shared/find-esp: STATX_MNT_ID is no longer needed as we rely on _ATTR_MOUNT_ROOT

Follow-up for a98a6eb95cc980edab4b0f9c59e6573edc7ffe0c

2 months agoportable-util: drop spurious -ENXIO check for xdg_user_config_dir()
Mike Yuan [Mon, 2 Feb 2026 09:50:40 +0000 (10:50 +0100)] 
portable-util: drop spurious -ENXIO check for xdg_user_config_dir()

Unlike $XDG_RUNTIME_DIR the user config dir has a default
value, hence -ENXIO is not really expected.

2 months agoboot/efi-string: use QUOTES macro, shorten the code a bit
Mike Yuan [Wed, 4 Feb 2026 18:32:51 +0000 (19:32 +0100)] 
boot/efi-string: use QUOTES macro, shorten the code a bit

Follow-up for a8f2f5d71786c2cf36e32f856cc329413a76cd93

2 months agotest-uid-range: Migrate to new assertion macros
Daan De Meyer [Sun, 25 Jan 2026 08:33:00 +0000 (09:33 +0100)] 
test-uid-range: Migrate to new assertion macros

2 months agonamespace-util: Fix logging in userns_enter_and_pin()
Daan De Meyer [Fri, 23 Jan 2026 18:15:15 +0000 (19:15 +0100)] 
namespace-util: Fix logging in userns_enter_and_pin()

2 months agomkosi: update mkosi ref to 215a9497ccc089ba030da39e15e9e2371efad3cb (#40573)
Daan De Meyer [Thu, 5 Feb 2026 13:06:45 +0000 (14:06 +0100)] 
mkosi: update mkosi ref to 215a9497ccc089ba030da39e15e9e2371efad3cb (#40573)

215a9497cc fedora: Use N-1 key as well when querying rawhide GPG key
842a37ed6c Add MakeScriptsExecutable= setting to optionally try to
make scripts executable before bailing out
814f2004bb build(deps): bump github/codeql-action from 4.31.9 to
4.32.0
d8f4f628bf build(deps): bump actions/checkout from 6.0.1 to 6.0.2
3e55361142 docs: remove superfluous definition colon
5901524c48 mkosi-tools: add libarchive-tools package.
968392f1b9 docs: Add information about gui mkosi-tools profile
0e2960c245 Add missing call to run_locale_gen()
41cd2067bc rpm: Set pkgverify_level to digest
86fe0f448a dnf: Give advanced users some control over plugins
50a1feee52 run: Improve sandbox command logging
b1dffe1c3c Fix environment variable name for systemd-repart
07726068d9 Allow specifying "default" value for Initrds=
704f163ec0 Allow setting PORTABLE_PREFIXES= via Environment=
e6588afb45 opensuse: More GPG key handling fixes
c367f993dd opensuse: Fetch remote keys as well if RepositoryKeyFetch=
is enabled
31852c9314 ci: Use mkosi box for unit test CI as well
e4229f5bf5 Make sure we pass the right context to
finalize_default_initrd()
9b431b783a tools: don't pull in virtiofsd in bookworm tools trees
ae2d88d463 build(deps): bump github/codeql-action from 4.31.6 to
4.31.9
933401a8b6 build(deps): bump actions/checkout from 6.0.0 to 6.0.1
6bfeb4ac86 opensuse: Import GPG keys for all repositories
9829b9136f Add support for locale-gen
63ae86ec04 nixos: Use repository key fetching by default on nixos
f01ca9904b docs: Reword dependencies vs tools tree requirement a bit
ab47ba25ef docs: Minor correction on enabling unprivileged namespaces
7bd46a417e docs: Update unprivileged user namespace docs

2 months agomkosi: update mkosi ref to 14d2d37a1923c03062f55454b2b61d0c64db6238 40573/head
Daan De Meyer [Thu, 5 Feb 2026 12:10:35 +0000 (13:10 +0100)] 
mkosi: update mkosi ref to 14d2d37a1923c03062f55454b2b61d0c64db6238

14d2d37a19 sandbox: Make sure we're dumpable before writing uidmap files
215a9497cc fedora: Use N-1 key as well when querying rawhide GPG key
842a37ed6c Add MakeScriptsExecutable= setting to optionally try to make scripts executable before bailing out
814f2004bb build(deps): bump github/codeql-action from 4.31.9 to 4.32.0
d8f4f628bf build(deps): bump actions/checkout from 6.0.1 to 6.0.2
3e55361142 docs: remove superfluous definition colon
5901524c48 mkosi-tools: add libarchive-tools package.
968392f1b9 docs: Add information about gui mkosi-tools profile
0e2960c245 Add missing call to run_locale_gen()
41cd2067bc rpm: Set pkgverify_level to digest
86fe0f448a dnf: Give advanced users some control over plugins
50a1feee52 run: Improve sandbox command logging
b1dffe1c3c Fix environment variable name for systemd-repart
07726068d9 Allow specifying "default" value for Initrds=
704f163ec0 Allow setting PORTABLE_PREFIXES= via Environment=
e6588afb45 opensuse: More GPG key handling fixes
c367f993dd opensuse: Fetch remote keys as well if RepositoryKeyFetch= is enabled
31852c9314 ci: Use mkosi box for unit test CI as well
e4229f5bf5 Make sure we pass the right context to finalize_default_initrd()
9b431b783a tools: don't pull in virtiofsd in bookworm tools trees
ae2d88d463 build(deps): bump github/codeql-action from 4.31.6 to 4.31.9
933401a8b6 build(deps): bump actions/checkout from 6.0.0 to 6.0.1
6bfeb4ac86 opensuse: Import GPG keys for all repositories
9829b9136f Add support for locale-gen
63ae86ec04 nixos: Use repository key fetching by default on nixos
f01ca9904b docs: Reword dependencies vs tools tree requirement a bit
ab47ba25ef docs: Minor correction on enabling unprivileged namespaces
7bd46a417e docs: Update unprivileged user namespace docs

2 months agofetch-mkosi: Shorten commit message title
Daan De Meyer [Thu, 5 Feb 2026 09:53:09 +0000 (10:53 +0100)] 
fetch-mkosi: Shorten commit message title

Currently github truncates the message so let's make it a little shorter
so it's not truncated.

2 months agosleep: allow HibernateDelaySec and low-battery hibernation to work together
gvenugo3 [Tue, 3 Feb 2026 03:57:30 +0000 (20:57 -0700)] 
sleep: allow HibernateDelaySec and low-battery hibernation to work together

Previously, setting HibernateDelaySec= would disable ACPI battery trip
point (_BTP) alarms, forcing the system to rely solely on software
polling for battery checks. This could result in the battery draining
to 0% between polling intervals, causing data loss.

Now, when ACPI _BTP is available AND HibernateDelaySec= is set, both
mechanisms work together. The system will hibernate on whichever comes
first: low battery (instant hardware alarm) or the configured timeout.

This also properly respects HibernateOnACPower=no by resetting the
timer while on AC power, matching the documented behavior.

Fixes: https://github.com/systemd/systemd/issues/26498
2 months agoInitial tweaks for the report tool (#40568)
Zbigniew Jędrzejewski-Szmek [Thu, 5 Feb 2026 09:15:39 +0000 (10:15 +0100)] 
Initial tweaks for the report tool (#40568)

2 months agometrics/report: add log messages, do not hang if no metrics are found 40568/head
Zbigniew Jędrzejewski-Szmek [Wed, 4 Feb 2026 17:20:11 +0000 (18:20 +0100)] 
metrics/report: add log messages, do not hang if no metrics are found

If the directory existed but was empty, we'd hang in the event loop.

2 months agometrics/report: use _cleanup_, avoid goto
Zbigniew Jędrzejewski-Szmek [Wed, 4 Feb 2026 16:57:24 +0000 (17:57 +0100)] 
metrics/report: use _cleanup_, avoid goto

2 months agopid1: shorten message about jobs skipped after failed condition checks
Zbigniew Jędrzejewski-Szmek [Wed, 4 Feb 2026 09:21:43 +0000 (10:21 +0100)] 
pid1: shorten message about jobs skipped after failed condition checks

I was looking at some logs on a console, and because of the lengthy message,
the actually interesting part, i.e. what condition failed, didn't even fit
on the screen. Let's make the sentence legible but brief.

2 months ago[metrics] Introduce metrics API (#39202)
Zbigniew Jędrzejewski-Szmek [Wed, 4 Feb 2026 15:31:55 +0000 (16:31 +0100)] 
[metrics] Introduce metrics API (#39202)

See the [design
doc](https://github.com/systemd/systemd/issues/38023#issue-3192567450)
by @ikruglov

This PR introduces the metrics API framework, adds some basic system
wide/per unit/service metrics, and a basic CLI. The PR is broken into
two commits as described below.

### Deviations from the original design
- Introduced top level field "object" for ease of filtering. Instead of
having `fields: { unit: "foo", unit_type: "service" }`, we now have
`object: foo.service` as the top level field.

### First commit

The first commit includes:
- Metrics API definitions
- Code to set up the varlink server
- The describe method which shows all the metrics families
- The list method which lists all the metrics
- Type definitions related to MetricFamily
- Common code to build json objects

### Second commit
The second commit adds some basic metrics, a basic CLI (systemd-report)
which
lists the metrics, and integration tests.

**System wide metrics:**
- units_by_type_total
- units_by_state_total

**Two per unit metrics:**
- unit_active_state
- unit_load_state

**A service state metric:**
- nrestarts

### Sample outputs

**units_by_type_total**:

```
{
        "name" : "io.systemd.Manager.units_by_type_total",
        "value" : 52,
        "fields" : {
                "type" : "target"
        }
}
{
        "name" : "io.systemd.Manager.units_by_type_total",
        "value" : 82,
        "fields" : {
                "type" : "device"
        }
}
{
        "name" : "io.systemd.Manager.units_by_type_total",
        "value" : 2,
        "fields" : {
                "type" : "automount"
        }
}
```
**units_by_state_total**:
```
{
        "name" : "io.systemd.Manager.units_by_state_total",
        "value" : 216,
        "fields" : {
                "state" : "active"
        }
}
{
        "name" : "io.systemd.Manager.units_by_state_total",
        "value" : 0,
        "fields" : {
                "state" : "reloading"
        }
}
{
        "name" : "io.systemd.Manager.units_by_state_total",
        "value" : 120,
        "fields" : {
                "state" : "inactive"
        }
}
```
**unit_active_state**:
```
{
        "name" : "io.systemd.Manager.unit_active_state",
        "object" : "multi-user.target",
        "value" : "active"
}
{
        "name" : "io.systemd.Manager.unit_active_state",
        "object" : "systemd-sysusers.service",
        "value" : "inactive"
}
```
**unit_load_state**:
```
{
        "name" : "io.systemd.Manager.unit_load_state",
        "object" : "multi-user.target",
        "value" : "loaded"
}

```
**nrestarts**:
```
{
        "name" : "io.systemd.Manager.nrestarts",
        "object" : "user@0.service",
        "value" : 0
}
{
        "name" : "io.systemd.Manager.nrestarts",
        "object" : "user-runtime-dir@0.service",
        "value" : 0
}
```

2 months agoefi-string: Unquote single-quoted strings as well as double
James Le Cuirot [Tue, 27 Jan 2026 17:12:34 +0000 (17:12 +0000)] 
efi-string: Unquote single-quoted strings as well as double

This code is used to read data copied from /etc/os-release. According to
the spec[1], values can be enclosed in single quotes or double quotes.
Not handling single quotes results in the quotes appearing in the
systemd-boot menu, e.g. 'Gentoo Linux'.

[1] https://www.freedesktop.org/software/systemd/man/latest/os-release.html

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2 months agobash-completion/vmspawn: add -x/--ephemeral
Yu Watanabe [Wed, 4 Feb 2026 06:47:44 +0000 (15:47 +0900)] 
bash-completion/vmspawn: add -x/--ephemeral

Follow-up for 6e67fc2938ad690a065a984c5813c6b5c0e48806.

2 months agonetworkd-json: add human-readable address strings for IP addresses
gvenugo3 [Fri, 23 Jan 2026 02:38:30 +0000 (19:38 -0700)] 
networkd-json: add human-readable address strings for IP addresses

Add JSON_BUILD_PAIR_IN_ADDR_WITH_STRING, JSON_BUILD_PAIR_IN6_ADDR_WITH_STRING,
and JSON_BUILD_PAIR_IN4_ADDR_WITH_STRING macros (plus _NON_NULL variants) that
emit both the binary address array and a human-readable string representation.

For example, an address field now emits both:
  "Address": [192, 168, 1, 1]
  "AddressString": "192.168.1.1"

This improves usability of the JSON/Varlink output for debugging and tooling
that consumes networkd state.

Updated networkd-json.c to use these new macros for addresses, neighbors,
nexthops, routes, routing policy rules, DNS servers, NTP servers, SIP servers,
domains, DHCPv6 prefixes, and link-local addresses.

Also updated the Varlink interface definitions to include the new string fields.

2 months agosysext: Skip refresh if no changes are found (#39980)
Lennart Poettering [Wed, 4 Feb 2026 09:30:10 +0000 (10:30 +0100)] 
sysext: Skip refresh if no changes are found (#39980)

When the extensions for the final system are already set up from the
    initrd we should avoid disrupting the boot process with the remount
    (which currently isn't atomic) and the daemon reload for
systemd-confext and systemd-sysext. Similarly, when sysupdate ran and
updated extensions it's best to avoid the remount and daemon reload if
    no changes are found.
    To do this, encode the current extension state in more detail than
    before where only the names of the extensions where encoded in the
overlay mount. This can also be used to provide more details about the
    extension origin in "systemd-sysext status (--json=)". During the
refresh add a check whether the old state matches the new state and in
    this case skip the refresh unless the user provides a flag to always
    refresh. Besides the extension name and the resolved path the best
method for identification is the verity hash but that is not available
for plain image files or directories. Therefore, also include data to
check for file/directory replacements. The creation/modification times
are not always real on reproducible images or extracted archive content.
    The file handle together with the unique mount ID is the next best
identifier we can use when we have no verity hash. Fall back to an inode
when we get no handle. With the creation/modification time and the path
this should be good enough. Using a unique mount ID is important (with
a fallback to the regular non-unique mount ID) instead of st_dev because
    st_dev gets reused too easily, e.g., by a loop device mount and the
mount ID helps to catch this. For the mount ID to be valid it has to be
resolved before we enter the new mount namespace. Thus, it gets provided
    by the image dissect logic and handed over to the sysext subprocess
    which runs in a new mount namespace.
    Luckily, we can rule out online modification of directories or image
files because this is anyway not well supported with overlay mounts, so
we don't do a file checksum nor do we recurse into a directory to look
    for the most recently touched files.  But, as said, with the
    always-refresh flag one can force a reload.

2 months agoudev: do not build full list of dependencies 40364/head
Yu Watanabe [Fri, 16 Jan 2026 19:14:05 +0000 (04:14 +0900)] 
udev: do not build full list of dependencies

Suppose the following dependent events are queued:

A(1000) -> C(1002)
                   \
                     --> E(1004)
                   /
B(1001) -> D(1003)

Here, each number is the seqnum of the event, and A -> B means that
event B depends on event A, that is, event B cannot be started until
event A is processed.

In this case, to know if event E can be started, we only need to check
if event C and D are processed, and not necessary to check the state of
event A or B.

However, the commit e1ae931064be9483aa98249294f6e195537f43d1 introduced
full dependency list (in the above example, all A, B, C, D are listed as
the blocker for E), but it is overkill and most information is not necessary.
Also, before the commit e1ae931064be9483aa98249294f6e195537f43d1, we
found blocker from the beginning of the queued events, but that's also
not necessary, as even A is processed, still C may be queued, and we
anyway need to check if C is processed or not.

This makes each event only stores the last blocker event for the event,
and finds the blocker from the end of the queue. With this change, the
memory cost can be reduced from O(n^2) to O(n). Also, as previously we
used Set for managing blockers, but now we only increment/decrement
the reference counter of events, so the speed should be also improved.

Fixes #39583 and #39817.