Commit Graph
273 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 541b1335f5 Rename KExecsCount to KExecCount 2026-09-22 14:38:02 +02:00
Yu Watanabe 15bd45d113 man: fix typos and grammar in various man pages 2026-09-17 02:25:12 +09:00
Morteza Pourkazemi 5f0d98e728 Add ActivatingConcurrencyMax for slice startup pacing
Introduce Slice.ActivatingConcurrencyMax to limit how many units
within a slice hierarchy may be in activating state concurrently.

Expose the setting over D-Bus, support transient/property parsing,
enforce it during unit start dispatch, and re-check queued starts when
units leave activating state.

Document the new slice option and add a PID1 concurrency test covering
queued startup behavior.
2026-08-03 14:29:07 +09:00
Luca Boccassi 0220732dba core: publish shutdown timestamps via D-Bus 2026-06-30 10:21:18 +01:00
Lennart Poettering cc174775f5 core: add socket xattr settings for socket unit 2026-06-23 22:55:23 +02:00
Luca BoccassiandMichal Koutný 7d3b32daef core: add method to enqueue multiple jobs in a single call
Currently only a single job for a single unit can be enqueued atomically,
so there is no guarantee that, e.g., starting a unit and its socket
at the same time will happen in the same transaction. That forces
callers to 'know' the right order in which to start new units being
installed, or failures will occur. It also means some ordering
constraints are ignored, in case the separate calls are done
in the wrong manual order.

Add a new EnqueueUnitJobMany() D-Bus method that takes a list of units
to start.

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

Co-authored-by: Michal Koutný <mkoutny@suse.com>
2026-06-22 13:01:17 +01:00
Michael Vogt 046de3caea core: add RestartRandomizedDelaySec= service option
We already support exponential backoff for automatic restarts via
RestartSec=/RestartSteps=/RestartMaxDelaySec=, but there is no way to
randomize the restart delay. When many instances of a service fail at
the same time (e.g. because a shared resource briefly went away) they
are all restarted in lockstep, creating a thundering herd problem.

So this commit adds a simple `RestartRandomizedDelaySec=` service
option which is similar to the timer `RandomizedDelaySec=` and
adds a randomized restart delay.
2026-06-20 12:31:28 +02:00
Luca Boccassi f9e6419f34 core: add KExecsCount property
Use LUO to count kexec reboots, and expose through a new property

Fixes https://github.com/systemd/systemd/issues/42581
2026-06-19 19:36:01 +01:00
Luca Boccassi 82b8615463 core: add LUOSession= unit setting
Acquiring a LUO session from /dev/liveupdate requires privileges,
and also the device is a single-owner driver so only a single
process can open it at any given time.

Add a LUOSession= service settings that allows units running
without privileges to get a session assigned to them.

The kernel imposes a 64 chars limit on session names, which is
too short to avoid clashes, so derive a hash from joining the
unit name with the parameter name, that way two units using
the same setting don't clash.
2026-06-17 13:11:15 +01:00
Matteo Croce 15783e4657 oomd: ruleset parsing
Add to oomd the capability to define rulesets in /etc/systemd/oomd/rules.d/
and then reference them with a new config option OOMRule=
2026-05-18 21:42:56 +02:00
Michal Sekletar e1c63fd4c0 core: make manager event loop rate limit configurable
Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-15 14:01:57 +09:00
glemco 43b53679da cgroup: Add CPUSetPartition= setting
Add support for configuring cpuset partition type via the
CPUSetPartition= unit file setting. This controls the kernel's
cpuset.cpus.partition cgroup attribute.

The setting takes one of "member", "root", or "isolated". This is
useful for real-time workloads that require dedicated CPU resources
without interference from other processes.

When set, systemd will write the partition type to the
cpuset.cpus.partition cgroup file. If the kernel rejects the value
(e.g., due to partition hierarchy rules), a warning is logged and the
unit continues with the kernel's default partition type.

Co-developed-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
2026-05-14 08:55:44 +02:00
Simon Lucido d667b6b97f core: add ReloadCount to Manager and bump on successful reload
Introduce a counter that tracks how many configuration reloads have
been successfully completed by the manager. The increment lives in
manager_reload() right after the "point of no return", so failed
reload attempts that bail out earlier (e.g. during serialization)
do not bump the counter.

It is accessible as a new ReloadCount property to
org.freedesktop.systemd1.Manager (D-Bus) and ReloadCount to
io.systemd.Manager.Describe (Varlink).

Also add an integration test for ReloadCount
that verifies that the new ReloadCount property increments by one per
daemon-reload, accumulates correctly across multiple reloads, and that
D-Bus and Varlink return identical values. Also tests that the counter
reset after a reexec.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Simon Lucido <simonlucido@meta.com>
2026-05-03 10:23:55 +01:00
Daan De Meyer 594659da06 core: Add I/O pressure support 2026-04-09 22:47:10 +02:00
Daan De Meyer 316d17fcbd core: Add support for CPU pressure notifications
Works the same way as memory pressure notifications. Code is refactored
to work on enum arrays to reduce duplication.
2026-04-09 22:47:10 +02:00
Nikolas Kyx 1f6935145d manager: Add DefaultMemoryZSwapWriteback
Allow setting system-wide MemoryZSwapWriteback in system.conf

