Commit Graph
871 Commits
Author SHA1 Message Date
Lennart Poettering 8a9b726de0 vpick: honour the "user.uapi.match_…" extended attributes of entries
systemd-sysupdate copies the "user.uapi.match_…" extended attributes of files
in UAPI.16 manifests onto the files it installs, which restrict the
files to specific systems (hostname, machine ID, machine tags, os-release
image/OS ID and version). Let's honour them when picking entries from
.v/ directories too: entries whose extended attributes don't match the
local system are skipped, as if they didn't exist. The system properties
are only loaded once an entry actually carries one of the attributes.

Entries referenced literally, i.e. without making use of .v/ logic, are
not filtered.

This may be turned off with the new PICK_IGNORE_XATTR_MATCH flag, which
systemd-vpick exposes as --match-xattr=no.
2026-11-02 15:57:51 +01:00
Lennart Poettering 6c948ad574 shell-completion: add bash and zsh completion for systemd-repart
systemd-repart had no shell completion so far. Add one for bash and
zsh, covering all options, including the new manifest generation ones.
2026-11-02 10:23:09 +01:00
Daan De Meyer 91c98ff15c analyze: introduce restart-delays command
Working out how long the service manager keeps restarting a failing service
takes the exponential backoff formula from systemd.service(5) and a manual
simulation of the start rate limit. Getting either wrong means a service
that's supposed to fail after a while is restarted forever.

Let's add a restart-delays command that does both. It lists each restart
until the delay stops growing, with the total of the delays up to that
restart, and then says whether the start rate limit rejects a restart and
when. Like security, it reads the settings of loaded units from the service
manager, or loads unit files with --offline=yes. With --json=, it prints the
same data as a JSON object.

