Commit Graph
9461 Commits
Author SHA1 Message Date
Lennart Poettering f9d76a8d15 sd-boot: add support for a sysfail entry (#34856)
Add support for a sysfail boot entry. Sysfail boot entries can be used
for optional tweaking the automatic selection order in case a failure
state of the system in some form is detected (boot firmware failure
etc).

The EFI variable `LoaderEntrySysFail` contains the sysfail boot loader
entry to use. It can be set using bootctl:
```
$ bootctl set-sysfail sysfail.conf
```

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no system
failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

`sysfail_check()` expected to be extented to support possibleconditions
when we should boot sysfail("recovery") boot entry.

Also add support for using a sysfail boot entry in case of UEFI firmware
capsule update failure [1]. The status of a firmware update is obtained
from the EFI System Resource Table (ESRT), which provides an optional
mechanism for identifying device and system firmware resources for the
purposes of targeting firmware updates to those resources.
    
Current implementation uses the value of LastAttemptStatus field from
ESRT, which describes the result of the last firmware update attempt for
the firmware resource entry. The field is updated each time an
`UpdateCapsule()` is attempted for an ESRT entry and is preserved across
reboots (non-volatile).
    
This can be be used in setups with support for A/B OTA updates, where
the boot firmware and Linux/RootFS might be updated synchronously.
    
The check is activated by adding "sysfail-firmware-upd" to loader.conf
    
[1]
https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html
2025-05-13 11:23:26 +02:00
Mike Yuan 2950fb1b9b run0: drop -a short switch for --area=
Follow-up for f44e7a8c11

This breaks the rule stated at the beginning of help_sudo_mode():

> NB: Let's not go overboard with short options: we try to keep a modicum of compatibility with
> sudo's short switches, hence please do not introduce new short switches unless they have a roughly
> equivalent purpose on sudo. Use long options for everything private to run0.
2025-05-13 08:33:10 +09:00
Mike Yuan 81d5eda6c5 core: accept "|" ExecStart= prefix to spawn target user's shell; teach run0 about the new logic (#37071)
I've always been reluctant to invoke the current user's shell in another
user's context, hence was fully grounded in `sudo -i`. With this bit in
place `run0` will finally be feature-complete on my side ;-)
2025-05-12 16:10:03 +02:00
Yu Watanabe 6ea555f913 core/namespace: fix issue in PrivateTmp=disconnected vs var.mount (#37271)
Fixes #37258.
Replaces #37259.
2025-05-12 23:05:24 +09:00
Igor Opaniuk 2857a83975 bootctl: configure a sysfail entry
You can configure the sysfail boot entry using the bootctl command:
$ bootctl set-sysfail sysfail.conf

The value will be stored in the `LoaderEntrySysFail` EFI variable.

The `LoaderEntrySysFail` EFI variable would be unset automatically
during next boot by `systemd-boot-clear-sysfail.service` if no
system failure occured, otherwise it would be kept as it is and a system
failure reason will be saved to `LoaderSysFailReason` EFI variable.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2025-05-12 15:37:47 +02:00
Igor Opaniuk 004e3e4082 sd-boot: add support for a sysfail entry
Add support for a sysfail boot entry. Sysfail boot entries can be
used for optional tweaking the automatic selection order in case a
failure state of the system in some form is detected (boot firmware
failure etc).

The EFI variable `LoaderEntrySysFail` holds the boot loader entry to
be used in the event of a system failure. If a failure occurs, the reason
will be stored in the `LoaderSysFailReason` EFI variable.

sysfail_check() expected to be extented to support possible
conditions when we should boot sysfail("recovery") boot entry.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2025-05-12 15:37:46 +02:00
Lennart Poettering 9420a0e6cb bless-boot: in "status" output report bad state from prev boot as "dirty"
The bless-boot logic currently assumes that if the name of the boot
entry reported via the EFI var matches the name on disk that the state
is "indeterminate", as we haven't counted down the counter (to mark it
bad) or drop the counter (to mark it good) yet. But there's one corner
case we so far didn't care about: what if the entry already reached 0
left tries in a previous boot, i.e. if the user invoked an entry already
known to be completely bad. In that case we'd still return
"indeterminate", but that's kinda misleading, because we *know* the
currently booted entry is bad, however we inherited that fact from a
previous boot, we didn't determine it on the current.