Resolves: #41320
2026-04-02 20:04:30 +01:00
Luca Boccassi f3a34fcc3a manager: add 'needs-stop/needs-start' markers
Useful for packaging scripts, when units are removed.
When multiple markers are assigned without +/-, the last one wins.
When using +/-, the job merging logic is followed to the extent possible.
2026-02-23 13:05:23 +00:00
Lennart Poettering 32b88dd25a pid1: introduce RootMStack= for using an mstack as root dir for a service 2026-02-19 15:05:15 +01:00
Mike Yuan 24f458da81 man: document RefreshOnReload= 2026-02-10 21:54:13 +01:00
Mike Yuan 1a0df07843 core/cgroup: obsolete DefaultMemoryMin/Low=
Now that our kernel baseline is v5.7 and memory_recursiveprot
is universally enabled, remove userspace workarounds.
2026-01-19 13:33:28 +01:00
Usama Arif 32614b9aab core: introduce MemoryTHP= unit file setting
Transparent Hugepages (THP) is a Linux kernel feature that manages
memory using larger pages (2MB on x86, compared to the default 4KB).
The main goal is to improve memory management efficiency and system
performance, especially for memory-intensive applications.
However, it can cause drawbacks in some scenarios, such as memory
regression and latency spikes. THP policy is governed for the entire
system via /sys/kernel/mm/transparent_hugepage/enabled.
However, it can be overridden for individual workloads via prctl(2)
call.
MemoryTHP= is used to disable THPs at exec-invoke to stop
providing THPs for workloads where the drawbacks outweigh the advantages.
When set to "disable", MemoryTHP= disables THPs completely for the
process, irrespecitive of global THP controls.
When set to "madvise", MemoryTHP= disables THPs for the process except
when specifically madvised by the process with MADV_HUGEPAGE or MADV_COLLAPSE.
2026-01-06 03:26:14 -08:00
Yu Watanabe 33340fbe44 man: drop redundant 'and'
Also swap the order of entries, to make it consistent for other unit
types.

Follow-up for 79dd24cf14.
2026-01-02 09:52:31 +09:00
Luca Boccassi 9463b3b51c man: document version for BindNetworkInterface instead of using ignore list
The ignore list is for older stuff, all new interfaces must be documented
with a version.

Follow-up for c1c787651b
2025-12-24 19:25:21 +01:00
Luiz Amaral c1c787651b Add support for binding a unit to a network iface 2025-12-24 07:37:58 +01:00
seidlerv bd6d8eec5e man/org.freedesktop.systemd1.xml: Fix wording 2025-12-19 11:28:46 +01:00
Mike Yuan 58686034eb core: expose transactions with ordering cycle
Closes #3829
Alternative to #35417

