Commit Graph

9799 Commits

Author SHA1 Message Date
cvlc12
c3e80f8f2b man: systemd-measure. Remove 'tpm2-pcrs=' from cryptenroll command (#39590)
This is now default since 4b840414be.
2025-11-07 05:54:06 +09:00
Christoph Anton Mitterer
07f4718242 man: clarify what “failed” means
systemd.service(5)’s documentation of `ExecCondition=` uses “failed” with
respect to the unit active state.
In particular the unit won’t be considered failed when `ExecCondition=`’s
command exits with a status of 1 through 254 (inclusive). It will however, when
it exits with 255 or abnormally (e.g. timeout, killed by a signal, etc.).

The table “Defined $SERVICE_RESULT values” in systemd.exec(5) uses “failed”
however rather with respect to the condition.

Tests seem to have shown that, if the exit status of the `ExecCondition=`
command is one of 1 through 254 (inclusive), `$SERVICE_RESULT` will be
`exec-condition`, if it is 255, `$SERVICE_RESULT` will be `exit-code` (but
`$EXIT_CODE` and `$EXIT_STATUS` will be empty or unset), if it’s killed because
of `SIGKILL`, `$SERVICE_RESULT` will `signal` and if it times out,
`$SERVICE_RESULT` will be `timeout`.

This commit clarifies the table at least for the case of an exit status of 1
through 254 (inclusive).
The others (signal, timeout and 255 are probably also still ambiguous (e.g.
`signal` uses “A service process”, which could be considered as the actual
service process only).

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2025-11-06 10:47:06 +01:00
Managor
b1aa33ff91 systemctl.xml: unify ellipsis (#39586)
The reverts in #39423 brought this back. This PR will unify the page.
2025-11-06 10:34:57 +01:00
Nils K
bea3b300bc man: fix username prefix mentioned in manual for capsule users (#39573) 2025-11-06 07:33:56 +09: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
Lennart Poettering
d73d369133 analyze: add new verb for determining NvPCR values 2025-11-02 21:14:35 +01:00
Lennart Poettering
e5a2e78665 cryptsetup: automatically measure used keyslot and mechanism (i.e. fido2, tpm2, pkcs11) to an NvPCR
Fixes: #29877
2025-11-02 21:14:35 +01:00
Lennart Poettering
8a6e77f1a8 tpm2-setup: measure "anchor" extension early at boot into nvpcrs 2025-11-02 21:14:35 +01:00
Lennart Poettering
0196abbd10 pcrextend: automatically measure SMBIOS product ID at boot
Now that PCRs are not that expensive anymore, let's use them to measure
the SMBIOS product ID to one.
2025-11-02 21:14:35 +01:00
Lennart Poettering
2b90bf1730 pcrextend: make use new nvindex-based PCRs 2025-11-02 21:14:35 +01:00
Lennart Poettering
c30e3d7290 creds-util: add automatic mode for tpm2 based creds
This reworkds TPM2 based creds a bit. Instead of mapping the key type
"tpm2" directly to a TPM2 key without PK, let's map it to an "automatic"
key type that either picks PK or doesn't, depending on what's available.
That should make things easier to grok for people, as the nitty gritty
details of PK or not PK are made autmatic. Moreover it gives us more
leverage to change the TPM2 enrollment types later (for example, we
definitely want to start pinning SRK, and hook up pcrlock too, for
creds, which we currently don't).

This hence adds a new _CRED_AUTO_TPM2
pseudo-type we automatically maps to CRED_AES256_GCM_BY_TPM2_HMAC_WITH_PK
or CRED_AES256_GCM_BY_TPM2_HMAC depending if PK as available. Similar,
_CRED_AUTO_HOST_AND_TPM2 is added, which does the same for the
host/nonhost cred type.

This does not introduce any new type on the wire, it just changes how we
select the right key type.

To make the code more readable this also adds some categorization macros
for the keys, instead of repeating the list of key types at multiple
places.
2025-11-02 21:14:35 +01:00
Zbigniew Jędrzejewski-Szmek
5fa2fb65a6 Enhance docs for ukify and direct kernel boots (#39516) 2025-11-02 18:04:15 +01:00
Zbigniew Jędrzejewski-Szmek
cde713bfe4 man: say "systemd-boot" instead of "sd-boot" consistently
As requested in

https://github.com/systemd/systemd/pull/39516#pullrequestreview-3407564896.
2025-11-02 15:20:59 +01:00
Zbigniew Jędrzejewski-Szmek
02539f008d man/ukify: mention all functionality in intro, add example of direct boot
Over the time, the functionality in ukify has grown. This should all be briefly
mentioned in the first section so the user does't have to read the whole page
to figure out what types of functionality are implemnted.

Also add an example of direct kernel boot. It's a nifty technology (and frankly
underutilized, considering how cool it is is).
2025-11-02 15:19:00 +01:00
Zbigniew Jędrzejewski-Szmek
4808c1686b man/sd-boot: add some meat to the direct kernel boot example
Unfortunately qemu still default to BIOS boot, so for the direct kernel
boot with an efi file to be of any use, the complex param used to switch
to UEFI mode needs to be provided.

Also add some links to qemu and OVMF.
2025-11-02 15:19:00 +01:00
Alberto Planas
ab1f4e506f repart: support "nodatacow" in btrfs subvolumes
In btrfs-progs 6.15 it is planned to add a new parameter in mkfs.btrfs
--inode-flags, that can set attributes for subvolumes, directories, and
files.

The current supported attributes are "nodatacow", to disable CoW, and
"nodatasum", to disable the checksum.

This commit extend the "Subvolunes=" option to understand the
"nodatacow" flag for subvolums only.

If RepartOffline is enabled it will build the image without loopback
devices, using the correct --inode-flags parameters.

If RepartOffline is disabled it will use loopback devices and set the
btrfs attributes accordingly.

Signed-off-by: Alberto Planas <aplanas@suse.com>
2025-11-02 17:13:31 +09:00
Lennart Poettering
d714edd26c repart: varlink support (#39421)
Split out of #38764

Replaces: #33741
2025-11-01 23:21:37 +01:00
Christoph Anton Mitterer
a983cf253f doc: indicate Type=oneshot also detects invocation failures
Type `simple` explicitly mentions that invocation failures like a missing binary
or `User=` name won’t get detected – whereas type `exec` mentions that it does.

Type `oneshot` refers to being similar to `simple`, which could lead one to
assume it doesn’t detect such invocation failures either – it seems however it
does.

Indicate this my changing its wording to be similar to `exec`.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2025-11-01 22:48:28 +01:00
Lennart Poettering
0f9d58cc36 repart: add knobs for automatically deferring all partitions marked as empty or for factory reset 2025-11-01 22:01:35 +01:00
Lennart Poettering
2ecfea7491 repart: if device node is specified as "-", calculate needed disk space
So far repart always required specification of a device node. And if
none was specified, then we'd fine the node backing the root fs. Let's
optionally allow that the device node is explicitly not specified (i.e.
specified as "-" or ""), in which case we'll just print the size of the
minimal image given the definitions.
2025-11-01 22:00:47 +01:00
Lennart Poettering
633a4b8839 man: add documentation for the various sd_json_dispatch_xyz() calls
Now that we comprehensively return accept null it's a good idea to
document which function maps null to what.
2025-11-01 21:58:28 +01:00
Daan De Meyer
dd15dd1a58 core: Add RootDirectoryFileDescriptor= (#39480)
RootDirectory= but via a open_tree() file descriptor. This allows
setting up the execution environment for a service by the client in a
mount namespace and then starting a transient unit in that execution
environment using the new property.

We also add --root-directory= and --same-root-dir= to systemd-run to
have it run services within the given root directory. As systemd-run
might be invoked from a different mount namespace than what systemd is
running in, systemd-run opens the given path with open_tree() and then
sends it to systemd using the new RootDirectoryFileDescriptor= property.
2025-10-31 22:30:46 +01:00
Florian
f2875c73a2 man: fix outdated link to freedesktop.org documentation (#39511)
Freedesktop changed their link format.
2025-11-01 02:03:43 +09:00
Daan De Meyer
9e26ced980 core: Add RootDirectoryFileDescriptor=
RootDirectory= but via a open_tree() file descriptor. This allows
setting up the execution environment for a service by the client in
a mount namespace and then starting a transient unit in that execution
environment using the new property.

We also add --root-directory= and --same-root-dir= to systemd-run to
have it run services within the given root directory. As systemd-run
might be invoked from a different mount namespace than what systemd is
running in, systemd-run opens the given path with open_tree() and then
sends it to systemd using the new RootDirectoryFileDescriptor= property.
2025-10-31 13:09:51 +01:00
Daan De Meyer
def01c7efe nspawn/vmspawn: Add --bind-user-group= option
Useful to add the bound users to the wheel group.
2025-10-31 08:57:38 +01:00
Daan De Meyer
097b6d3f66 nspawn: Fix docs 2025-10-31 08:26:04 +01:00
Christoph Anton Mitterer
bfb365d924 man: clarify quoting of $ in command lines (#39494)
When the special executable prefix `:` is used, `$$` yield the literal `$$`.
2025-10-31 15:28:57 +09:00
dgengtek
4207abb6e1 man: clarify requirements for BridgeVLAN to work 2025-10-31 15:26:14 +09:00
Daan De Meyer
5cabeed80b run0: Add --empower
--empower gives full privileges to a non-root user. Currently this
includes all capabilities but we leave the option open to add more
privileges via this option in the future.

Why is this useful? When running privileged development or debugging
commands from your home directory (think bpftrace, strace and such),
you want any files written by these tools to be owned by your current
user, and not by the root user. run0 --empower will allow you to run
all privileged operations (assuming the tools check for capabilities
and not UIDs), while any files written by the tools will still be owned
by the current user.
2025-10-30 15:28:36 +01:00
Lennart Poettering
19bf12bff3 pcrlock: don't lock PCR 12 by default
This creates a chicken-and-egg problem: we stuff the pcrlock policy into
a credential in the ESP, but credentials get measured into PCR 12, hence
PCR 12 is both input and output of the pcrlock logic, which makes
impossible to calculate.

Let's drop PCR 12 for now.

(We might want to pass the policy some other way one day, to avoid this,
but that's something for another day.)

Note that this still allows locking to PCR12 if people want to (for
example because they don't need this for the rootfs, and hence need no
cred passing via the ESP), this hence only changes the default, nothing
more.

Fixes: #33546
2025-10-30 14:12:41 +00:00
Daan De Meyer
0fe29d0672 analyze: Add dlopen-metadata verb
systemd-analyze dlopen-metadata will show dlopen metadata
in the ELF binary.
2025-10-30 11:58:23 +01:00
Yu Watanabe
16e52afad2 man: handle leading/trailing/repeating whitespaces in anchor links (#39423)
So even if a <term> section contains newlines, we get a reasonable
anchor link to it.

Before:
```
<dt id="
  bind
  UNIT
  PATH
  [PATH]
"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#%0A%20%20%20%20%20%20%20%20%20%20%20%20bind%0A%20%20%20%20%20%20%20%20%20%20%20%20UNIT%0A%20%20%20%20%20%20%20%20%20%20%20%20PATH%0A%20%20%20%20%20%20%20%20%20%20%20%20[PATH]%0A%20%20%20%20%20%20%20%20%20%20">¶</a>
```

After:
```
<dt id="bind UNIT PATH [PATH]"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#bind%20UNIT%20PATH%20[PATH]">¶</a>
```

Resolves: https://github.com/systemd/systemd/issues/39196

---

The reverts are not strictly necessary here (as already pointed out in
https://github.com/systemd/systemd/pull/39154#issuecomment-3360118164)
but they were helpful in checking if the fix works as expected. I can
drop them if needed.
2025-10-28 15:28:54 +09:00
Yu Watanabe
fe5625cbba mountfsd: allow privileged users to mount bare unprotected filesystems (#39411)
Split from https://github.com/systemd/systemd/pull/39394 as that
requires deeper rework that will take more time
2025-10-24 09:40:52 +09:00
Frantisek Sumsal
3b4b3b8a95 Revert "Update systemctl.xml"
This reverts commit b0fe317d14.
This reverts commit 9f4f7f0372.
2025-10-23 15:42:28 +02:00
Frantisek Sumsal
7168535165 man: handle leading/trailing/repeating whitespaces in anchor links
So even if a <term> section contains newlines, we get a reasonable
anchor link to it.

Before:
<dt id="
  bind
  UNIT
  PATH
  [PATH]
"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#%0A%20%20%20%20%20%20%20%20%20%20%20%20bind%0A%20%20%20%20%20%20%20%20%20%20%20%20UNIT%0A%20%20%20%20%20%20%20%20%20%20%20%20PATH%0A%20%20%20%20%20%20%20%20%20%20%20%20[PATH]%0A%20%20%20%20%20%20%20%20%20%20">¶</a>

After:
<dt id="bind UNIT PATH [PATH]"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#bind%20UNIT%20PATH%20[PATH]">¶</a>

Resolves: #39196
2025-10-23 15:42:28 +02:00
Yu Watanabe
cc7ccd3c6a man/network: extend document about the default value of IPv6AcceptRA=
Prompted by #39304.
2025-10-23 11:13:36 +09:00
Luca Boccassi
e84aa21af8 man: RootImageOptions= is only supported for system services right now
Support via mountfsd is being worked on but will take more time,
fix the documentation to be correct in the meanwhile

Follow-up for fad01f798d
2025-10-22 17:22:03 +01:00
DaanDeMeyer
b1681f981b vmspawn: Add --bind-user= and --bind-user-shell=
We use virtiofsd ID translation to mimick idmapped mounts and the
transient userdb credentials to provision the mapped user in the VM.
2025-10-22 16:42:50 +02:00
Ryan Brue
e80c5eb6e6 man: Clarify usage of /usr/share/factory/ in programs
As discussed in this thread:
https://github.com/redhat-performance/tuned/issues/798#issuecomment-3197697654

/usr/share/factory/ is not intended to be read from by programs,
but the wording in the FHS can be misread to think that programs
should be using /usr/share/factory/ as the vendor supplied configuration
directory rather than something like /usr/lib/foo/ or /usr/share/foo/.

This commit points developers to the UAPI configuration spec for how to
make their programs hermetic /usr/ compatible.

Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
2025-10-22 11:07:23 +02:00
Daniel Foster
c7a444a9c1 tree-wide: extend $LISTEN_FDS protocol with $LISTEN_PIDFDID
Although extremely unlikely, there is a race present in solely checking the
$LISTEN_PID environment variable, due to PID recycling. Fix that by introducing
$LISTEN_PIDFDID, which contains the 64-bit ID of a pidfd for the child process
that is not subject to recycling.
2025-10-22 09:34:14 +02:00
Yu Watanabe
b200f57bfa man: fix position of </para> tag
Follow-up for 65664bba40.
2025-10-20 14:26:46 +09:00
Yu Watanabe
aeef3c313b man: fix typo
Follow-up for 938f7fea7c.
2025-10-20 11:25:46 +09:00
Luca Boccassi
c92b14ec13 dissect: add support for verity-protected bare filesystems via mountfsd (#39325)
Needed to implement support for RootHashSignature=/RootVerity=/RootHash=
and friends when going through mountfsd, for example with user units,
so that system and user units provide the same features at the same
level
2025-10-16 19:43:45 +01:00
Lennart Poettering
b0c6d129a5 two small varlink additions (#39323)
Split out of #39293, but make a ton of sense on their own.
2025-10-16 17:42:57 +02:00
Luca Boccassi
fad01f798d dissect: add support for verity-protected bare filesystems via mountfsd
Needed to implement support for RootHashSignature=/RootVerity=/RootHash=
and friends when going through mountfsd, for example with user units,
so that system and user units provide the same features at the same
level
2025-10-16 16:22:33 +01:00
Govind Venugopal
48c64813ec varlink: omit empty parameters field in JSON messages (#38922)
When varlink parameters are empty, omit the "parameters" field entirely
rather than sending "parameters":{}. This reduces message size and
follows varlink specification which allows parameters to be omitted.

The implementation supports three equivalent representations for empty
parameters: field omission, JSON null, and empty object {}. All three
are accepted on input for backward compatibility.

Fixes: #38474
2025-10-16 17:06:17 +02:00
Lennart Poettering
73740ca2fc sd-varlink: add sd_varlink_is_connected() 2025-10-16 16:24:29 +02:00
Luca Boccassi
68b476a298 core: also enable PrivateUsers= for user services when using images via mountfsd
RootDirectory= and other options already implicitly enable PrivateUsers=
since 6ef721cbc7 if they are set in user
units, so that they can work out of the box.
Now with mountfsd support we can do the same for the images settings,
so enable them and document them.
2025-10-16 12:58:59 +01:00