Commit Graph
86077 Commits
Author SHA1 Message Date
Nick Rosbrook e28958315f 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
2026-02-07 00:14:37 +01:00
Lennart Poettering a53e369786 tests: don't use dd anymore for allocating empty test disk images (#40583) 2026-02-06 21:03:55 +01:00
Lennart Poettering 43ef7c944c 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.
2026-02-06 21:01:37 +01:00
Lennart Poettering 0c9de6daee 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.
2026-02-06 20:10:24 +01:00
Lennart Poettering ab89fad427 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.
2026-02-06 18:19:33 +01:00
Lennart Poettering dd2676c1ab 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.
2026-02-06 18:19:33 +01:00
Yu Watanabe 5f815d6fa1 metrics: fix typo
Follow-up for fd73cd6c91.
2026-02-06 15:20:28 +09:00
Yu Watanabe 06a806aed8 udev: fix typo
Follow-up for b7363d3330.
2026-02-06 15:20:28 +09:00
Cathy Hu d3761f1509 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.
2026-02-06 15:15:10 +09:00
Yu Watanabe 79685ed12d 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.
2026-02-06 15:13:54 +09:00
Lennart Poettering 823054d079 pcrextend: fix varlink API to match what we actually take
(Change test case slightly, to ensure we don't regress on this)
2026-02-06 15:08:51 +09:00
Louis Stagg 23c6ab3971 portablectl: Strip .v or .raw.v when extracting prefix
This allows a plain "portablectl attach foobar.raw.v" without needing to
specify a prefix.
2026-02-05 23:12:18 +01:00
David Santamaría Rogado b3786e0296 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.
2026-02-05 18:08:44 +01:00
David Santamaría Rogado f952bc5551 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.
2026-02-05 18:08:44 +01:00
David Santamaría Rogado c399daf567 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.
2026-02-05 18:08:44 +01:00
Mike Yuan a3ecd774db stat-util: introduce xstatx() (#40507) 2026-02-05 16:51:57 +01:00
Lennart Poettering bd5e7903cf update TODO 2026-02-05 16:39:38 +01:00
Daan De Meyer dd8c07da04 Various fixes related to mountfsd (#40564) 2026-02-05 16:39:28 +01:00
Daan De Meyer cbd2e08f00 pidfd-util: Remove unused include
This snuck in when CI was broken.
2026-02-05 16:18:35 +01:00
Christian Brauner e8416e854b 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>
2026-02-05 15:32:15 +01:00
Daan De Meyer 14054134c6 nsresourced: Add comment about mknod() hook covering regular files 2026-02-05 15:16:31 +01:00
Daan De Meyer d1ae0e5205 nsresourced: Fix typo 2026-02-05 15:16:31 +01:00
Daan De Meyer b4bfacf496 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.
2026-02-05 15:16:29 +01:00
Daan De Meyer 8b6d8ec66f udev: fix performance regression in resolving event dependencies (#40364)
Fixes #39583.
Fixes #39817.
2026-02-05 14:14:47 +01:00
Mike Yuan 9feb490633 stat-util: drop now unused statx_warn_mount_{id,root}() 2026-02-05 14:14:40 +01:00
Mike Yuan 10072d8be4 various: use xstatx() 2026-02-05 14:14:40 +01:00
Mike Yuan 60464c9514 README: list STATX_MNT_ID_UNIQUE and AT_HANDLE_MNT_ID_UNIQUE 2026-02-05 14:14:40 +01:00
Mike Yuan 5817c73391 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...
2026-02-05 14:14:40 +01:00
Mike Yuan 56adac1193 mountpoint-util: port to xstatx(), support XAT_FDROOT 2026-02-05 14:14:39 +01:00
Mike Yuan 1cf84c5642 stat-util: introduce xstatx() 2026-02-05 14:14:39 +01:00
Mike Yuan 6b039272e9 basic: add generated statx_mask_one_to_name()/statx_attribute_to_name() 2026-02-05 14:14:39 +01:00
Mike Yuan 539e2b75aa fd-util: add generic resolve_xat_fdroot()
As suggested in
https://github.com/systemd/systemd/pull/40500#discussion_r2740921215
2026-02-05 14:14:39 +01:00
Mike Yuan 3065bc80cb shared/find-esp: STATX_MNT_ID is no longer needed as we rely on _ATTR_MOUNT_ROOT
Follow-up for a98a6eb95c
2026-02-05 14:14:39 +01:00
Mike Yuan 7dc7cc02fb 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.
2026-02-05 14:14:38 +01:00
Mike Yuan de0da85d41 boot/efi-string: use QUOTES macro, shorten the code a bit
Follow-up for a8f2f5d717
2026-02-05 14:14:38 +01:00
Daan De Meyer 4de6855171 test-uid-range: Migrate to new assertion macros 2026-02-05 14:09:03 +01:00
Daan De Meyer f3b81859c2 namespace-util: Fix logging in userns_enter_and_pin() 2026-02-05 14:09:03 +01:00
Daan De Meyer d2f55e7079 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
2026-02-05 14:06:45 +01:00
Daan De Meyer 42c0a25a21 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
2026-02-05 13:10:35 +01:00
Daan De Meyer 7bb0bd400f fetch-mkosi: Shorten commit message title
Currently github truncates the message so let's make it a little shorter
so it's not truncated.
2026-02-05 10:53:09 +01:00
gvenugo3 8950f64263 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
2026-02-05 10:28:47 +01:00
Zbigniew Jędrzejewski-Szmek 2ac64e5715 Initial tweaks for the report tool (#40568) 2026-02-05 10:15:39 +01:00
Zbigniew Jędrzejewski-Szmek dffcb61f7f 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.
2026-02-04 18:20:11 +01:00
Zbigniew Jędrzejewski-Szmek ab4028c47a metrics/report: use _cleanup_, avoid goto 2026-02-04 17:57:24 +01:00
Zbigniew Jędrzejewski-Szmek 7a1e761070 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.
2026-02-04 16:33:26 +01:00
Zbigniew Jędrzejewski-Szmek e047394797 [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
}
```
2026-02-04 16:31:55 +01:00
James Le Cuirot a8f2f5d717 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>
2026-02-04 23:58:06 +09:00
Yu Watanabe b3d73bc68e bash-completion/vmspawn: add -x/--ephemeral
Follow-up for 6e67fc2938.
2026-02-04 11:22:27 +01:00
gvenugo3 cf27c70d70 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.
2026-02-04 10:34:30 +01:00
Lennart Poettering 13d82876f5 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.
2026-02-04 10:30:10 +01:00