Commit Graph
81343 Commits
Author SHA1 Message Date
Jörg Behrmann 028de7292d man, systemctl: document --what=help 2025-05-13 17:19:39 +02:00
Jörg Behrmann 5689365a90 man: add missing fdstore in systemctl clean --what documentation 2025-05-13 17:19:02 +02:00
Yu Watanabe f51c6da8a7 hwdb: add bladeRF SDR devices (#37413) 2025-05-13 23:44:29 +09:00
Ryan Thompson eea9ba8409 hwdb: append ID_SOFTWARE_RADIO to hwdb parser 2025-05-13 08:09:55 -05:00
Ryan Thompson 951e8cb060 hwdb: add bladeRF SDR devices
Add hwdb entries for bladeRF 1.x, legacy 1.x, and 2.0 micro devices to
enable non-root access through preexisting ID_SOFTWARE_RADIO tag.

References #20561
2025-05-13 08:09:55 -05:00
Daan De Meyer a16f650bd4 meson: Add missing conditions
Follow up for 6350d2dbd9
2025-05-13 14:07:42 +02:00
Daan De Meyer e4e8946a16 core: introduce io.systemd.Manager.Describe method (#35098)
Let's extend pid1's varlink interface and add a Describe method to get
the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the user
managers and the system manager, we also make the necessary changes to
expose a varlink server on user managers.

This PR is first part of https://github.com/systemd/systemd/pull/33965
with minimal changes to address feedback.

Fixes: #22654
2025-05-13 11:57:58 +02:00
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
Ivan Kruglov f08c134661 tests: tests for io.systemd.manager.Describe 2025-05-13 01:55:15 -07:00
Ivan Kruglov 736349958e core: introduce io.systemd.Manager.Describe method
Let's extend pid1's varlink interface and add a Describe method to
get the global Manager object information as a JSON object
(io.systemd.Manager.Describe).

Because the new varlink interface should be available on both the
user managers and the system manager, we also make the necessary
changes to expose a varlink server on user managers.
2025-05-13 01:55:15 -07:00
Ivan Kruglov 5024388005 shared: watchdog_get_last_ping_as_dual_timestamp() 2025-05-13 01:55:15 -07:00
Ivan Kruglov c7728d2b46 shared: varlink_server_contains_socket() 2025-05-13 01:55:15 -07:00
Ivan Kruglov e739395f13 socket-util: socket_address_equal_unix() 2025-05-13 01:55:15 -07:00
Ivan Kruglov ea6075a26e core: common rlimits code and structures 2025-05-13 01:55:15 -07:00
Ivan Kruglov 92e8e2b034 log: log_get_target_max_level() 2025-05-13 01:53:22 -07:00
Ivan Kruglov 8c823a038c meson: introduce PROJECT_VERSION_STR and use it in udev 2025-05-13 01:53:22 -07:00
Eisuke KawashimaandEisuke Kawashima 6d07d23b02 shell-completion: fix completion of systemctl --user unset-environment (#37409)
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2025-05-13 09:04:52 +09:00
André Monteiro 02527e95b5 Add dns0.eu in resolved.conf.in (#37404)
Add dns0.eu as a dns option in resolved.conf.in
This also adds Quad9 DNS servers as the default fallback servers.
2025-05-13 08:36:22 +09: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
Yu Watanabe 87ddd97057 core: assorted cleanups (#37410) 2025-05-13 08:32:20 +09:00
Mike Yuan 3ca4a717a6 core/dbus-unit: remove unneeded else if 2025-05-12 18:56:15 +02:00
Mike Yuan f76b029312 core/dbus-execute: always normalize argv[0] to "sh" on EXEC_COMMAND_VIA_SHELL
Addresses https://github.com/systemd/systemd/pull/37071#discussion_r2084851759
2025-05-12 17:09:08 +02:00
Mike Yuan 5e24ebace2 core/slice: remove redundant assertion 2025-05-12 17:05:37 +02:00
Antonio Alvarez Feijoo 0425fc5eb7 log: fix declaration of log_dispatch_internal() 2025-05-12 23:42:19 +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 262dee132b meson: Various improvements (#37395) 2025-05-12 23:06:57 +09: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
Yu Watanabe fdb4d869f0 udev: sort received events by their seqnum (#37314)
The kernel sometimes sends uevents in a random order, so previously the
received events were not sorted by their seqnum. We determine which
event is ready for processing by using the assumption that queued events
are sorted by their seqnum. Let's sort the received events before queue
them, to make events processed in a correct ordering.
2025-05-12 23:04:49 +09:00
Igor Opaniuk 9c56688e87 sd-boot: use sysfail entry for UEFI firmware update failure
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.

[1] https://uefi.org/specs/UEFI/2.10/23_Firmware_Update_and_Reporting.html
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2025-05-12 15:37:47 +02: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 bd543bca11 bless-boot: some fixes (#37375)
This mostly makes sure we do something reasonable when our tool is
called from a boot of an entry that was already marked as definitely
"bad" on a previous boot. Such an entry we can return into a "good"
state, but we cannot return it into an "indeterminate" state, because
the status quo ante is already known.

Fixes: #37350
2025-05-12 15:11:06 +02:00
Daan De Meyer 1fbaabf9ec meson: Don't create static library target unless option is enabled
While we don't build these by default, all the source files still
get added to the compile_commands.json file by meson, which can confuse
tools as they might end up analyzing the source files twice or analyzing
the wrong one.

To avoid this issue, only define the static library target if the
corresponding option is enabled.
2025-05-12 13:35:50 +02:00
Daan De Meyer 30d20907bd meson: Remove unneeded include directories
meson by default adds the current source and build directory as include
directories. Because we structure our meson code by gathering a giant dict
of everything we want to do and then doing all the actual target generation
in the top level meson.build, this behavior does not make sense at all because
we end up adding the top level repository directory as an include directory
which is never what we want.

At the same time, let's also make sure the top level directory of the build
directory is not an include directory, by moving the version.h generation
into the src/version subdirectory and then adding the src/version subdirectory
of the build directory as an include directory instead of the top level
repository directory.

Making this change means that language servers such as clangd can't get
confused when they automatically insert an #include line and insert
"#include "src/basic/fs-util.h" instead of "#include "fs-util.h".
2025-05-12 13:35:50 +02:00
Daan De Meyer 6350d2dbd9 meson: Extract objects instead of creating intermediate static libraries
Currently, when we want to add unit tests for code that is compiled into
an executable, we either compile the code at least twice (once for the
executable, and once for each test that uses it) or we create a static
library which is then used by both the executable and all the tests.

Both of these options are not ideal, compiling source files more than
once slows down the build for no reason and creating the intermediate
static libraries takes a lot of boilerplate.

Instead, let's use the extract_objects() method that meson exposes on
build targets. This allows us to extract the objects corresponding to
specific source files and use them in other executables. Because we
define all executables upfront into a dictionary, we integrate this into
the dictionary approach by adding two new fields:

- 'extract' takes a list of files for which objects should be extracted.
  The extracted objects are stored in a dict keyed by the executable name
  from which they were extracted.
- 'objects' takes the name of an executable from which the extracted
  objects should be added to the current executable.

One side effect of this approach is that we can't build test executables
anymore without building the main executable, so we stop building test
executables unless we're also building the main executable. This allows
us to switch to using subdir_done() in all of these subdirectories to skip
parsing them if the corresponding component is disabled.

These changes get me down from 2439 => 2403 ninja targets on a full rebuild
from scratch.
2025-05-12 13:35:50 +02:00
Daan De Meyer d8def5dc87 meson: Stop doing nested build when fuzzers are enabled
Currently, when fuzzers are enabled, we run meson from within meson
to build the fuzzer executables with sanitizers. The idea is that
we can build the fuzzers with different kinds of sanitizers
independently from the main build.

The issue with this setup is that we don't actually make use of it.
We only build the fuzzers with one set of sanitizers (address,undefined)
so we're adding a bunch of extra complexity without any benefit as we
can just setup the top level meson build with these sanitizers and get
the same result.

The other issue with this setup is that we don't pass on all the options
passed to the top level meson build to the nested meson build. The only things
we pass on are extra compiler arguments and the value of the auto_features
option, but none of the individual feature options if overridden are passed on,
which can lead to very hard to debug issues as an option enabled in the top
level build is not enabled in the nested build.

Since we're not getting anything useful out of this setup, let's simplify
and get rid of the nested meson build. Instead, sanitizers should be enabled
for the top level meson.build. This currently didn't work as we were overriding
the sanitizers passed to the meson build with the fuzzer sanitizer, so we
fix that as well by making sure we combine the fuzzer sanitizer with the ones
passed in by the user.

We also drop support for looking up libFuzzer as a separate library as
it has been shipped builtin in clang since clang 6.0, so we can assume
that -fsanitize=fuzzer is available.

To make sure we still run the fuzzing tests, we enable the fuzz-tests option
by default now to make sure they still always run (without instrumentation unless
one of llvm-fuzz or oss-fuzz is enabled).
2025-05-12 13:34:28 +02:00
Lennart Poettering 30284e3a59 bless-boot: never try to rename an entry file onto itself
If we are booting a known bad entry, and we are asked to mark it as bad,
we so far would end up renaming the entry onto itself, which resulted in
EEXIST and is really borked operation. Let's catch that case and handle
it explicitly.
2025-05-12 13:04:16 +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
Lennart Poettering 7a8372a9f1 bless-boot: switch from last_path_component() to path_find_last_component()
Using path_find_last_component() means special cases such as the root dir
and paths referencing dirs are detected and refused.
2025-05-12 13:04:16 +02:00
Lennart Poettering aefdbacff8 README: mention explicitly that dmi-sysfs must be built-in, cannot be loaded as kmod
Fixes: #37391
2025-05-12 10:38:15 +02:00
naly zzwd b5ee8ec4e8 po: Translated using Weblate (Catalan)
Currently translated at 100.0% (257 of 257 strings)

po: Translated using Weblate (Catalan)

Currently translated at 79.7% (205 of 257 strings)

Co-authored-by: naly zzwd <xeanhort007@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ca/
Translation: systemd/main
2025-05-12 14:54:03 +09:00
Valentin Hăloiu 1dbeb98fea Add netdev files associated with link to networkd JSON output (#37402)
`networkctl status LINK` gained support for showing the netdev
configuration files associated with a link in
c9837c17d5, but these netdev files were
never added to the JSON output too.

This pull-request fixes that by adding two new fields (`NetDevFile` and
`NetDevFileDropins`) to the `networkctl` (and `D-Bus`) JSON output.
2025-05-11 09:33:28 +09:00
Yu Watanabe 8ac5b047fc man/systemd.exec: update documents for PrivateTmp= 2025-05-11 03:33:02 +09:00
Yu Watanabe 3e320dc608 test-execute: add test case for PrivateTmp=disconnected 2025-05-11 03:33:02 +09:00
Yu WatanabeandMike Yuan 6156bec7a4 core: disable mounting disconnected private tmpfs on /var/tmp/ when DefaultDependencies=no
If DefaultDependencies=no, /var/ may not be mounted yet when the service
is being started. Previously, In such case, if the service has
PrivateTmp=disconnected, the service manager created /var/tmp/ on the
root filesystem and mounted the disconnected private tmpfs there. That
poluted the root filesystem and disturbed gpt-auto-generator on next
boot, as /var/ would not be empty anymore. See issue #37258.

This changes PrivateTmp=disconnected as the following:
- If DefaultDependencies=no and RootDirectory=/RootImage= are not set,
  then a private tmpfs is mounted _only_ on /tmp/, and set $TMPDIR=/tmp
  environment variable to suggest the service to use /tmp/.
- If DefaultDependencies=yes and RootDirectory=/RootImage= are not set,
  then implies RequiresMountsFor=/var/, though that is typically
  redundant, but anyway. Hence, we can safely mount /var/tmp/.
- Otherwise, i.e. when one of RootDirectory=/RootImage= is set, behaves
  as the same as the previous, as the private root filesystem for the
  service is explicitly prepared by the service manager, and we can
  safely mount a private tmpfs on /var/tmp/ without any extra
  dependencies.

Fixes #37258.

Co-authored-by: Mike Yuan <me@yhndnzj.com>
2025-05-11 03:33:02 +09:00
Yu Watanabe 26186503d7 core/mount: drop unnecessary dependency generations
When the unit is new, then mount_setup_new_unit() adds the unit to the
load queue, and the same dependencies will be anyway added.

When the unit already exists but previously failed to be loaded, then
mount_setup_existing_unit() also adds the unit to the load queue.
Hence it is not necessary to regenerate dependencies here now.

So, we need to regenerate dependencies only when things changed and
the unit has been already loaded.

No functional changes, just optimization.
2025-05-11 03:33:02 +09:00
Yu Watanabe fee2f5ca3f core/mount,swap: reload unit when manually mounted/started and we previously failed to load
Otherwise, neither unit_patch_contexts() nor unit_add_exec_dependencies()
is called for the unit.
2025-05-11 03:32:48 +09:00
Yu Watanabe 13208591db core/namespace: split out append_private_tmp() 2025-05-11 03:29:20 +09:00
Yu Watanabe 97bf617af1 core/namespace: introduce should_propagate_to_submounts() helper function 2025-05-11 03:29:20 +09:00
Yu Watanabe a4b1232dbf core/unit: suffix directory paths with slash 2025-05-11 03:29:20 +09:00