hence, let's introduce a new status we report in this case, that is both
distinct from "bad" (which indicates whether the *current* boot is bad)
and "indirect" (which indicates the current boot has not been decided on
yet): "dirty".

Why "dirty"? To mirror "clean" which we already have, which indicates a
boot already marked good in a previous boot, which is a relatively
symmetric state.

This is a really weak api break of sorts, because it introduces a new
state we never reported before, but I think it's fine, because the old
reporting was just wrong, and in a way this is bugfix, that we now
report correctly something where previously returned kind of rubbish
(though systematic rubbish).

Replaces:  #37350
2025-05-12 13:04:16 +02:00
Yu Watanabe 8ac5b047fc man/systemd.exec: update documents for PrivateTmp= 2025-05-11 03:33:02 +09:00
Itxaka 03eae2a402 boot: add an option to control action after SecureBoot enrollment (#36684)
This PR provides a new option for systemd-boot
`secure-boot-enroll-action` which allows to configure the behavior after
SecureBoot keys are enrolled.

Provides the option to either reboot or power off.

The current behavior is not changed, it will by default reboot as it did
before.

It also provides a small message about the action its going to take with
a small delay so the user can read it.
2025-05-08 13:28:41 +09:00
Yu Watanabe ecad362d7e man: fix typo
Follow-up for a50fa2a40f.
2025-05-08 03:37:38 +09:00
Mike Yuan e61d2011d1 run0: introduce --via-shell for invoking target user's shell, and -i shortcut
-i/--login has exact sudo semantics. But we only document
the short option and advertise expressly specifying
--via-shell --chdir='~' otherwise.
2025-05-07 18:32:20 +02:00
Mike Yuan 5b8bcbcf00 core: accept "|" ExecStart= prefix to spawn target user's shell
When switching to another user it's oftentimes desirable to also spawn
the target user's shell. sudo supports this via -i flag, run0 currently
doesn't. We don't want to proactively query NSS ourselves, since
that would fall short when operating remotely. Let's instead teach
the service manager to spawn the command using the user's default shell.

I opted for "|" instead of "." in the end because the latter seems
a bit obscure. But happy to change it to something else if a better option
comes up.
2025-05-07 18:32:19 +02:00
Mike Yuan 72fc33fe20 man/systemd.service: drop dangling reference to "!!" prefix
Follow-up for 00a415fc8f
2025-05-07 18:32:15 +02:00
anonymix007 9fed4ec252 analyze-chid: Support EDID CHIDs 2025-05-07 18:52:49 +03:00
Zbigniew Jędrzejewski-Szmek 2dc4e87849 man/systemd.exec: reword description of RestrictAddressFamilies=
The text is reordered and broken into more paragraphs.
A recommendation to combine RestrictAddressFamilies= with
SystemCallFilter=@service is added.
2025-05-06 21:14:03 +02:00
Zbigniew Jędrzejewski-Szmek 802d23fcfb man/systemd.exec: reword description of SystemCallFilter=
The existing text grew organically as features were added and was
not very organized. Reorder it and break into paragraphs grouped
by topic. The description of the :errno syntax is replaced by a short
reference to the SystemCallErrorNumber= setting. This makes the
text shorter and makes it easier to explain how the two settings combine.
2025-05-06 21:14:03 +02:00
Alexander Stepchenko 0cf03a36f2 man/systemctl: add preposition for clarity 2025-05-05 13:01:05 +02:00
Tim Small a50fa2a40f man/network: Note .link early boot caveat, and .network .netdev usage.
Document .link .network and .netdev file type distinctions in early
introductory text, and document distro-specific need to sync link files
with early-boot copies, see Debian bug 1005282:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005282 for an
example.
2025-05-04 12:27:50 +09:00
Yu Watanabe ad6563c766 sd-bus,busctl: introduce sd_bus_message_dump_json() and use it (#37266) 2025-04-30 22:16:14 +09:00
Yu Watanabe e95aebef1f network,udev: several fixlets for setting up SR-IOV VFs (#37269)
Closes #37257 and #37275.
2025-04-30 22:14:41 +09:00
Yu Watanabe 940441b44c network/tuntap: deny non-system users/groups from owning Tun/Tap interfaces
This is analogous to #36123, but for Tun/Tap interfaces created by
systemd-networkd.

If a regular user account want to control a Tun/Tap interface, then
assign the interface to a system group, e.g., vpn, and add the user
to the group.

Closes #37279.
2025-04-30 20:31:00 +09:00
Yu Watanabe 0c111392fd sd-bus: introduce sd_bus_message_dump_json()
We have already expose sd_bus_message_dump(). Let's also expose how
we convert dbus message into json format in busctl.
2025-04-30 19:40:37 +09:00
Lennart Poettering 034c5ac01f man: fix include line in sd_varlink_set_description() man page 2025-04-30 10:34:44 +02:00
Lennart Poettering 5b5c6826ba man: document sd_varlink_send() 2025-04-30 10:34:44 +02:00
Lennart Poettering b302a6bae5 man: document sd_varlink_push_fd() 2025-04-30 10:34:44 +02:00
Tim Small 8e24558e61 man/network: clarify SR-IOV section description and usage
Document effect of the SR-IOV section in .link vs .network files and
restructure the SR-IOV section introduction for clarity.
2025-04-30 15:47:19 +09:00
Yu Watanabe 531cf425e8 man/busctl: many other commands can take --json=/-j
Also, in a futre remaining commands may also support the option.
Let's not mention which command support the options.

Closes #37210.
2025-04-27 10:41:34 +09:00
Yu Watanabe 4db8663b81 tree-wide: fix typo 2025-04-27 10:36:12 +09:00
Jesper Nilsson d93292bc59 man/sd_bus_slot_set_floating: Improve wording around b parameter 2025-04-27 09:18:05 +09:00
Beniamino Galvani 2451cd2512 networkd: reduce the IPv4 DAD timeout to 200ms
The original timeout of 7 seconds is very long for today's networks. Reduce it
to 200ms. Note that this change also affects IPv4 link-local addressing.
2025-04-26 14:44:52 +09:00
Beniamino Galvani c2691d8e7c networkd: make the ACD timeout configurable
RFC 5227 specifies randomized intervals to avoid that a large number of hosts
powered up at the same time send their message simultaneously. Performing the
conflict detection takes a variable time between 4 and 7 seconds from the
beginning to the first announcement, as shown by the following diagram where P
indicates a probe and A an announcement:

 time(s)     0   1   2   3   4   5   6   7   8   9
             +---+---+---+---+---+---+---+---+---+
 SHORTEST    P   P   P       A       A
 LONGEST         P       P       P       A       A

The host can't use the address until the first announcement is sent. 7 seconds
is a very long time on modern computers especially considering the fact that
the round-trip time on current LAN technologies is at most few milliseconds.
Section 2.2 of the RFC addresses this matter and hints that a future standard
will adjust those timeouts; however that standard doesn't exist yet.

Make the timeout configurable via a new IPv4DuplicateAddressDetectionTimeoutSec=
option. The intervals defined in the RFC are then scaled proportionally so that
the duration of the conflict detection takes at most the given value. Interval
happening after the first announcement are not scaled, as recommended by the
RFC.
2025-04-26 14:44:31 +09:00
Luca Boccassi 30c3e937e3 Update example to F42 and fix invocation with dnf5 (#37250) 2025-04-25 13:35:05 +01:00
Zbigniew Jędrzejewski-Szmek f6d524a0e6 man: update fedora release to F42
F42 was released a few weeks ago.
2025-04-25 14:00:59 +02:00
Zbigniew Jędrzejewski-Szmek 392a9bd0cf man/systemd-nspawn: call dnf with --use-host-config
This is needed for dnf5. But dnf-4 doesn't know about it. So also add a hint to
skip the option with dnf-4. We can drop this later when dnf5 is the default
everywhere.

Also, s/vim-minimal/nano/. Nano is the default editor in Fedora since
https://fedoraproject.org/wiki/Changes/UseNanoByDefault.
2025-04-25 14:00:59 +02:00
Nick Labich 5d49aec4c1 repart: Allow devices as sources for --copy-from
Implements #37208
2025-04-24 09:33:51 +09:00
Daan De Meyer 50810ff7b8 Various logging improvements and cleanups (#37040) 2025-04-23 15:31:44 +02:00
Daan De Meyer ba77798bba unit: Make sure individual unit maximum log level always takes priority
Currently LogLevelMax= can only be used to decrease the maximum log level
for a unit but not to increase it. Let's make sure the latter works as
well, so LogLevelMax=debug can be used to enable debug logging for specific
units without enabling debug logging globally.
2025-04-23 14:46:12 +02:00
cvlc12 05f2d9c080 homectl: Use 'user_subvol_rm_allowed' for btrfs by default. 2025-04-23 14:45:18 +02:00
Yu Watanabe b7591658f0 man,network: fix typo
Follow-up for a06e884264.
2025-04-23 13:42:12 +09:00
Yu Watanabe cda045882e network: enable ARP when IPv4LL and/or IPv4ACD is enabled (#37190) 2025-04-23 08:53:49 +09:00
Lennart Poettering 9ca16f6f18 pid1: add a concurrency limit to slice units
Fixes: #35862
2025-04-22 18:53:51 +02:00
Lennart Poettering 80653ba925 man: explain coredump handling in context of containers better
We have two different mechanisms, let's discuss them explicitly,
comparing their effect and intended usecase.
2025-04-22 11:46:44 +02:00
Yu Watanabe 97b2e136eb man/systemd: drop explanation about SysV compatibilities
Sooner or later, we will drop the explained SysV compatibilities.
Let's remove them from the man page now to make not people rely on that.
2025-04-22 10:24:42 +09:00
Yu Watanabe 70fd998c40 man/systemd: fix mapping from SysV runlevel to actual target name
See runlevel_to_target() in src/shared/unit-file.c.
2025-04-22 10:24:42 +09:00
Yu Watanabe f7586abfe0 man/systemctl: list-sockets command sorts the result
This updates the example output of list-sockets command.
2025-04-22 10:24:42 +09: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
igo95862 399a358a38 man/sd-bus: Add at least one reference per sd-bus function man page
Some sd-bus man pages did not have any references on the main
 sd-bus man page. Unless you accidentally stumbled on them from
other pages  it was difficult to discover them.
2025-04-21 04:18:19 +09:00
igo95862 3f75684028 man/sd_bus_emit_signal: Fix extra const for strv functions
The functions `sd_bus_emit_interfaces_added_strv`, `sd_bus_emit_interfaces_removed_strv`
and `sd_bus_emit_properties_changed_strv` take an `char **` not
`const char **` as last argument.

See `src/systemd/sd-bus.h` for the function definition.
2025-04-21 03:31:33 +09:00
Yu Watanabe 7137e0bf24 ssh-proxy: use % as an alternative separator
Since OpenSSH 10.0p1, specifically
https://anongit.mindrot.org/openssh.git/commit/?id=487cf4c18c123b66c1f3f733398cd37e6b2ab6ab
ssh refuses comma in hostname by default.

Let's use % as an alternative separator.

Follow-up for defd5060d6.
2025-04-20 15:15:54 +02:00
Yu Watanabe a06e884264 network: enable ARP= when IPv4LL/IPv4ACD is enabled
We can run sd-ipv4ll/sd-ipv4acd also on an interface with IFF_NOARP
flag, but that may cause address conflict with other hosts.
Let's enable ARPing when sd-ipv4ll/sd-ipv4acd are enabled unless ARP= is
explicitly disabled.
2025-04-20 10:49:15 +09:00