I don't think the individual "WasOnDependencyCycle" attrs on units
are particularly helpful and comprehensible, as it's really about
the dep relationship between them. And as discussed, the dependency
cycle is not something persistent, rather local to the currently
loaded set of units and shall be reset with daemon-reload (see also
https://github.com/systemd/systemd/issues/35642#issuecomment-2591296586).

Hence, let's report system state as degraded and point users to
the involved transactions when ordering cycles are encountered instead.
Combined with log messages added in 6912eb315f
it should achieve the goal of making ordering cycles more observable,
while avoiding all sorts of subtle bookkeeping in the service manager.
The degraded state can be reset via the existing ResetFailed() manager-wide
method.
2025-11-12 23:47:39 +01:00
Mike Yuan b03e1b09af 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
2025-11-04 12:18:33 +01:00
Mike Yuan 48632305c7 man/org.freedesktop.systemd1: fix typo (ExecStop -> -Post) 2025-11-04 12:17:33 +01:00
Quentin Deslandes 79dd24cf14 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.
2025-11-04 10:55:04 +01:00
Yu Watanabe 63b27d1765 man: mention about UINT64_MAX value for OOMKills and ManagedOOMKills DBus properties
Follow-up for 9cf6ad16dd.
Addresses https://github.com/systemd/systemd/pull/38906#discussion_r2363291116.
2025-10-05 23:09:31 +09:00
Daan De Meyer 9cf6ad16dd core: Expose oom kills and managed oom kills as properties
It can be useful for users to know this information so let's expose
it as properties so it can be queried.
2025-09-19 13:54:54 +02:00
Brett Holman 04abe03189 man: correct the number of active unit states 2025-07-28 20:32:48 +01:00
Lennart Poettering 03b4a607f6 core: followups for the recent subgroup killing commits
This is a follow-up for 0f23564ad4 and
6b02854f50, as suggested here:

https://github.com/systemd/systemd/pull/37855#pullrequestreview-2997596953
2025-07-10 13:32:51 +09:00
Yu Watanabe 1cf5b39d64 core: add 'DefaultRestrictSUIDSGID' config option (#38126)
closes #37602, see there for extra motivation and considered
alternatives.

On typical systems, only few services need to create SUID/SGID files.
This often is limited to the user explicitly setting suid/sgid, the
`systemd-tmpfiles*` services, and the package manager. Allowing a
default to globally restrict creation of suid/sgid files makes it easier
to apply this restriction precisely.

## testing done
- built on aarch64-linux and x86_64-linux
- ran a VM test on x86_64-linux, checking for:
    - VM system boots successfully
    - defaults apply (both `yes`, `no`, and undefined)
    - systemd tmpfiles can set suid/sgid on journal log path
- Other services explicitly defining `RestrictSUIDSGID=no` can create
suid files
2025-07-10 13:30:07 +09:00
Grimmauld 97998d1cbe core/dbus-manager: Support 'DefaultRestrictSUIDSGID' option 2025-07-09 21:45:38 +02:00
Matteo Croce ea9826eb94 core: add options to delegate BPFFS token creation
Add four new options BPFDelegate{Commands,Maps,Programs,Attachments}=
in order to delegate to a BPFFS instance the permission to create tokens.

The value is a list of options taken from:
https://github.com/torvalds/linux/blob/v6.14/include/uapi/linux/bpf.h#L922-L1121
The special value "any" means to allow every possible values.

More informations about BPF tokens here:
https://lwn.net/Articles/947173/
2025-07-08 22:35:29 +02:00
Matteo Croce 3a47437fc9 core: Introduce PrivateBPF= to mount a private BPFFS
Add a new option PrivateBPF= to mount a new instance of bpffs within a
namespace.
PrivateBPF= can be set to "no" to use the host bpffs in readonly mode
and "yes" to do a new mount.
The mount is done with the new fsopen()/fsmount() API because in future
we'll hook some commands between the two calls.
2025-07-08 22:33:28 +02:00
Lennart Poettering 0f23564ad4 pid1: add ability to kill processes in a subgroup of a unit
This is useful for things like machined, where the system machined wants
to manage a machine owned by the user somewhere down the tree.
2025-07-08 03:14:53 +02:00
Andres Beltran 26c6f3271a core: add quota support for State, Cache, and Log exec directories 2025-07-07 17:28:47 +00:00
Lennart Poettering d03714e4e4 tree-wide: "human readable" → "human-readable"
Apparently, the spelling with a hyphen is better style in the English
language.

Suggested by: #36165
2025-07-07 11:21:25 +02:00
Mike Yuan 1b4ab5a209 core/socket: introduce DeferTrigger= and DeferTriggerMaxSec=
Alternative to b50f6dbe57

The commit naively returned early from socket_enter_running(), which however
is quite problematic, as the socket will be woken up over and over again
without doing a thing, until we eventually hit Poll/TriggerLimit*=.
On top of that it requires hacks to hold the start job for initrd-switch-root.service
up. Overall I doubt that is the right approach.

Let's instead hook this into our job engine, and try to activate
the service again when some other units are stopped. If all installed
jobs have been run yet we're still seeing the conflict or the manually
selected timeout is reached, fail the socket as before.
2025-06-30 13:10:43 +02:00
Lennart Poettering 99fd08224f man: add proper version info for RandomizedOffsetUSec
Follow-up for: #36437
Fixes: #37870
2025-06-26 17:28:49 +02:00
Lennart Poettering 279962a9e8 core/timer: Introduce RandomOffsetSec= knob (#36437)
This is like RandomDelaySec, but it doesn't reset whenever the manager
restarts.

Fixes https://github.com/systemd/systemd/issues/21166
2025-06-17 16:05:12 +02:00
Mike Yuan 5c12797fc3 core/socket: introduce AcceptFileDescriptors=
This controls the new SO_PASSRIGHTS socket option in kernel v6.16.
Note that I intentionally choose a different naming scheme than
Pass*=, since all other Pass*= options controls whether some extra
bits are attached to the message, while this one's about denying
file descriptor transfer and it feels more explicit this way.
And diverging from underlying socket option name is precedented
by Timestamping=. But happy to change it to just say PassRights=
if people disagree.
2025-06-17 13:16:42 +02:00
Mike Yuan 35462aa14a core/socket: add PassPIDFD= 2025-06-17 13:16:41 +02:00
Mike Yuan b36ab0d4ce core/socket: don't suggest PassFileDescriptorsToExec= is a socket option
by not interleaving it among socket options.
2025-06-17 13:16:07 +02:00
Mike Yuan 29da53dde3 core: always enable CPU accounting
Our baseline is v5.4 and cgroup v2 is enforced now,
which means CPU accounting is cheap everywhere without
requiring any controller, hence just remove the directive.
2025-05-15 02:19:16 +02:00
Lennart Poettering 9ca16f6f18 pid1: add a concurrency limit to slice units
Fixes: #35862
2025-04-22 18:53:51 +02:00
Yu Watanabe 8c35e8a9d2 core: remove deprecated StartAuxiliaryScope() DBus method
The method is deprecated since 64f173324e
(v257) and announced that it will be removed in v258.
Let's remove it now.

This effectively reverts 84c01612de.
2025-04-22 09:02:45 +09:00
Yu Watanabe db6986e02c core: deprecate CGroup v1 DBus properties 2025-04-15 22:34:22 +09:00