Commit Graph

1247 Commits

Author SHA1 Message Date
Luca Boccassi
fa25fece05 Minor docs cleanups (#37439) 2025-05-14 17:16:05 +01:00
Zbigniew Jędrzejewski-Szmek
2fe7cdd91a docs/BOOT_LOADER_INTERFACE: minor grammar fixes 2025-05-14 18:06:38 +02:00
Zbigniew Jędrzejewski-Szmek
f72e277d0b docs: punctuation and a typo 2025-05-14 18:06:04 +02:00
Daan De Meyer
686bbf1e7f Introduce forward.h header with forward declarations
In preparation for adopting forward declarations to reduce unnecessary
transitive includes across the tree, let's introduce a forward.h header
with forward declarations for all libc, libsystemd, basic and shared types.

Additionally, this header exports all basic integer types and errno constants,
as well as all macros including assertions macros. These header files contain
types often used in headers and are always included in every source file one
way or another anyway.

To avoid having to include memory-util.h and alloc-util.h in forward.h, we
split off the parts we need from both into cleanup-util.h and only include
cleanup-util.h in forward.h.

To keep this commit self-contained, we include cleanup-fundamental.h and
cleanup-util.h from the headers that originally contained the same macros.
We'll remove these again in a later commit that optimizes the includes in
src/basic and src/fundamental.

Split out of #37364
2025-05-14 15:44:17 +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
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
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
Salim B
e0a5e2d66b docs: fix typos 2025-05-07 00:49:49 +09:00
Lennart Poettering
a4c81a6509 docs: add more markdown markup to UIDS_GIDS.md 2025-04-30 10:33:53 +02:00
Yu Watanabe
4db8663b81 tree-wide: fix typo 2025-04-27 10:36:12 +09:00
Daan De Meyer
c2ba4a2864 docs: Document manual cgroup controller management for Delegate=yes
This isn't immediately clear, so let's explicitly document this fact.

More context in https://github.com/systemd/systemd/issues/7355.
2025-04-25 00:42:24 +01:00
Daan De Meyer
44e86153d1 meson: Define our own clang-tidy target
meson's target has a few issues:
- Runs on all source files regardless if they're included in the
  build or not
- Doesn't have any dependencies on generated sources which means we
  have to do a full build first before we can run clang-tidy
- Doesn't allow us to pass any extra arguments

To work around these, let's define our own clang-tidy target instead
using llvm's run-clang-tidy script. Alongside the clang-tidy target,
let's start keeping track of all generated sources which we make the
clang-tidy target depend on. We also add a new target which will only
generate source files which is useful for setting up the source tree
for running code analysis against it.
2025-04-24 12:36:36 +02:00
Daan De Meyer
bde994efcc mkosi: Run clangd within the tools tree instead of the build container
Running within the build sandbox has a number of disadvantages:
- We have a separate clangd cache for each distribution/release combo
- It requires to build the full image before clangd can be used
- It breaks every time the image becomes out of date and requires a
  rebuild
- We can't look at system headers as we don't have the knowledge to map
  them from inside the build sandbox to the corresponding path on the host

Instead, let's have mkosi.clangd run clangd within the tools tree. We
already require building systemd for both the host and the target anyway,
and all the dependencies to build systemd are installed in the tools tree
already for that, as well as clangd since it's installed together with the
other clang tooling we install in the tools tree. Unlike the previous approach,
this approach only requires the mkosi tools tree to be built upfront, which has
a much higher chance of not invalidating its cache. We can also trivially map
system header lookups from within the sandbox to the path within mkosi.tools
on the host so that starts working as well.
2025-04-23 21:04:07 +02:00
Alexander Kurtz
e8939ebcd3 docs/MEMORY_PRESSURE: Replace incorrect "packages" with correct "pages" 2025-04-20 17:49:06 +09:00
Daan De Meyer
352fee103b docs: Add note to keep header files as lean as possible to CODING_STYLE.md 2025-04-19 11:52:58 +02:00
Daan De Meyer
c7e42c2705 docs: Add paragraph about circular includes to CODING_STYLE.md 2025-04-19 11:51:07 +02:00
Yu Watanabe
f477751b10 docs: fix mkosi section for Environment= setting 2025-04-16 08:30:25 +09:00
Yu Watanabe
7a5a667b1a JSON User/Group records: Add properties for UUIDs (#37024)
It is useful to have stable and unique identifiers for a security
principal. The majority of identitiy management systems in use with Unix
systems today (e.g. Active Directory objectGUID, FreeIPA ipaUniqueID,
Kanidm UUIDs) assign each account and group a unique UUID and exposing
that to applications allows them to refer to accounts in a stable
manner.

At this time we are merely adding the properties to the user/group
records. Adding ways to perform lookups by these IDs is left for a
future PR.

See [discussion](https://mastodon.social/@pid_eins/114283987142625086) and
[this comment](https://github.com/systemd/systemd/issues/24032#issuecomment-2745246757).

I'm sure there are wording aspects which could be improved, but I
believe this is a reasonable initial stab at the problem.
2025-04-11 07:10:56 +09:00
Erin Shepherd
800afbbcd7 JSON User/Group records: Add properties for UUIDs
It is useful to have stable and unique identifiers for a security principal.
The majority of identitiy management systems in use with Unix systems today
(e.g. Active Directory objectGUID, FreeIPA ipaUniqueID, Kanidm UUIDs) assign
each account and group a unique UUID and exposing that to applications allows
them to refer to accounts in a stable manner.

This change does not implement user or group lookup by UUID; that is left for
a later PR.
2025-04-07 23:50:35 +02:00
Yu Watanabe
4c697fdd9c docs/NETWORK_ONLINE: fix typo
Follow-up for 45b1321653.
2025-04-07 17:02:00 +09:00
Yu Watanabe
223be3e8cc docs/ARCHITECTURE: fix typo
Follow-up for e1c52cb271.
2025-04-07 17:00:35 +09:00
Mike Yuan
6801a9d88a nspawn: drop cgroup v1 handling 2025-04-04 14:36:11 +02:00
Daan De Meyer
0298ddb881 docs: Make sure we run mkosi genkey before everything else
Otherwise other commands might fail saying the keys don't exist
yet.
2025-04-03 16:37:56 +02:00
Lennart Poettering
3777c6e65a udev: new "image_dissect" builtin that can be used to generate symlinks based on partition designators (#36631)
This replaces #36209 and implements this via a new builtin, rather than
by shelling out to systemd-dissect.

Replaces: #36209 
Replaces: #28894
Fixes: #34319 
Fixes: #33453 
Fixes: #27897
Fixes: #18035
2025-04-03 13:32:11 +02:00
Lennart Poettering
e34c89897a dissect-image: guess verity root hash from the resources we found
When dissecting an image, let's make use of the Verity data even if we
got told no root hash explicitly: we can simply determine it by
concatenating the data partition uuid with the verity partition uuid.

Of course, on first thought this doesn't really add much: if the root
hash is not pinned from somewhere, this does not guarantee trust in
the image.

However, this is very useful for attestation: if we have the root hash
we can measure it before mounting things, even if we don't actually
authenticate it.

Hence, at best this helps us with attestation, at worst it doesn't improve
security but certainly doesn't hurt it.
2025-04-03 11:08:57 +02:00
Daan De Meyer
342d21ef19 mkosi: Move all mkosi configuration into mkosi/ subdirectory
Now that mkosi can automatically pick up its main configuration from
a mkosi/ subdirectory if it exists and there is no configuration in the
top level directory, let's make use of it  to reduce the amount of clutter
in the top level directory of the repository.

This will also make it easier to install the mkosi configuration files as
part of the testing packages later on.
2025-04-03 09:59:15 +02:00
Andreas Schneider
fd784642a2 docs/user_record: Put timeZone and resourceLimits in their own paragraph 2025-04-02 20:33:37 +09:00
Daan De Meyer
1b49fb9aaa mkosi: Use build image prepare scripts for tools tree as well
Instead of listing dependencies manually for the default tools tree,
let's reuse the prepare scripts from the build image. To make this work,
the sync script has to be configured for the tools tree as well so that
it's invoked both when building the tools tree and for the regular image,
otherwise, when doing the first build in a fresh checkout, the sync script
won't have executed yet as sync scripts for the regular images are executed
after building the default tools tree.
2025-03-28 12:29:09 +01:00
Daan De Meyer
d9f48358bd test: Make it possible to run the integration tests standalone
Currently, to run the integration tests, it's still necessary to
install various other build tools besides meson: A compiler, gperf,
libcap, ... which we want to avoid in CI systems where we receive
prebuilt systemd packages and only want to test them. Examples are
Debian's autopkgtest CI and Fedora CI. Let's make it possible for
these systems to run the integration tests without having to install
any other build dependency besides meson by extracting the logic
required to run the integration tests with meson into a separate
subdirectory and adding a standalone top-level meson.build file which
can be used to configure a meson tree with as its only purpose running
the integration tests.

Practically, we do the following:
- all the integration test directories and integration-test-wrapper.py
  are moved from test/ to test/integration-test/.
- All the installation logic is kept out of test/integration-test/ or
  any of its subdirectories and moved into test/meson.build instead.
- We add test/integration-test/standalone/meson.build to run the
  integration tests standalone. This meson file includes
  test/integration-test via a cute symlink hack to trick meson into
  including a parent directory with subdir().
- Documentation is included on how to use the new standalone mode.
- TEST-64-UDEV-STORAGE and TEST-85-NETWORK are changed to generate separate
  units for each testcase to make them behave more like the other integration
  tests.
2025-03-27 21:37:13 +01:00
Daan De Meyer
d22ffb44c1 tree-wide: Update outdated docs on removed old integration test stuff 2025-03-26 14:40:14 +01:00
Matteo Croce
c154bb65ad condition: introduce ConditionVersion=/AssertVersion=
Add a new condition wich checks against systemd version.
Change condition_test_kernel_version() into a generic condition_test_version()
so most of the code can be reused.

    $ systemctl --version
    systemd 258 (258~devel-g53ca5f6)

    $ systemd-analyze condition 'ConditionVersion=systemd>255'
    test.service: ConditionVersion=>255 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>260'
    test.service: ConditionVersion=>260 failed.

    $ systemd-analyze condition 'ConditionVersion=systemd>=258'
    test.service: ConditionVersion=>=258 succeeded.

    $ systemd-analyze condition 'ConditionVersion=systemd>=257.1'
    test.service: ConditionVersion=>=257.1 succeeded.

    $ uname -r
    6.12.13-200.fc41.aarch64

    $ systemd-analyze condition 'ConditionVersion=kernel > 4.4'
    test.service: ConditionVersion=kernel > 4.4 succeeded.

    $ systemd-analyze condition 'ConditionVersion=kernel > 6.20'
    test.service: ConditionVersion=kernel > 6.20 failed.

    $ systemd-analyze condition 'ConditionVersion=kernel < 9.0'
    test.service: ConditionVersion=kernel < 9.0 succeeded.
2025-03-18 18:36:59 +09:00
Zbigniew Jędrzejewski-Szmek
3a15daf440 Restore docs/PAX_CONTROL_GROUPS
This partially reverts 8d04b8198d.
If we completely drop the file, users will get a 404. But this document
has been in place for a long time and is referred to in many other places,
incl. our old wiki at https://www.freedesktop.org/wiki/Software/.
The page already says that it's been replaced
("… Please consult this document only as a historical reference. …").
We should only remove it from the index (which
8d04b8198d did).

In general, let's be more careful about preserving link stability.
When we change something in a way that breaks URLs, we're creating
pain for users.
2025-03-14 20:33:37 +09:00
Zbigniew Jędrzejewski-Szmek
51eab4afa6 docs/ROOTFS_DISCOVERY: removed doubled dot
Inadvertent change in 487b95d9b6.
2025-03-14 11:06:37 +01:00
Zbigniew Jędrzejewski-Szmek
487b95d9b6 docs/ROOTFS_DISCOVERY: minor wording and syntactic improvements 2025-03-13 16:05:03 +01:00
Ivan Kruglov
cd20d48c69 docs: clarify userns mapping when /proc/sys is rw 2025-03-11 13:25:54 +01:00
Mike Yuan
8d04b8198d docs: reference cgroup v1 as historical and unsupported 2025-03-10 05:24:19 +09:00
Lennart Poettering
0e1ede4b4b homectl: add interface for controlling storage for negative machine ID matches 2025-03-07 18:15:04 +01:00
Lennart Poettering
4f00011b68 homectl: add a 'dry-run' mode for registering/creating users
Since this only covers user creation/registration for now, let's hide it
behind an env var. We might reconsider this eventually and make it a
proper switch one day, but who knows, it after all has this "debug tool"
wiff.
2025-03-07 18:14:14 +01:00
Lennart Poettering
e0a634d520 docs: mention when /var/ has to be writable
In light of https://github.com/systemd/systemd/issues/36635 let's
clarify things a bit regarding writability of /var/.
2025-03-06 17:26:27 +01:00
Lennart Poettering
1ed0f6e9bf docs: document factory reset logic 2025-03-05 12:38:30 +01:00
Lennart Poettering
73e53d2ee4 tpm2-clear: optionally reset TPM during a factory reset 2025-03-05 12:37:51 +01:00
Daan De Meyer
daa2547e31 Add a few more bypass environment variables
When we're building ParticleOS images, we don't want the package
manager (or mkosi) to run systemd-sysusers, systemd-tmpfiles or
systemctl preset so let's add a few more bypass environment
variables that we can set to have execution of these skipped like
we already have $SYSTEMD_HWDB_UPDATE_BYPASS and $KERNEL_INSTALL_BYPASS.
2025-03-01 16:22:53 +01:00
Lennart Poettering
09b130c9cd doc: add OSC 3008 spec 2025-02-27 15:03:17 +01:00
Yu Watanabe
cf4b70aac4 docs: fix typo
Follow-ups for d5de148996.
2025-02-27 13:37:20 +09:00
Lennart Poettering
14871a6529 efivars: kill SystemdOptions efi var support
This has been depracted since v254 (2023). Let's kill it for
good now, it has been long enough with 2y. Noone has shown up who wants
to keep it. And given it doesn't work in SB world anyway, and is not
measured is quite problematic security wise.
2025-02-26 17:28:43 +01:00
Daan De Meyer
2dbc2d1d0f docs: Use mkosi -R instead of mkosi -t none (#36528)
mkosi now supports -R to rerun build scripts without rebuilding the
image so let's document that instead of the current hack to prevent
the rebuild by changing the output format.
2025-02-26 15:56:51 +01:00
Daan De Meyer
031a474c91 docs: Use mkosi -R instead of mkosi -t none
mkosi now supports -R to rerun build scripts without rebuilding the
image so let's document that instead of the current hack to prevent
the rebuild by changing the output format.
2025-02-26 14:58:53 +01:00
Lennart Poettering
d5de148996 doc: add document explaining the 3 key components of the boot and how we find the rootfs
After the network boot PR got merged we can use some more high-level
docs I guess.
2025-02-26 09:55:43 +01:00
Lin Jian
7593173c94 docs/CONTROL_GROUP_INTERFACE: fix typo 2025-02-21 16:51:49 +00:00
Lennart Poettering
e15d18b4c6 sd-stub: if we are http booted, query source URL and write to EFI variable
This way userspace can read the field, and use it to retrieve more
resources from the same place.
2025-02-21 10:03:32 +01:00