The command computes the delays with the same functions as the service
manager. It checks the start rate limit with ratelimit_below_at() for each
restart until the delay stops growing. After that, every restart waits the
same delay. We then compute the rejected restart from the number of starts
that the current window of the rate limit still allows.
2026-11-01 21:06:54 +01:00
Yu Watanabe f57b0b3104 udevadm-wait: send notification (#44550) 2026-11-01 08:28:04 +09:00
Lennart Poettering aef3e7fd3a manifest: add new systemd-manifest tool
A small tool that generates file manifests of plain directory trees in
the four formats manifest-util knows (simple list, SHA256SUMS, mtree,
UAPI.16), and verifies directory trees against such manifests. It
works on plain directories only, i.e. does not dissect images, for that
systemd-dissect --uapi16/--sha256sums/--mtree/--list remain available
and share the same code.

The format is selected with --format=, and the fields to include or
check with --field= (defaulting to what systemd-dissect emits). For
mtree manifests --hash= selects SHA512 instead of SHA256. All
positional arguments are optional: the directory defaults to the
current directory, "make" writes to standard output unless a file is
specified, and "verify" reads the manifest from standard input unless a
file is specified.

Generation fails if inodes had to be skipped or some of their metadata
had to be omitted (for example because of missing privileges), unless
--graceful is specified, in which case we only insist that the
top-level inode is covered.
2026-10-31 20:02:20 +01:00
Lennart Poettering 4bc279fed1 shell-completion: update systemd-dissect shell completion to current state
Follow-up for: cb90ffc033
2026-10-31 19:58:58 +01:00
Yu Watanabe 07111a11ed udevadm-wait: add --notify option to send notifications
With this, 'udevadm wait' can be used in a Type=notify service, and the
caller can know when it has started watching the devices.
2026-11-01 00:29:19 +09:00
Luca Boccassi ab658dce09 sd-notify: add --fdstore-wipe parameter 2026-10-31 10:20:31 +00:00
Luca Boccassi d427bf0f0a sd-notify: add bash completion script 2026-10-31 10:20:30 +00:00
Yu Watanabe 88d39e7d3f Add /etc/machine-tags.d/ (#43851) 2026-10-31 14:20:52 +09:00
Zbigniew Jędrzejewski-Szmek 8b7d084510 hostnamectl: add --apply switch for the tags verb
"hostnamectl tags --apply" asks systemd-hostnamed to apply the
machine-tags.d/ configuration via the new ApplyTags() Varlink call.
As the call is only available via Varlink, the switch is not supported
together with --host= or --machine=.
2026-10-30 16:56:37 +01:00
Michael Vogt ced33dc3c0 varlinkctl: add new --polkit-action= to varlinkctl serve
When providing ad-hoc protocol upgrade support to existing programs
via the `varlinkctl serve` command it is often useful/desirable
to limit it to a certain polkit action. So we add a new flag called
`--polkit-action=` here that does exactly this. The protocol upgrade
is only allowed when the given polkit action is allowed for the
user.

Thanks to Lennart for suggesting this in PR#43994
2026-10-28 09:20:42 +01:00
Eisuke Kawashima 9ff4c4dc63 zsh: add missing linebreak to _systemd-tmpfiles (#44474)
Follow-up for b732d737ef
2026-10-27 21:14:39 +00:00
Luca Boccassi 48493bc9d3 meson: add feature flag for storage
storage builds and installs binaries, docs, units, etc. Add a
feature flag to make it easier to avoid shipping it.
2026-10-25 09:34:00 +09:00
Yu Watanabe 78a59faec6 bash-completion/cgtop: several fixlets
- Missing '--' for compgen, and '-o nospace' and '-o dirnames' are
  for compopt rather than compgen,
- add missing '-1' completion.
- argument of --cpu is optional, hence it must be concatenated with '=',
- drop unnecessary assignments for cur and prev.
2026-10-22 08:13:17 +09:00
Lennart Poettering 15a0296d06 nspawn: add --console=broker that registers the container console with ptyd 2026-10-21 13:19:49 +02:00
Lennart Poettering 06645af72c vmspawn: add broker based console 2026-10-21 13:19:49 +02:00
Lennart Poettering d166b4c123 ptyctl: add new client tool for ptybrokerd 2026-10-21 13:19:49 +02:00
Lennart Poettering 0cba4522db ptyfwd-tool: introduce new --console= switch for connecting to ptybrokerd 2026-10-21 13:19:49 +02:00
Yu Watanabe 0d195ea931 coredump: assign random UUID for each crash
Then, make it possible to specify core by the UUID in coredumpctl.

This is typically useful to specify a crash that the same executable
crashes multiple times, as PID may not be unique.
2026-10-21 04:18:53 +09:00
Yu Watanabe ba73e2469b coredumpctl: introduce new option -l/--full 2026-10-19 08:29:15 +09:00
Lennart Poettering db34d7f479 report: add a simple geoip source 2026-10-17 07:52:31 +02:00
Luca Boccassi 9b9c54a3fb ukify: add shell completion
Modeled after mkosi, add a verb that takes bash/zsh as parameter
and spits out the corresponding completion script.
2026-10-15 11:30:00 +02:00
Sebastian Wick dc4238b256 varlinkctl: Add monitor subcommand for live varlink traffic capture
Add "varlinkctl monitor" which connects to systemd-varlink-monitord and
displays captured varlink messages in real time, with both pretty-printed
and JSON-SEQ output modes. Supports filtering by --pid, --path, and
--uid. Includes integration tests covering pre-existing sockets, new
sockets, filtering, large message reassembly, garbage data handling, and
JSON output validation.
2026-10-14 13:53:03 +02:00
Lennart Poettering a814660eb6 sysupdate: add --loop= switch
Installing an update might make further updates available, for example
because the update ships new or changed transfer files, components, or
system extensions containing such files. Hence add a new --loop=N
switch, which runs the update logic repeatedly, re-reading all
definitions each time, until either nothing is installed anymore, or N
iterations have been done.

If --reboot is specified the reboot is requested once, after the last
iteration.

Not specifying --loop= is equivalent to --loop=1, i.e. the behaviour
remains unchanged.
2026-10-13 09:34:28 +02:00
Lennart Poettering 999c93207e systemctl: add new "wait" command (#43585)
systemctl: add new "systemctl wait" command
   
It's quite useful being able to wait for a unit to be terminated and see
its exit data, just like we do it for systemd-run, without triggering
any other operation (which is what systemctl stop would do).

Fixes: #32017
2026-10-12 14:56:55 +02:00
Eric BoucherandZbigniew Jędrzejewski-Szmek 34127b7c4c cgtop: make root row default to cgroup with '/' to toggle
The root row in systemd-cgtop previously displayed whole-system RAM
usage read from /proc/meminfo (MemTotal - MemAvailable), not a cgroup
sum. This is a pragmatic fallback — the kernel intentionally does not
expose memory.current on the v2 root cgroup (see the existing
is_root_cgroup() comment about avoiding 'multiple truth about system
state'), so cgtop picked /proc/meminfo to fill the gap.

Nevertheless, that caued the '/' row to provide different information
than every other row in the table:
- All child rows: 'what is this cgroup charged for?' (anon + file
  + sock + shmem attributable to the cgroup).
- Root row: 'what is the whole system using?' (includes kernel
  slab, vmalloc, pagetables, zram mem_used, and anything not
  attributable to any cgroup).

On a typical desktop the root row can read ~10 GB while the sum of
direct children is ~5 GB, with no explanation visible in the tool
itself.

This commit:
  1. Introduces --root-memory= command line option.
  2. Flips the default for the root row to the sum of memory.current
     over its direct children.
  3. Adds a '/' interactive key that toggles between the two modes.
  4. Updates the interactive help string ('?' / 'h'), the man page,
     and the bash completion for the new option.

Inside a container (detect_container() > 0), is_root_cgroup() already
returns false, so none of this applies — the container's '/' still
reads memory.current from the namespaced cgroup as before.

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
2026-10-09 11:19:05 +02:00
Lennart Poettering 0e51517319 systemctl: add new "systemctl wait" command
It's quite useful being able to wait for a unit to be terminated and see
its exit data, just like we do it for systemd-run, without triggering
any other operation (which is what systemctl stop would do).

Fixes: #32017
2026-09-26 01:26:55 +02:00
Lennart Poettering ce8d684ed8 sysinstall: optionally, automatically pick target block device after a settle timeout
Let's make sysinstall useful for truly unattended installations, and let
it it automatically pick a target disk after some settlement time-out.
2026-09-23 10:14:25 +02:00
Yu Watanabe 724d18a22a analyze: introduce cpu-features command
This may be useful when configuring the ConditionCPUFeature= setting.
2026-09-23 12:51:26 +09:00
Lennart Poettering b0edc60661 dissect: optionally allow attaching images that do not qualify as DDIs with --attach
It's nice to use --attach since it validates our images. So far, it
strictly insisted on checking that the image was a DDI however, which
limits its use for certain usecases.

Add "--relax" to address this limitation.
2026-09-22 16:04:26 +02:00
Deniz Gözen a7fc55f865 bash-completion: systemctl: complete clean verb (#43681)
Add `clean` to the non-template unit verbs so it is suggested by
systemctl Bash completion and completes valid unit names.

Fixes #43670.
2026-09-08 02:28:24 +09:00
Jelle van der Waa ed9ce3f4f6 zsh: Add missing loginctl completion options 2026-08-31 17:43:17 +02:00
Jelle van der Waa ebab4a2486 zsh: Correct json output description for busctl 2026-08-31 17:43:15 +02:00
Jelle van der Waa b732d737ef zsh: Add --inline completion for systemd-tpmfiles 2026-08-31 17:02:29 +02:00
Jelle van der Waa ff7dd5edd8 zsh: Add missing --kernel-cmdline option in systemctl 2026-08-31 16:43:44 +02:00
Jelle van der Waa b457868e0c zsh: Add missing --tmp2-public-key-policyref 2026-08-31 16:43:44 +02:00
Jelle van der Waa 12217e71a2 zsh: Add missing -n shorthand for --dry-run
Both already an option in udevadm and systemd-tmpfiles.
2026-08-31 15:52:42 +02:00
Jelle van der Waa 55ed2ee63e shell-completion: Add -n option for bootctl
Introduced in f5ffb38606
2026-08-31 15:24:30 +02:00
Zbigniew Jędrzejewski-Szmek 3d0ef4aefe various: mark files with the usual license tags
For .clang-format and pytest.ini, MIT-0 is used because people might want
to copy those.
2026-08-28 06:26:09 +09:00
Parag Gupta 3bc5914676 shell-completion: zsh: complete options for systemctl show
zsh only ever offered unit names after `systemctl show`, since
_systemctl_show() was sharing the same completion function as
is-active/status/preset/etc., none of which recognize `-`-prefixed
words at all. This meant `systemctl show --<TAB>` and
`systemctl show --property <TAB>` produced no completions, even
though the same options complete fine before the subcommand word
(bash has always completed both cases correctly).

Give `show` its own completion function that first tries the
existing global option specs (now pulled out into a `_sys_arguments`
array so they can be reused) via _arguments, falling back to unit
name completion for everything else. The unit-name fallback is
factored into a shared _systemctl_non_template_units() helper so it
isn't duplicated between _systemctl_show() and the existing
NONTEMPLATE_UNITS loop.

While doing so, fix pre-existing bugs in that option list which this
change makes newly reachable (and, for the filters below, newly
relevant) after `show`:

- `-P` was documented as a bare `--privileged[Acquire privileges
  before execution]` flag, which systemctl does not have. `-P NAME`
  is actually short-only and equivalent to `--value --property=NAME`
  (src/systemctl/systemctl.c); it now completes property names the
  same way `-p`/`--property` do, and is grouped next to them instead
  of sitting in `--privileged`'s old, unrelated slot.
- `-p`/`--property`, `-t`/`--type`, and `--state` all lacked the `*`
  repeatability prefix, so completion stopped offering each after its
  first use even though systemctl accumulates all three
  (parse_property_argument()/parse_types_argument()/
  parse_states_argument(), all via strv_consume()). `_loginctl`
  already uses the correct `'*'{-p+,--property=}...` form for -p.
  -t/--type and --state are both documented as filters that apply to
  `show` specifically (man/systemctl.xml), same as -p/--property.
- `--value`, documented specifically for `show` ("When showing
  properties, only print the value"), was missing from the zsh
  completion entirely, though bash already completes it.
- `-M`/`--machine=` (OPTION_COMMON_MACHINE) was likewise missing,
  despite directly affecting `show`'s bus transport the same way the
  already-present `-H`/`--host` does; `_loginctl`/`_busctl` already
  have the matching `_sd_machines`-backed spec.

Also switch both `_arguments` call sites to splice `_sys_arguments`
as `"$_sys_arguments[@]"` rather than bare, matching the prevailing
quoted-array idiom used by five other completions in this directory
(_systemd-hwdb, _userdbctl, _systemd-id128, _updatectl,
_systemd-sysupdate) and avoiding the unquoted form's behavior of
silently eliding any element that becomes empty.

Fixes #37463
2026-08-25 10:22:01 +01:00
dongshengyuan 471e34d5cb homectl: write recovery key file via linkable tmpfile
Create the file with open_tmpfile_linkable_at().
Write the recovery key and trailing newline to the temporary fd.
Set the final mode to 0600 before publishing it.
Link it into place with link_tmpfile_at(..., LINK_TMPFILE_SYNC).
2026-08-25 06:57:32 +09:00
guolin 9269952ab2 shell-completion: add completion for machinectl restart
The `restart` verb was added to machinectl as a convenience alias for
`reboot`, but its shell completions were never updated. Add it to both
the bash and zsh completions.
2026-08-13 15:55:03 +01:00
Ivan Kruglov b3f76af401 shell-completion: offer --json= for the standalone verbs that support it
Several verbs in the STANDALONE bucket accept --json=, but that bucket only
offers --help --version --system --user --global --no-pager, so completion
never suggested the option for them.

Split those verbs out into a new STANDALONE_JSON bucket that additionally
offers --json=off/pretty/short. The verbs are moved rather than copied, as
${VERBS[*]} is used to complete the verb list itself.
2026-08-12 03:54:10 -07:00
dongshengyuan aec96077fa shell-completion: add updatectl completions
Add bash and zsh completions for updatectl commands and options.
Complete targets and host features dynamically from updatectl output.

Closes #43277
2026-08-06 12:12:09 +01:00
Nandakumar Raghavan 13aec9fddf networkctl,networkd: add --no-reconfigure flag to networkctl reload
Add a new --no-reconfigure flag to 'networkctl reload' that reloads
.network and .netdev files from disk without reconfiguring any network
interfaces. This may be useful to avoid reconfiguring multiple interfaces
simultaneously when multiple .network files are updated, or when an updated
.network file is applied to multiple interfaces.

On the networkd side, manager_reload() gains a reconfigure_links parameter
that gates the per-link reconfiguration loop. A new io.systemd.Network.Reload
varlink method is added that exposes this as an optional reconfigureLinks
boolean (defaults to true). Both plain 'networkctl reload' and
'--no-reconfigure' now unconditionally call this method first. If an older
networkd returns MethodNotFound, plain reload falls back to
io.systemd.service.Reload for backward compatibility; '--no-reconfigure'
fails with a clear error in that case.
2026-07-20 14:35:04 +09:00
Lennart Poettering 1cd217ee81 shell-completion: add shell completion for systemd-sysupdate 2026-07-15 13:27:48 +02:00
fuldeka 5924eab96e shell-completion: add new Argon2id TPM2 parameters for systemd-cryptenroll 2026-07-12 23:31:29 +02:00
Paul Meyer 34f0384c53 shell-completion: add tdx to systemd-vmspawn --coco values
Missed in a78afc1616 ("vmspawn: add Intel TDX confidential VM
support")

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-07-02 10:55:39 +01:00
wangzhaohui 104750fd60 shell-completion: add missing commands and options to timedatectl zsh
The zsh completion for timedatectl was missing three commands ('show',
'ntp-servers', 'revert') and five options (--monitor, -p/--property=,
-a/--all, --value, -P) that are already present in the bash completion,
documented in the man page, and implemented in the binary.

Fixes #16507
2026-06-29 10:35:13 +01:00