summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-25 02:54:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-25 02:54:53 +0000
commit527e791c5346846e2bc7d32f7597d70f9a274499 (patch)
treed2bd96487387b049f0a99182d4cfd066adddd039 /docs
parentAdding debian version 255.4-1. (diff)
downloadsystemd-527e791c5346846e2bc7d32f7597d70f9a274499.tar.xz
systemd-527e791c5346846e2bc7d32f7597d70f9a274499.zip
Merging upstream version 255.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs')
-rw-r--r--docs/API_FILE_SYSTEMS.md38
-rw-r--r--docs/ARCHITECTURE.md214
-rw-r--r--docs/BACKPORTS.md16
-rw-r--r--docs/BOOT.md10
-rw-r--r--docs/BOOT_LOADER_INTERFACE.md2
-rw-r--r--docs/BUILDING_IMAGES.md139
-rw-r--r--docs/CATALOG.md63
-rw-r--r--docs/CGROUP_DELEGATION.md4
-rw-r--r--docs/CODE_OF_CONDUCT.md10
-rw-r--r--docs/CODE_QUALITY.md2
-rw-r--r--docs/CODING_STYLE.md2
-rw-r--r--docs/CONTAINER_INTERFACE.md7
-rw-r--r--docs/CONTRIBUTING.md42
-rw-r--r--docs/CONTROL_GROUP_INTERFACE.md20
-rw-r--r--docs/CONVERTING_TO_HOMED.md123
-rw-r--r--docs/COREDUMP.md84
-rw-r--r--docs/CREDENTIALS.md4
-rw-r--r--docs/DAEMON_SOCKET_ACTIVATION.md25
-rw-r--r--docs/DEBUGGING.md133
-rw-r--r--docs/DESKTOP_ENVIRONMENTS.md28
-rw-r--r--docs/DISTRO_PORTING.md34
-rw-r--r--docs/ELF_PACKAGE_METADATA.md4
-rw-r--r--docs/FAQ.md11
-rw-r--r--docs/GROUP_RECORD.md61
-rw-r--r--docs/HACKING.md12
-rw-r--r--docs/HOME_DIRECTORY.md188
-rw-r--r--docs/INCOMPATIBILITIES.md8
-rw-r--r--docs/INHIBITOR_LOCKS.md74
-rw-r--r--docs/INITRD_INTERFACE.md9
-rw-r--r--docs/JOURNAL_EXPORT_FORMATS.md40
-rw-r--r--docs/JOURNAL_FILE_FORMAT.md90
-rw-r--r--docs/MINIMAL_BUILDS.md19
-rw-r--r--docs/MY_SERVICE_CANT_GET_REATLIME.md49
-rw-r--r--docs/OPTIMIZATIONS.md133
-rw-r--r--docs/PASSWORD_AGENTS.md43
-rw-r--r--docs/PAX_CONTROL_GROUPS.md117
-rw-r--r--docs/PORTABILITY_AND_STABILITY.md108
-rw-r--r--docs/PREDICTABLE_INTERFACE_NAMES.md42
-rw-r--r--docs/PRESET.md31
-rw-r--r--docs/RANDOM_SEEDS.md338
-rw-r--r--docs/ROOT_STORAGE_DAEMONS.md4
-rw-r--r--docs/SECURITY.md8
-rw-r--r--docs/SEPARATE_USR_IS_BROKEN.md75
-rw-r--r--docs/SYSLOG.md48
-rw-r--r--docs/SYSTEMD_FILE_HIERARCHY_REQUIREMENTS.md30
-rw-r--r--docs/THE_CASE_FOR_THE_USR_MERGE.md2
-rw-r--r--docs/TIPS_AND_TRICKS.md16
-rw-r--r--docs/UIDS-GIDS.md299
-rw-r--r--docs/USERDB_AND_DESKTOPS.md150
-rw-r--r--docs/USER_GROUP_API.md217
-rw-r--r--docs/USER_NAMES.md91
-rw-r--r--docs/USER_RECORD.md8
-rw-r--r--docs/VIRTUALIZED_TESTING.md23
-rw-r--r--docs/WRITING_DESKTOP_ENVIRONMENTS.md41
-rw-r--r--docs/WRITING_DISPLAY_MANAGERS.md48
-rw-r--r--docs/WRITING_NETWORK_CONFIGURATION_MANAGERS.md62
-rw-r--r--docs/WRITING_RESOLVER_CLIENTS.md52
-rw-r--r--docs/WRITING_VM_AND_CONTAINER_MANAGERS.md53
-rw-r--r--docs/assets/f17boot.pngbin0 -> 5807 bytes
59 files changed, 2122 insertions, 1482 deletions
diff --git a/docs/API_FILE_SYSTEMS.md b/docs/API_FILE_SYSTEMS.md
index 84a1900..3ef9077 100644
--- a/docs/API_FILE_SYSTEMS.md
+++ b/docs/API_FILE_SYSTEMS.md
@@ -9,7 +9,13 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_So you are seeing all kinds of weird file systems in the output of mount(8) that are not listed in `/etc/fstab`, and you wonder what those are, how you can get rid of them, or at least change their mount options._
-The Linux kernel provides a number of different ways for userspace to communicate with it. For many facilities there are system calls, others are hidden behind Netlink interfaces, and even others are exposed via virtual file systems such as `/proc` or `/sys`. These file systems are programming interfaces, they are not actually backed by real, persistent storage. They simply use the file system interface of the kernel as interface to various unrelated mechanisms. Similarly, there are file systems that userspace uses for its own API purposes, to store shared memory segments, shared temporary files or sockets. In this article we want to discuss all these kind of _API file systems_. More specifically, here's a list of these file systems typical Linux systems currently have:
+The Linux kernel provides a number of different ways for userspace to communicate with it.
+For many facilities there are system calls, others are hidden behind Netlink interfaces, and even others are exposed via virtual file systems such as `/proc` or `/sys`.
+These file systems are programming interfaces, they are not actually backed by real, persistent storage.
+They simply use the file system interface of the kernel as interface to various unrelated mechanisms.
+Similarly, there are file systems that userspace uses for its own API purposes, to store shared memory segments, shared temporary files or sockets.
+In this article we want to discuss all these kind of _API file systems_.
+More specifically, here's a list of these file systems typical Linux systems currently have:
* `/sys` for exposing kernel devices, drivers and other kernel information to userspace
* `/proc` for exposing kernel settings, processes and other kernel information to userspace
@@ -27,26 +33,40 @@ The Linux kernel provides a number of different ways for userspace to communicat
* `/sys/fs/fuse/connections` for exposing kernel FUSE connections to userspace (X)
* `/sys/firmware/efi/efivars` for exposing firmware variables to userspace
-All these _API file systems_ are mounted during very early boot-up of systemd and are generally not listed in `/etc/fstab`. Depending on the used kernel configuration some of these API file systems might not be available and others might exist instead. As these interfaces are important for kernel-to-userspace and userspace-to-userspace communication they are mounted automatically and without configuration or interference by the user. Disabling or changing their parameters might hence result in applications breaking as they can no longer access the interfaces they need.
+All these _API file systems_ are mounted during very early boot-up of systemd and are generally not listed in `/etc/fstab`.
+Depending on the used kernel configuration some of these API file systems might not be available and others might exist instead.
+As these interfaces are important for kernel-to-userspace and userspace-to-userspace communication they are mounted automatically and without configuration or interference by the user.
+Disabling or changing their parameters might hence result in applications breaking as they can no longer access the interfaces they need.
Even though the default settings of these file systems should normally be suitable for most setups, in some cases it might make sense to change the mount options, or possibly even disable some of these file systems.
-Even though normally none of these API file systems are listed in `/etc/fstab` they may be added there. If so, any options specified therein will be applied to that specific API file system. Hence: to alter the mount options or other parameters of these file systems, simply add them to `/etc/fstab` with the appropriate settings and you are done. Using this technique it is possible to change the source, type of a file system in addition to simply changing mount options. That is useful to turn `/tmp` to a true file system backed by a physical disk.
+Even though normally none of these API file systems are listed in `/etc/fstab` they may be added there.
+If so, any options specified therein will be applied to that specific API file system.
+Hence: to alter the mount options or other parameters of these file systems, simply add them to `/etc/fstab` with the appropriate settings and you are done.
+Using this technique it is possible to change the source, type of a file system in addition to simply changing mount options.
+That is useful to turn `/tmp` to a true file system backed by a physical disk.
-It is possible to disable the automatic mounting of some (but not all) of these file systems, if that is required. These are marked with (X) in the list above. You may disable them simply by masking them:
+It is possible to disable the automatic mounting of some (but not all) of these file systems, if that is required.
+These are marked with (X) in the list above.
+You may disable them simply by masking them:
```sh
systemctl mask dev-hugepages.mount
```
-This has the effect that the huge memory page API FS is not mounted by default, starting with the next boot. See [Three Levels of Off](http://0pointer.de/blog/projects/three-levels-of-off.html) for more information on masking.
+This has the effect that the huge memory page API FS is not mounted by default, starting with the next boot.
+See [Three Levels of Off](http://0pointer.de/blog/projects/three-levels-of-off.html) for more information on masking.
-The systemd service [systemd-remount-fs.service](http://www.freedesktop.org/software/systemd/man/systemd-remount-fs.service.html) is responsible for applying mount parameters from `/etc/fstab` to the actual mounts.
+The systemd service [systemd-remount-fs.service](http://www.freedesktop.org/software/systemd/man/systemd-remount-fs.service.html)
+is responsible for applying mount parameters from `/etc/fstab` to the actual mounts.
## Why are you telling me all this? I just want to get rid of the tmpfs backed /tmp!
You have three options:
-1. Disable any mounting on `/tmp` so that it resides on the same physical file system as the root directory. For that, execute `systemctl mask tmp.mount`
-2. Mount a different, physical file system to `/tmp`. For that, simply create an entry for it in `/etc/fstab` as you would do for any other file system.
-3. Keep `/tmp` but increase/decrease the size of it. For that, also just create an entry for it in `/etc/fstab` as you would do for any other `tmpfs` file system, and use the right `size=` option.
+1. Disable any mounting on `/tmp` so that it resides on the same physical file system as the root directory.
+ For that, execute `systemctl mask tmp.mount`
+2. Mount a different, physical file system to `/tmp`.
+ For that, simply create an entry for it in `/etc/fstab` as you would do for any other file system.
+3. Keep `/tmp` but increase/decrease the size of it.
+ For that, also just create an entry for it in `/etc/fstab` as you would do for any other `tmpfs` file system, and use the right `size=` option.
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 1478ea0..d046f27 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -9,50 +9,37 @@ SPDX-License-Identifier: LGPL-2.1-or-later
## Code Map
-This document provides a high-level overview of the various components of the
-systemd repository.
+This document provides a high-level overview of the various components of the systemd repository.
## Source Code
-Directories in `src/` provide the implementation of all daemons, libraries and
-command-line tools shipped by the project. There are many, and more are
-constantly added, so we will not enumerate them all here — the directory
-names are self-explanatory.
+Directories in `src/` provide the implementation of all daemons, libraries and command-line tools shipped by the project.
+There are many, and more are constantly added, so we will not enumerate them all here — the directory names are self-explanatory.
### Shared Code
-The code that is shared between components is split into a few directories,
-each with a different purpose:
-
-- `src/basic/` and `src/fundamental/` — those directories contain code
- primitives that are used by all other code. `src/fundamental/` is stricter,
- because it used for EFI and user-space code, while `src/basic/` is only used
- for user-space code. The code in `src/fundamental/` cannot depend on any
- other code in the tree, and `src/basic/` can depend only on itself and
- `src/fundamental/`. For user-space, a static library is built from this code
- and linked statically in various places.
-
-- `src/libsystemd/` implements the `libsystemd.so` shared library (also
- available as static `libsystemd.a`). This code may use anything in
- `src/basic/` or `src/fundamental/`.
-
-- `src/shared/` provides various utilities and code shared between other
- components that is exposed as the `libsystemd-shared-<nnn>.so` shared library.
-
-The other subdirectories implement individual components. They may depend only
-on `src/fundamental/` + `src/basic/`, or also on `src/libsystemd/`, or also on
-`src/shared/`.
-
-You might wonder what kind of code belongs where. In general, the rule is that
-code should be linked as few times as possible, ideally only once. Thus code that
-is used by "higher-level" components (e.g. our binaries which are linked to
-`libsystemd-shared-<nnn>.so`), would go to a subdirectory specific to that
-component if it is only used there. If the code is to be shared between
-components, it'd go to `src/shared/`. Shared code that is used by multiple
-components that do not link to `libsystemd-shared-<nnn>.so` may live either in
-`src/libsystemd/`, `src/basic/`, or `src/fundamental/`. Any code that is used
-only for EFI goes under `src/boot/efi/`, and `src/fundamental/` if is shared
-with non-EFI compoenents.
+The code that is shared between components is split into a few directories, each with a different purpose:
+
+- `src/basic/` and `src/fundamental/` — those directories contain code primitives that are used by all other code.
+ `src/fundamental/` is stricter, because it used for EFI and user-space code, while `src/basic/` is only used for user-space code.
+ The code in `src/fundamental/` cannot depend on any other code in the tree, and `src/basic/` can depend only on itself and `src/fundamental/`.
+ For user-space, a static library is built from this code and linked statically in various places.
+
+- `src/libsystemd/` implements the `libsystemd.so` shared library (also available as static `libsystemd.a`).
+ This code may use anything in `src/basic/` or `src/fundamental/`.
+
+- `src/shared/` provides various utilities and code shared between other components that is exposed as the `libsystemd-shared-<nnn>.so` shared library.
+
+The other subdirectories implement individual components.
+They may depend only on `src/fundamental/` + `src/basic/`, or also on `src/libsystemd/`, or also on `src/shared/`.
+
+You might wonder what kind of code belongs where.
+In general, the rule is that code should be linked as few times as possible, ideally only once.
+Thus code that is used by "higher-level" components (e.g. our binaries which are linked to `libsystemd-shared-<nnn>.so`),
+would go to a subdirectory specific to that component if it is only used there.
+If the code is to be shared between components, it'd go to `src/shared/`.
+Shared code that is used by multiple components that do not link to `libsystemd-shared-<nnn>.so` may live either in `src/libsystemd/`, `src/basic/`, or `src/fundamental/`.
+Any code that is used only for EFI goes under `src/boot/efi/`, and `src/fundamental/` if is shared with non-EFI compoenents.
To summarize:
@@ -66,157 +53,118 @@ To summarize:
`src/libsystemd/`
- may be used by all code in the tree that links to `libsystem.so`
-- may not use any code outside of `src/fundamental/`, `src/basic/`, and
- `src/libsystemd/`
+- may not use any code outside of `src/fundamental/`, `src/basic/`, and `src/libsystemd/`
`src/shared/`
-- may be used by all code in the tree, except for code in `src/basic/`,
- `src/libsystemd/`, `src/nss-*`, `src/login/pam_systemd.*`, and files under
- `src/journal/` that end up in `libjournal-client.a` convenience library.
-- may not use any code outside of `src/fundamental/`, `src/basic/`,
- `src/libsystemd/`, `src/shared/`
+- may be used by all code in the tree, except for code in `src/basic/`, `src/libsystemd/`, `src/nss-*`, `src/login/pam_systemd.*`,
+ and files under `src/journal/` that end up in `libjournal-client.a` convenience library.
+- may not use any code outside of `src/fundamental/`, `src/basic/`, `src/libsystemd/`, `src/shared/`
### PID 1
-Code located in `src/core/` implements the main logic of the systemd system (and user)
-service manager.
+Code located in `src/core/` implements the main logic of the systemd system (and user) service manager.
BPF helpers written in C and used by PID 1 can be found under `src/core/bpf/`.
#### Implementing Unit Settings
-The system and session manager supports a large number of unit settings. These can generally
-be configured in three ways:
+The system and session manager supports a large number of unit settings.
+These can generally be configured in three ways:
1. Via textual, INI-style configuration files called *unit* *files*
2. Via D-Bus messages to the manager
3. Via the `systemd-run` and `systemctl set-property` commands
-From a user's perspective, the third is a wrapper for the second. To implement a new unit
-setting, it is necessary to support all three input methods:
+From a user's perspective, the third is a wrapper for the second.
+To implement a new unit setting, it is necessary to support all three input methods:
-1. *unit* *files* are parsed in `src/core/load-fragment.c`, with many simple and fixed-type
-unit settings being parsed by common helpers, with the definition in the generator file
-`src/core/load-fragment-gperf.gperf.in`
+1. *unit* *files* are parsed in `src/core/load-fragment.c`, with many simple and fixed-type unit settings being parsed by common helpers, with the definition in the generator file `src/core/load-fragment-gperf.gperf.in`
2. D-Bus messages are defined and parsed in `src/core/dbus-*.c`
-3. `systemd-run` and `systemctl set-property` do client-side parsing and translation into
-D-Bus messages in `src/shared/bus-unit-util.c`
+3. `systemd-run` and `systemctl set-property` do client-side parsing and translation into D-Bus messages in `src/shared/bus-unit-util.c`
-So that they are exercised by the fuzzing CI, new unit settings should also be listed in the
-text files under `test/fuzz/fuzz-unit-file/`.
+So that they are exercised by the fuzzing CI, new unit settings should also be listed in the text files under `test/fuzz/fuzz-unit-file/`.
### systemd-udev
-Sources for the udev daemon and command-line tool (single binary) can be found under
-`src/udev/`.
+Sources for the udev daemon and command-line tool (single binary) can be found under `src/udev/`.
### Unit Tests
-Source files found under `src/test/` implement unit-level testing, mostly for
-modules found in `src/basic/` and `src/shared/`, but not exclusively. Each test
-file is compiled in a standalone binary that can be run to exercise the
-corresponding module. While most of the tests can be run by any user, some
-require privileges, and will attempt to clearly log about what they need
-(mostly in the form of effective capabilities). These tests are self-contained,
-and generally safe to run on the host without side effects.
+Source files found under `src/test/` implement unit-level testing, mostly for modules found in `src/basic/` and `src/shared/`, but not exclusively.
+Each test file is compiled in a standalone binary that can be run to exercise the corresponding module.
+While most of the tests can be run by any user, some require privileges, and will attempt to clearly log about what they need (mostly in the form of effective capabilities).
+These tests are self-contained, and generally safe to run on the host without side effects.
-Ideally, every module in `src/basic/` and `src/shared/` should have a
-corresponding unit test under `src/test/`, exercising every helper function.
+Ideally, every module in `src/basic/` and `src/shared/` should have a corresponding unit test under `src/test/`, exercising every helper function.
### Fuzzing
-Fuzzers are a type of unit tests that execute code on an externally-supplied
-input sample. Fuzzers are called `fuzz-*`. Fuzzers for `src/basic/` and
-`src/shared` live under `src/fuzz/`, and those for other parts of the codebase
-should be located next to the code they test.
-
-Files under `test/fuzz/` contain input data for fuzzers, one subdirectory for
-each fuzzer. Some of the files are "seed corpora", i.e. files that contain
-lists of settings and input values intended to generate initial coverage, and
-other files are samples saved by the fuzzing engines when they find an issue.
-
-When adding new input samples under `test/fuzz/*/`, please use some
-short-but-meaningful names. Names of meson tests include the input file name
-and output looks awkward if they are too long.
-
-Fuzzers are invoked primarily in three ways: firstly, each fuzzer is compiled
-as a normal executable and executed for each of the input samples under
-`test/fuzz/` as part of the test suite. Secondly, fuzzers may be instrumented
-with sanitizers and invoked as part of the test suite (if `-Dfuzz-tests=true`
-is configured). Thirdly, fuzzers are executed through fuzzing engines that try
-to find new "interesting" inputs through coverage feedback and massive
-parallelization; see the links for oss-fuzz in [Code quality](CODE_QUALITY).
-For testing and debugging, fuzzers can be executed as any other program,
-including under `valgrind` or `gdb`.
+Fuzzers are a type of unit tests that execute code on an externally-supplied input sample.
+Fuzzers are called `fuzz-*`.
+Fuzzers for `src/basic/` and `src/shared` live under `src/fuzz/`, and those for other parts of the codebase should be located next to the code they test.
+
+Files under `test/fuzz/` contain input data for fuzzers, one subdirectory for each fuzzer.
+Some of the files are "seed corpora", i.e. files that contain lists of settings and input values intended to generate initial coverage, and other files are samples saved by the fuzzing engines when they find an issue.
+
+When adding new input samples under `test/fuzz/*/`, please use some short-but-meaningful names.
+Names of meson tests include the input file name and output looks awkward if they are too long.
+
+Fuzzers are invoked primarily in three ways:
+firstly, each fuzzer is compiled as a normal executable and executed for each of the input samples under `test/fuzz/` as part of the test suite.
+Secondly, fuzzers may be instrumented with sanitizers and invoked as part of the test suite (if `-Dfuzz-tests=true` is configured).
+Thirdly, fuzzers are executed through fuzzing engines that tryto find new "interesting" inputs through coverage feedback and massive parallelization; see the links for oss-fuzz in [Code quality](/CODE_QUALITY).
+For testing and debugging, fuzzers can be executed as any other program, including under `valgrind` or `gdb`.
## Integration Tests
-Sources in `test/TEST-*` implement system-level testing for executables,
-libraries and daemons that are shipped by the project. They require privileges
-to run, and are not safe to execute directly on a host. By default they will
-build an image and run the test under it via `qemu` or `systemd-nspawn`.
+Sources in `test/TEST-*` implement system-level testing for executables, libraries and daemons that are shipped by the project.
+They require privileges to run, and are not safe to execute directly on a host.
+By default they will build an image and run the test under it via `qemu` or `systemd-nspawn`.
-Most of those tests should be able to run via `systemd-nspawn`, which is
-orders-of-magnitude faster than `qemu`, but some tests require privileged
-operations like using `dm-crypt` or `loopdev`. They are clearly marked if that
-is the case.
+Most of those tests should be able to run via `systemd-nspawn`, which is orders-of-magnitude faster than `qemu`, but some tests require privileged operations like using `dm-crypt` or `loopdev`.
+They are clearly marked if that is the case.
-See `test/README.testsuite` for more specific details.
+See [`test/README.testsuite`](https://github.com/systemd/systemd/blob/main/test/README.testsuite) for more specific details.
## hwdb
-Rules built in the static hardware database shipped by the project can be found
-under `hwdb.d/`. Some of these files are updated automatically, some are filled
-by contributors.
+Rules built in the static hardware database shipped by the project can be found under `hwdb.d/`.
+Some of these files are updated automatically, some are filled by contributors.
## Documentation
### systemd.io
-Markdown files found under `docs/` are automatically published on the
-[systemd.io](https://systemd.io) website using Github Pages. A minimal unit test
-to ensure the formatting doesn't have errors is included in the
-`meson test -C build/ github-pages` run as part of the CI.
+Markdown files found under `docs/` are automatically published on the [systemd.io](https://systemd.io) website using Github Pages.
+A minimal unit test to ensure the formatting doesn't have errors is included in the `meson test -C build/ github-pages` run as part of the CI.
### Man pages
-Manpages for binaries and libraries, and the DBUS interfaces, can be found under
-`man/` and should ideally be kept in sync with changes to the corresponding
-binaries and libraries.
+Manpages for binaries and libraries, and the DBUS interfaces, can be found under `man/` and should ideally be kept in sync with changes to the corresponding binaries and libraries.
### Translations
-Translations files for binaries and daemons, provided by volunteers, can be found
-under `po/` in the usual format. They are kept up to date by contributors and by
-automated tools.
+Translations files for binaries and daemons, provided by volunteers, can be found under `po/` in the usual format.
+They are kept up to date by contributors and by automated tools.
## System Configuration files and presets
-Presets (or templates from which they are generated) for various daemons and tools
-can be found under various directories such as `factory/`, `modprobe.d/`, `network/`,
-`presets/`, `rules.d/`, `shell-completion/`, `sysctl.d/`, `sysusers.d/`, `tmpfiles.d/`.
+Presets (or templates from which they are generated) for various daemons and tools can be found under various directories such as
+`factory/`, `modprobe.d/`, `network/`, `presets/`, `rules.d/`, `shell-completion/`, `sysctl.d/`, `sysusers.d/`, `tmpfiles.d/`.
## Utilities for Developers
-`tools/`, `coccinelle/`, `.github/`, `.semaphore/`, `.mkosi/` host various
-utilities and scripts that are used by maintainers and developers. They are not
-shipped or installed.
+`tools/`, `coccinelle/`, `.github/`, `.semaphore/`, `.mkosi/` host various utilities and scripts that are used by maintainers and developers.
+They are not shipped or installed.
# Service Manager Overview
-The Service Manager takes configuration in the form of unit files, credentials,
-kernel command line options and D-Bus commands, and based on those manages the
-system and spawns other processes. It runs in system mode as PID1, and in user
-mode with one instance per user session.
-
-When starting a unit requires forking a new process, configuration for the new
-process will be serialized and passed over to the new process, created via a
-posix_spawn() call. This is done in order to avoid excessive processing after
-a fork() but before an exec(), which is against glibc's best practices and can
-also result in a copy-on-write trap. The new process will start as the
-`systemd-executor` binary, which will deserialize the configuration and apply
-all the options (sandboxing, namespacing, cgroup, etc.) before exec'ing the
-configured executable.
+The Service Manager takes configuration in the form of unit files, credentials, kernel command line options and D-Bus commands, and based on those manages the system and spawns other processes.
+It runs in system mode as PID1, and in user mode with one instance per user session.
+
+When starting a unit requires forking a new process, configuration for the new process will be serialized and passed over to the new process, created via a posix_spawn() call.
+This is done in order to avoid excessive processing after a fork() but before an exec(), which is against glibc's best practices and can also result in a copy-on-write trap.
+The new process will start as the `systemd-executor` binary, which will deserialize the configuration and apply all the options (sandboxing, namespacing, cgroup, etc.) before exec'ing the configured executable.
```
┌──────┐posix_spawn() ┌───────────┐execve() ┌────────┐
diff --git a/docs/BACKPORTS.md b/docs/BACKPORTS.md
index 6fbb57d..b2aba23 100644
--- a/docs/BACKPORTS.md
+++ b/docs/BACKPORTS.md
@@ -7,13 +7,22 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Backports
-The upstream systemd git repo at [https://github.com/systemd/systemd](https://github.com/systemd/systemd) only contains the main systemd branch that progresses at a quick pace, continuously bringing both bugfixes and new features. Distributions usually prefer basing their releases on stabilized versions branched off from this, that receive the bugfixes but not the features.
+The upstream systemd git repo at [https://github.com/systemd/systemd](https://github.com/systemd/systemd) only contains the main systemd branch that progresses at a quick pace, continuously bringing both bugfixes and new features.
+
+Distributions usually prefer basing their releases on stabilized versions branched off from this, that receive the bugfixes but not the features.
## Stable Branch Repository
Stable branches are available from [https://github.com/systemd/systemd-stable](https://github.com/systemd/systemd-stable).
-Stable branches are started for certain releases of systemd and named after them, e.g. v208-stable. Stable branches are typically managed by distribution maintainers on an as needed basis. For example v208 has been chosen for stable as several distributions are shipping this version and the official/upstream cycle of v208-v209 was a long one due to kdbus work. If you are using a particular version and find yourself backporting several patches, you may consider pushing a stable branch here for that version so others can benefit. Please contact us if you are interested.
+Stable branches are started for certain releases of systemd and named after them, e.g. v208-stable.
+Stable branches are typically managed by distribution maintainers on an as needed basis.
+
+For example v208 has been chosen for stable as several distributions are shipping this version and the official/upstream cycle of v208-v209 was a long one due to kdbus work.
+
+If you are using a particular version and find yourself backporting several patches, you may consider pushing a stable branch here for that version so others can benefit.
+
+Please contact us if you are interested.
The following types of commits are cherry-picked onto those branches:
@@ -22,4 +31,5 @@ The following types of commits are cherry-picked onto those branches:
* hardware database additions, especially the keymap updates
* small non-conflicting features deemed safe to add in a stable release
-Please try to ensure that anything backported to the stable repository is done with the `git cherry-pick -x` option such that text stating the original SHA1 is added into the commit message. This makes it easier to check where the code came from (as sometimes it is necessary to add small fixes as new code due to the upstream refactors that are deemed too invasive to backport as a stable patch.
+Please try to ensure that anything backported to the stable repository is done with the `git cherry-pick -x` option such that text stating the original SHA1 is added into the commit message.
+This makes it easier to check where the code came from (as sometimes it is necessary to add small fixes as new code due to the upstream refactors) that are deemed too invasive to backport as a stable patch.
diff --git a/docs/BOOT.md b/docs/BOOT.md
index 574cc08..5590e6a 100644
--- a/docs/BOOT.md
+++ b/docs/BOOT.md
@@ -9,11 +9,15 @@ SPDX-License-Identifier: LGPL-2.1-or-later
systemd-boot is a UEFI boot manager which executes configured EFI images. The default entry is selected by a configured pattern (glob) or an on-screen menu.
-systemd-boot operates on the EFI System Partition (ESP) only. Configuration file fragments, kernels, initrds, other EFI images need to reside on the ESP. Linux kernels need to be built with CONFIG\_EFI\_STUB to be able to be directly executed as an EFI image.
+systemd-boot operates on the EFI System Partition (ESP) only. Configuration file fragments, kernels, initrds, other EFI images need to reside on the ESP.
+
+Linux kernels need to be built with CONFIG\_EFI\_STUB to be able to be directly executed as an EFI image.
systemd-boot reads simple and entirely generic boot loader configuration files; one file per boot loader entry to select from. All files need to reside on the ESP.
-Pressing the Space key (or most other keys actually work too) during bootup will show an on-screen menu with all configured loader entries to select from. Pressing Enter on the selected entry loads and starts the EFI image.
+Pressing the Space key (or most other keys actually work too) during bootup will show an on-screen menu with all configured loader entries to select from.
+
+Pressing Enter on the selected entry loads and starts the EFI image.
If no timeout is configured, which is the default setting, and no key pressed during bootup, the default entry is executed right away.
@@ -108,4 +112,4 @@ Links:
[https://github.com/systemd/systemd](https://github.com/systemd/systemd)
-[http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/](http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/)
+[https://uapi-group.org/specifications/specs/boot_loader_specification/](https://uapi-group.org/specifications/specs/boot_loader_specification/)
diff --git a/docs/BOOT_LOADER_INTERFACE.md b/docs/BOOT_LOADER_INTERFACE.md
index a1f6b59..4bf074d 100644
--- a/docs/BOOT_LOADER_INTERFACE.md
+++ b/docs/BOOT_LOADER_INTERFACE.md
@@ -78,7 +78,7 @@ variables. All EFI variables use the vendor UUID
* `1 << 1` → The boot loader honours `LoaderConfigTimeoutOneShot` when set.
* `1 << 2` → The boot loader honours `LoaderEntryDefault` when set.
* `1 << 3` → The boot loader honours `LoaderEntryOneShot` when set.
- * `1 << 4` → The boot loader supports boot counting as described in [Automatic Boot Assessment](AUTOMATIC_BOOT_ASSESSMENT).
+ * `1 << 4` → The boot loader supports boot counting as described in [Automatic Boot Assessment](/AUTOMATIC_BOOT_ASSESSMENT).
* `1 << 5` → The boot loader supports looking for boot menu entries in the Extended Boot Loader Partition.
* `1 << 6` → The boot loader supports passing a random seed to the OS.
* `1 << 13` → The boot loader honours `menu-disabled` option when set.
diff --git a/docs/BUILDING_IMAGES.md b/docs/BUILDING_IMAGES.md
index b11afa3..dcae4bb 100644
--- a/docs/BUILDING_IMAGES.md
+++ b/docs/BUILDING_IMAGES.md
@@ -9,12 +9,14 @@ SPDX-License-Identifier: LGPL-2.1-or-later
In many scenarios OS installations are shipped as pre-built images, that
require no further installation process beyond simple `dd`-ing the image to
-disk and booting it up. When building such "golden" OS images for
+disk and booting it up.
+When building such "golden" OS images for
`systemd`-based OSes a few points should be taken into account.
Most of the points described here are implemented by the
[`mkosi`](https://github.com/systemd/mkosi) OS image builder developed and
-maintained by the systemd project. If you are using or working on another image
+maintained by the systemd project.
+If you are using or working on another image
builder it's recommended to keep the following concepts and recommendations in
mind.
@@ -24,28 +26,25 @@ Typically the same OS image shall be deployable in multiple instances, and each
instance should automatically acquire its own identifying credentials on first
boot. For that it's essential to:
-1. Remove the
- [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html)
- file or write the string `uninitialized\n` into it. This file is supposed to
- carry a 128-bit identifier unique to the system. Only when it is reset it
- will be auto-generated on first boot and thus be truly unique. If this file
- is not reset, and carries a valid ID every instance of the system will come
+1. Remove the [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html)
+ file or write the string `uninitialized\n` into it.
+ This file is supposed to carry a 128-bit identifier unique to the system.
+ Only when it is reset it will be auto-generated on first boot and thus be truly unique.
+ If this file is not reset, and carries a valid ID every instance of the system will come
up with the same ID and that will likely lead to problems sooner or later,
- as many network-visible identifiers are commonly derived from the machine
- ID, for example, IPv6 addresses or transient MAC addresses.
+ as many network-visible identifiers are commonly derived from the machine ID,
+ for example, IPv6 addresses or transient MAC addresses.
-2. Remove the `/var/lib/systemd/random-seed` file (see
+2. Remove the `/var/lib/systemd/random-seed` file(see
[`systemd-random-seed(8)`](https://www.freedesktop.org/software/systemd/man/systemd-random-seed.service.html)),
- which is used to seed the kernel's random pool on boot. If this file is
- shipped pre-initialized, every instance will seed its random pool with the
+ which is used to seed the kernel's random pool on boot.
+ If this file is shipped pre-initialized, every instance will seed its random pool with the
same random data that is included in the image, and thus possibly generate
- random data that is more similar to other instances booted off the same
- image than advisable.
+ random data that is more similar to other instances booted off the same image than advisable.
3. Remove the `/loader/random-seed` file (see
[`systemd-boot(7)`](https://www.freedesktop.org/software/systemd/man/systemd-boot.html))
- from the UEFI System Partition (ESP), in case the `systemd-boot` boot loader
- is used in the image.
+ from the UEFI System Partition (ESP), in case the `systemd-boot` boot loader is used in the image.
4. It might also make sense to remove
[`/etc/hostname`](https://www.freedesktop.org/software/systemd/man/hostname.html)
@@ -69,24 +68,25 @@ The
logic used to generate
[Boot Loader Specification Type #1](https://uapi-group.org/specifications/specs/boot_loader_specification/#type-1-boot-loader-specification-entries)
entries by default uses the machine ID as stored in `/etc/machine-id` for
-naming boot menu entries and the directories in the ESP to place kernel images
-in. This is done in order to allow multiple installations of the same OS on the
+naming boot menu entries and the directories in the ESP to place kernel images in.
+This is done in order to allow multiple installations of the same OS on the
same system without conflicts. However, this is problematic if the machine ID
shall be generated automatically on first boot: if the ID is not known before
the first boot it cannot be used to name the most basic resources required for
the boot process to complete.
Thus, for images that shall acquire their identity on first boot only, it is
-required to use a different identifier for naming boot menu entries. To allow
-this the `kernel-install` logic knows the generalized *entry* *token* concept,
+required to use a different identifier for naming boot menu entries.
+To allow this the `kernel-install` logic knows the generalized *entry* *token* concept,
which can be a freely chosen string to use for identifying the boot menu
-resources of the OS. If not configured explicitly it defaults to the machine
-ID. The file `/etc/kernel/entry-token` may be used to configure this string
-explicitly. Thus, golden image builders should write a suitable identifier into
+resources of the OS.
+If not configured explicitly it defaults to the machineID.
+The file `/etc/kernel/entry-token` may be used to configure this string explicitly.
+Thus, golden image builders should write a suitable identifier into
this file, for example, the `IMAGE_ID=` or `ID=` field from
[`/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html)
-(also see below). It is recommended to do this before the `kernel-install`
-functionality is invoked (i.e. before the package manager is used to install
+(also see below).
+It is recommended to do this before the `kernel-install` functionality is invoked (i.e. before the package manager is used to install
packages into the OS tree being prepared), so that the selected string is
automatically used for all entries to be generated.
@@ -94,16 +94,16 @@ automatically used for all entries to be generated.
`systemd` is designed to be able to come up safely and robustly if the `/var/`
file system or even the entire root file system (with exception of `/usr/`,
-i.e. the vendor OS resources) is empty (i.e. "unpopulated"). With this in mind
-it's relatively easy to build images that only ship a `/usr/` tree, and
+i.e. the vendor OS resources) is empty (i.e. "unpopulated").
+With this in mind it's relatively easy to build images that only ship a `/usr/` tree, and
otherwise carry no other data, populating the rest of the directory hierarchy
on first boot as needed.
Specifically, the following mechanisms are in place:
1. The `switch-root` logic in systemd, that is used to switch from the initrd
- phase to the host will create the basic OS hierarchy skeleton if missing. It
- will create a couple of directories strictly necessary to boot up
+ phase to the host will create the basic OS hierarchy skeleton if missing.
+ It will create a couple of directories strictly necessary to boot up
successfully, plus essential symlinks (such as those necessary for the
dynamic loader `ld.so` to function).
@@ -136,14 +136,18 @@ Specifically, the following mechanisms are in place:
remains resolvable, even without `/etc/hosts` around.
With these mechanisms the hierarchies below `/var/` and `/etc/` can be safely
-and robustly populated on first boot, so that the OS can safely boot up. Note
-that some auxiliary package are not prepared to operate correctly if their
+and robustly populated on first boot, so that the OS can safely boot up.
+Note that some auxiliary package are not prepared to operate correctly if their
configuration data in `/etc/` or their state directories in `/var/` are
-missing. This can typically be addressed via `systemd-tmpfiles` lines that
-ensure the missing files and directories are created if missing. In particular,
-configuration files that are necessary for operation can be automatically
+missing.
+
+This can typically be addressed via `systemd-tmpfiles` lines that
+ensure the missing files and directories are created if missing.
+In particular, configuration files that are necessary for operation can be automatically
copied or symlinked from the `/usr/share/factory/etc/` tree via the `C` or `L`
-line types. That said, we recommend that all packages safely fall back to
+line types.
+
+That said, we recommend that all packages safely fall back to
internal defaults if their configuration is missing, making such additional
steps unnecessary.
@@ -156,17 +160,17 @@ manual work might be required to make this scenario work.
Typically, if an image is `dd`-ed onto a target disk it will be minimal:
i.e. only consist of necessary vendor data, and lack "payload" data, that shall
-be individual to the system, and dependent on host parameters. On first boot,
-the OS should take possession of the backing storage as necessary, dynamically
+be individual to the system, and dependent on host parameters.
+On first boot, the OS should take possession of the backing storage as necessary, dynamically
using available space. Specifically:
1. Additional partitions should be created, that make no sense to ship
- pre-built in the image. For example, `/tmp/` or `/home/` partitions, or even
- `/var/` or the root file system (see above).
+ pre-built in the image.
+ For example, `/tmp/` or `/home/` partitions, or even `/var/` or the root file system (see above).
2. Additional partitions should be created that shall function as A/B
- secondaries for partitions shipped in the original image. In other words: if
- the `/usr/` file system shall be updated in an A/B fashion it typically
+ secondaries for partitions shipped in the original image.
+ In other words: if the `/usr/` file system shall be updated in an A/B fashion it typically
makes sense to ship the original A file system in the deployed image, but
create the B partition on first boot.
@@ -191,10 +195,10 @@ it, then format it.
1. The
[`systemd-repart(8)`](https://www.freedesktop.org/software/systemd/man/systemd-repart.service.html)
component may manipulate GPT partition tables automatically on boot, growing
- partitions or adding in partitions taking the backing storage size into
- account. It can also encrypt partitions automatically it creates (even bind
- to TPM2, automatically) and populate partitions from various sources. It
- does this all in a robust fashion so that aborted invocations will not leave
+ partitions or adding in partitions taking the backing storage size into account.
+ It can also encrypt partitions automatically it creates (even bind
+ to TPM2, automatically) and populate partitions from various sources.
+ It does this all in a robust fashion so that aborted invocations will not leave
incompletely set up partitions around.
2. The
@@ -215,8 +219,8 @@ it, then format it.
While a lot of work has gone into ensuring `systemd` systems can safely boot
with unpopulated `/etc/` trees, it sometimes is desirable to set a couple of
-basic settings *after* `dd`-ing the image to disk, but *before* first boot. For
-this the tool
+basic settings *after* `dd`-ing the image to disk, but *before* first boot.
+For this the tool
[`systemd-firstboot(1)`](https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html)
can be useful, with its `--image=` switch. It may be used to set very basic
settings, such as the root password or hostname on an OS disk image or
@@ -225,36 +229,33 @@ installed block device.
## Distinguishing First Boot
For various purposes it's useful to be able to distinguish the first boot-up of
-the system from later boot-ups (for example, to set up TPM hardware
-specifically, or register a system somewhere). `systemd` provides mechanisms to
-implement that. Specifically, the `ConditionFirstBoot=` and `AssertFirstBoot=`
-settings may be used to conditionalize units to only run on first boot. See
-[`systemd.unit(5)`](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#ConditionFirstBoot=)
+the system from later boot-ups (for example, to set up TPM hardware specifically, or register a system somewhere).
+`systemd` provides mechanisms to implement that.
+Specifically, the `ConditionFirstBoot=` and `AssertFirstBoot=` settings may be used to conditionalize units to only run on first boot.
+See [`systemd.unit(5)`](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#ConditionFirstBoot=)
for details.
A special target unit `first-boot-complete.target` may be used as milestone to
-safely handle first boots where the system is powered off too early: if the
-first boot process is aborted before this target is reached, the following boot
-process will be considered a first boot, too. Once the target is reached,
-subsequent boots will not be considered first boots anymore, even if the boot
-process is aborted immediately after. Thus, services that must complete fully
-before a system shall be considered fully past the first boot should be ordered
-before this target unit.
+safely handle first boots where the system is powered off too early:
+if the first boot process is aborted before this target is reached, the following boot
+process will be considered a first boot, too.
+Once the target is reached, subsequent boots will not be considered first boots anymore, even if the boot
+process is aborted immediately after.
+Thus, services that must complete fully before a system shall be considered fully past the first boot should be ordered before this target unit.
Whether a system will come up in first boot state or not is derived from the
-initialization status of `/etc/machine-id`: if the file already carries a valid
-ID the system is already past the first boot. If it is not initialized yet it
-is still considered in the first boot state. For details see
-[`machine-id(5)`](https://www.freedesktop.org/software/systemd/man/machine-id.html).
+initialization status of `/etc/machine-id`:
+if the file already carries a valid ID the system is already past the first boot.
+If it is not initialized yet it is still considered in the first boot state.
+For details see [`machine-id(5)`](https://www.freedesktop.org/software/systemd/man/machine-id.html).
## Image Metadata
Typically, when operating with golden disk images it is useful to be able to
-identify them and their version. For this the two fields `IMAGE_ID=` and
-`IMAGE_VERSION=` have been defined in
-[`os-release(5)`](https://www.freedesktop.org/software/systemd/man/os-release.html). These
-fields may be accessed from unit files and similar via the `%M` and `%A`
-specifiers.
+identify them and their version.
+For this the two fields `IMAGE_ID=` and `IMAGE_VERSION=` have been defined in
+[`os-release(5)`](https://www.freedesktop.org/software/systemd/man/os-release.html).
+These fields may be accessed from unit files and similar via the `%M` and `%A` specifiers.
Depending on how the images are put together it might make sense to leave the
OS distribution's `os-release` file as is in `/usr/lib/os-release` but to
diff --git a/docs/CATALOG.md b/docs/CATALOG.md
index bcbf5b9..f700ff0 100644
--- a/docs/CATALOG.md
+++ b/docs/CATALOG.md
@@ -7,7 +7,9 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Journal Message Catalogs
-Starting with 196 systemd includes a message catalog system which allows augmentation on display of journal log messages with short explanation texts, keyed off the MESSAGE\_ID= field of the entry. Many important log messages generated by systemd itself have message catalog entries. External packages can easily provide catalog data for their own messages.
+Starting with 196 systemd includes a message catalog system which allows augmentation on display of journal log messages with short explanation texts, keyed off the MESSAGE\_ID= field of the entry.
+Many important log messages generated by systemd itself have message catalog entries.
+External packages can easily provide catalog data for their own messages.
The message catalog has a number of purposes:
@@ -18,11 +20,15 @@ The message catalog has a number of purposes:
## Format
-Message catalog source files are simple text files that follow an RFC822 inspired format. To get an understanding of the format [here's an example file](http://cgit.freedesktop.org/systemd/systemd/plain/catalog/systemd.catalog), which includes entries for many important messages systemd itself generates. On installation of a package that includes message catalogs all installed message catalog source files get compiled into a binary index, which is then used to look up catalog data.
+Message catalog source files are simple text files that follow an RFC822 inspired format.
+To get an understanding of the format [here's an example file](http://cgit.freedesktop.org/systemd/systemd/plain/catalog/systemd.catalog), which includes entries for many important messages systemd itself generates.
+On installation of a package that includes message catalogs all installed message catalog source files get compiled into a binary index, which is then used to look up catalog data.
-journalctl's `-x` command line parameter may be used to augment on display journal log messages with message catalog data when browsing. `journalctl --list-catalog` may be used to print a list of all known catalog entries.
+journalctl's `-x` command line parameter may be used to augment on display journal log messages with message catalog data when browsing.
+`journalctl --list-catalog` may be used to print a list of all known catalog entries.
-To register additional catalog entries, packages may drop (text) catalog files into /usr/lib/systemd/catalog/ with a suffix of .catalog. The files are not accessed directly when needed, but need to be built into a binary index file with `journalctl --update-catalog`.
+To register additional catalog entries, packages may drop (text) catalog files into /usr/lib/systemd/catalog/ with a suffix of .catalog.
+The files are not accessed directly when needed, but need to be built into a binary index file with `journalctl --update-catalog`.
Here's an example how a single catalog entry looks like in the text source format. Multiple of these may be listed one after the other per catalog source file:
@@ -43,25 +49,50 @@ should be reported to its vendor as a bug.
The text format of the .catalog files is as follows:
-* Simple, UTF-8 text files, with usual line breaks at 76 chars. URLs and suchlike where line-breaks are undesirable may use longer lines. As catalog files need to be usable on text consoles it is essential that the 76 char line break rule is otherwise followed for human readable text.
+* Simple, UTF-8 text files, with usual line breaks at 76 chars.
+ URLs and suchlike where line-breaks are undesirable may use longer lines.
+ As catalog files need to be usable on text consoles it is essential that the 76 char line break rule is otherwise followed for human readable text.
* Lines starting with `#` are ignored, and may be used for comments.
-* The files consist of a series of entries. For each message ID (in combination with a locale) only a single entry may be defined. Every entry consists of:
- * A separator line beginning with `-- `, followed by a hexadecimal message ID formatted as lower case ASCII string. Optionally, the message ID may be suffixed by a space and a locale identifier, such as `de` or `fr\_FR`, if i10n is required.
- * A series of entry headers, in RFC822-style but not supporting continuation lines. Some header fields may appear more than once per entry. The following header fields are currently known (but additional fields may be added later):
+
+* The files consist of a series of entries.
+ For each message ID (in combination with a locale) only a single entry may be defined.
+ Every entry consists of:
+ * A separator line beginning with `-- `, followed by a hexadecimal message ID formatted as lower case ASCII string.
+ Optionally, the message ID may be suffixed by a space and a locale identifier, such as `de` or `fr\_FR`, if i10n is required.
+ * A series of entry headers, in RFC822-style but not supporting continuation lines.
+ Some header fields may appear more than once per entry.
+ The following header fields are currently known (but additional fields may be added later):
+
* Subject: A short, one-line human readable description of the message
- * Defined-By: Who defined this message. Usually a package name or suchlike
- * Support: A URI for getting further support. This can be a web URL or a telephone number in the tel:// namespace
+ * Defined-By: Who defined this message.
+
+ Usually a package name or suchlike
+ * Support: A URI for getting further support.
+ This can be a web URL or a telephone number in the tel:// namespace
* Documentation: URIs for further user, administrator or developer documentation on the log entry. URIs should be listed in order of relevance, the most relevant documentation first.
* An empty line
- * The actual catalog entry payload, as human readable prose. Multiple paragraphs may be separated by empty lines. The prose should first describe the message and when it occurs, possibly followed by recommendations how to deal with the message and (if it is an error message) correct the problem at hand. This message text should be readable by users and administrators. Information for developers should be stored externally instead, and referenced via a Documentation= header field.
-* When a catalog entry is printed on screen for a specific log entry simple variable replacements are applied. Journal field names enclosed in @ will be replaced by their values, if such a field is available in an entry. If such a field is not defined in an entry the enclosing @ will be dropped but the variable name is kept. See [systemd's own message catalog](http://cgit.freedesktop.org/systemd/systemd/plain/catalog/systemd.catalog) for a complete example for a catalog file.
+ * The actual catalog entry payload, as human readable prose.
+ Multiple paragraphs may be separated by empty lines.
+ The prose should first describe the message and when it occurs, possibly followed by recommendations how to deal with the message and (if it is an error message) correct the problem at hand.
+ This message text should be readable by users and administrators.
+ Information for developers should be stored externally instead, and referenced via a Documentation= header field.
+
+* When a catalog entry is printed on screen for a specific log entry simple variable replacements are applied.
+Journal field names enclosed in @ will be replaced by their values, if such a field is available in an entry.
+If such a field is not defined in an entry the enclosing @ will be dropped but the variable name is kept.
+See [systemd's own message catalog](http://cgit.freedesktop.org/systemd/systemd/plain/catalog/systemd.catalog) for a complete example for a catalog file.
## Adding Message Catalog Support to Your Program
-Note that the message catalog is only available for messages generated with the MESSAGE\_ID= journal meta data field, as this is need to find the right entry for a message. For more information on the MESSAGE\_ID= journal entry field see [systemd.journal-fields(7)](http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
+Note that the message catalog is only available for messages generated with the MESSAGE\_ID= journal meta data field, as this is need to find the right entry for a message.
+For more information on the MESSAGE\_ID= journal entry field see [systemd.journal-fields(7)](http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html).
To add message catalog entries for log messages your application generates, please follow the following guidelines:
-* Use the [native Journal logging APIs](http://0pointer.de/blog/projects/journal-submit.html) to generate your messages, and define message IDs for all messages you want to add catalog entries for. You may use `journalctl --new-id128` to allocate new message IDs.
-* Write a catalog entry file for your messages and ship them in your package and install them to `/usr/lib/systemd/catalog/` (if you package your software with RPM use `%_journalcatalogdir`)
-* Ensure that after installation of your application's RPM/DEB "`journalctl --update-catalog`" is executed, in order to update the binary catalog index. (if you package your software with RPM use the `%journal_catalog_update` macro to achieve that.)
+* Use the [native Journal logging APIs](http://0pointer.de/blog/projects/journal-submit.html)
+ to generate your messages, and define message IDs for all messages you want to add catalog entries for.
+ You may use `journalctl --new-id128` to allocate new message IDs.
+* Write a catalog entry file for your messages and ship them in your package and install them to `/usr/lib/systemd/catalog/`
+ (if you package your software with RPM use `%_journalcatalogdir`)
+* Ensure that after installation of your application's RPM/DEB "`journalctl --update-catalog`" is executed, in order to update the binary catalog index.
+ (if you package your software with RPM use the `%journal_catalog_update` macro to achieve that.)
diff --git a/docs/CGROUP_DELEGATION.md b/docs/CGROUP_DELEGATION.md
index 4210a75..9e2e76c 100644
--- a/docs/CGROUP_DELEGATION.md
+++ b/docs/CGROUP_DELEGATION.md
@@ -29,8 +29,8 @@ This document then adds in the higher-level view from systemd.
This document augments the existing documentation we already have:
-* [The New Control Group Interfaces](https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface)
-* [Writing VM and Container Managers](https://www.freedesktop.org/wiki/Software/systemd/writing-vm-managers)
+* [The New Control Group Interfaces](/CONTROL_GROUP_INTERFACE)
+* [Writing VM and Container Managers](/WRITING_VM_AND_CONTAINER_MANAGERS)
These wiki documents are not as up to date as they should be, currently, but
the basic concepts still fully apply. You should read them too, if you do something
diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md
index 8e5455d..08ccc30 100644
--- a/docs/CODE_OF_CONDUCT.md
+++ b/docs/CODE_OF_CONDUCT.md
@@ -7,7 +7,8 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# The systemd Community Conduct Guidelines
-This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to systemd. It applies to all “collaborative spaces”, which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.).
+This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to systemd.
+It applies to all “collaborative spaces”, which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.).
- Participants will be tolerant of opposing views.
- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
@@ -16,6 +17,9 @@ This document provides community guidelines for a safe, respectful, productive,
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at systemd-conduct@googlegroups.com. This team currently consists of David Strauss <<systemd-conduct@davidstrauss.net>>, Ekaterina Gerasimova (Kat) <<Kittykat3756@gmail.com>>, and Zbigniew Jędrzejewski-Szmek <<zbyszek@in.waw.pl>>. In the unfortunate event that you wish to make a complaint against one of the members, you may instead contact any of the other members individually.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at systemd-conduct@googlegroups.com.
+This team currently consists of David Strauss <<systemd-conduct@davidstrauss.net>>, Ekaterina Gerasimova (Kat) <<Kittykat3756@gmail.com>>, and Zbigniew Jędrzejewski-Szmek <<zbyszek@in.waw.pl>>.
+In the unfortunate event that you wish to make a complaint against one of the members, you may instead contact any of the other members individually.
-All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
+All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
+The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
diff --git a/docs/CODE_QUALITY.md b/docs/CODE_QUALITY.md
index 166b307..4caf38f 100644
--- a/docs/CODE_QUALITY.md
+++ b/docs/CODE_QUALITY.md
@@ -75,7 +75,7 @@ available functionality:
15. Each PR is automatically tested with [Address Sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html)
and [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html).
- See [Testing systemd using sanitizers](TESTING_WITH_SANITIZERS)
+ See [Testing systemd using sanitizers](/TESTING_WITH_SANITIZERS)
for more information.
16. Fossies provides [source code misspelling reports](https://fossies.org/features.html#codespell).
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index 6d6e549..b4e88c9 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -297,7 +297,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
t.bar = "bazz";
```
-- To implement an endless loop, use `for (;;)` rather than `while (1)`. The
+- To implement an endless loop, use `for (;;)` rather than `while (1)`. The
latter is a bit ugly anyway, since you probably really meant `while
(true)`. To avoid the discussion what the right always-true expression for an
infinite while loop is, our recommendation is to simply write it without any
diff --git a/docs/CONTAINER_INTERFACE.md b/docs/CONTAINER_INTERFACE.md
index 7fa8558..460cc67 100644
--- a/docs/CONTAINER_INTERFACE.md
+++ b/docs/CONTAINER_INTERFACE.md
@@ -7,8 +7,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# The Container Interface
-Also consult [Writing Virtual Machine or Container
-Managers](https://www.freedesktop.org/wiki/Software/systemd/writing-vm-managers).
+Also consult [Writing Virtual Machine or Container Managers](/WRITING_VM_AND_CONTAINER_MANAGERS).
systemd has a number of interfaces for interacting with container managers,
when systemd is used inside of an OS container. If you work on a container
@@ -121,7 +120,7 @@ manager, please consider supporting the following interfaces.
variable's name you may only specify ptys, and not other types of ttys. Also
you need to specify the pty itself, a symlink will not suffice. This is
implemented in
- [systemd-getty-generator(8)](https://www.freedesktop.org/software/systemd/man/systemd-getty-generator.html).
+ [systemd-getty-generator(8)](https://www.freedesktop.org/software/systemd/man/latest/systemd-getty-generator.html).
Note that this variable should not include the pty that `/dev/console` maps
to if it maps to one (see below). Example: if the container receives
`container_ttys=pts/7 pts/8 pts/14` it will spawn three additional login
@@ -131,7 +130,7 @@ manager, please consider supporting the following interfaces.
running the container manager, if this is considered desirable, please parse
the host's `/etc/os-release` and set a `$container_host_<key>=<VALUE>`
environment variable for the ID fields described by the [os-release
- interface](https://www.freedesktop.org/software/systemd/man/os-release.html), eg:
+ interface](https://www.freedesktop.org/software/systemd/man/latest/os-release.html), eg:
`$container_host_id=debian`
`$container_host_build_id=2020-06-15`
`$container_host_variant_id=server`
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index f599972..c247102 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -11,9 +11,13 @@ We welcome contributions from everyone. However, please follow the following gui
## Filing Issues
-* We use [GitHub Issues](https://github.com/systemd/systemd/issues) **exclusively** for tracking **bugs** and **feature** **requests** (RFEs) of systemd. If you are looking for help, please try the forums of your distribution first, or [systemd-devel mailing list](https://lists.freedesktop.org/mailman/listinfo/systemd-devel) for general questions about systemd.
-* We only track bugs in the **two** **most** **recently** **released** (non-rc) **versions** of systemd in the GitHub Issue tracker. If you are using an older version of systemd, please contact your distribution's bug tracker instead (see below). See [GitHub Release Page](https://github.com/systemd/systemd/releases) for the list of most recent releases.
-* When filing a feature request issue (RFE), please always check first if the newest upstream version of systemd already implements the feature, and whether there's already an issue filed for your feature by someone else.
+* We use [GitHub Issues](https://github.com/systemd/systemd/issues) **exclusively** for tracking **bugs** and **feature** **requests** (RFEs) of systemd.
+ If you are looking for help, please try the forums of your distribution first, or [systemd-devel mailing list](https://lists.freedesktop.org/mailman/listinfo/systemd-devel) for general questions about systemd.
+* We only track bugs in the **two** **most** **recently** **released** (non-rc) **versions** of systemd in the GitHub Issue tracker.
+ If you are using an older version of systemd, please contact your distribution's bug tracker instead (see below).
+ See [GitHub Release Page](https://github.com/systemd/systemd/releases) for the list of most recent releases.
+* When filing a feature request issue (RFE), please always check first if the newest upstream version of systemd already implements the feature,
+ and whether there's already an issue filed for your feature by someone else.
* When filing an issue, specify the **systemd** **version** you are experiencing the issue with. Also, indicate which **distribution** you are using.
* Please include an explanation how to reproduce the issue you are pointing out.
@@ -29,21 +33,23 @@ For older versions that are still supported by your distribution please use resp
## Security vulnerability reports
-See [reporting of security vulnerabilities](SECURITY).
+See [reporting of security vulnerabilities](/SECURITY).
## Posting Pull Requests
* Make sure to post PRs only relative to a recent tip of the `main` branch.
-* Follow our [Coding Style](CODING_STYLE) when contributing code. This is a requirement for all code we merge.
-* Please make sure to test your change before submitting the PR. See the [Hacking guide](HACKING) for details on how to do this.
+* Follow our [Coding Style](/CODING_STYLE) when contributing code. This is a requirement for all code we merge.
+* Please make sure to test your change before submitting the PR. See the [Hacking guide](/HACKING) for details on how to do this.
* Make sure to run the test suite locally, before posting your PR. We use a CI system, meaning we don't even look at your PR if the build and tests don't pass.
* If you need to update the code in an existing PR, force-push into the same branch, overriding old commits with new versions.
-* After you have pushed a new version, add a comment explaining the latest changes. If you are a member of the systemd project on GitHub, remove the `reviewed/needs-rework`/`ci-fails/needs-rework`/`needs-rebase` labels.
-* If you are copying existing code from another source (eg: a compat header), please make sure the license is compatible with `LGPL-2.1-or-later`. If the license is not `LGPL-2.1-or-later`, please add a note to [`LICENSES/README.md`](https://github.com/systemd/systemd/blob/main/LICENSES/README.md).
-* If the pull request stalls without review, post a ping in a comment after some time has passed. We are always short on reviewer time, and pull requests which haven't seen any recent activity can be easily forgotten.
-* Github will automatically add the `please-review` label when a pull request is opened or updated. If you need
-more information after a review, you can comment `/please-review` on the pull request to have Github add the
-`please-review` label to the pull request.
+* After you have pushed a new version, add a comment explaining the latest changes.
+ If you are a member of the systemd project on GitHub, remove the `reviewed/needs-rework`/`ci-fails/needs-rework`/`needs-rebase` labels.
+* If you are copying existing code from another source (eg: a compat header), please make sure the license is compatible with `LGPL-2.1-or-later`.
+ If the license is not `LGPL-2.1-or-later`, please add a note to [`LICENSES/README.md`](https://github.com/systemd/systemd/blob/main/LICENSES/README.md).
+* If the pull request stalls without review, post a ping in a comment after some time has passed.
+ We are always short on reviewer time, and pull requests which haven't seen any recent activity can be easily forgotten.
+* Github will automatically add the `please-review` label when a pull request is opened or updated.
+ If you need more information after a review, you can comment `/please-review` on the pull request to have Github add the `please-review` label to the pull request.
## Reviewing Pull Requests
@@ -69,9 +75,9 @@ Thank you very much for your contributions!
# Backward Compatibility And External Dependencies
-We strive to keep backward compatibility where possible and reasonable. The following are general guidelines, not hard
-rules, and case-by-case exceptions might be applied at the discretion of the maintainers. The current set of build-time
-and runtime dependencies are documented in the [README](https://github.com/systemd/systemd/blob/main/README).
+We strive to keep backward compatibility where possible and reasonable.
+The following are general guidelines, not hard rules, and case-by-case exceptions might be applied at the discretion of the maintainers.
+The current set of build-time and runtime dependencies are documented in the [README](https://github.com/systemd/systemd/blob/main/README).
## New features
@@ -102,9 +108,9 @@ for existing functionality.
## `libsystemd.so`
-`libsystemd.so` is a shared public library, so breaking ABI/API compatibility would create lot of work for everyone, and is not allowed. Instead, always add a new interface instead of modifying
-the signature of an existing function. It is fine to mark an interface as deprecated to gently nudge users toward a newer one,
-but support for the old one must be maintained.
+`libsystemd.so` is a shared public library, so breaking ABI/API compatibility would create lot of work for everyone, and is not allowed.
+Instead, always add a new interface instead of modifying the signature of an existing function.
+It is fine to mark an interface as deprecated to gently nudge users toward a newer one, but support for the old one must be maintained.
Symbol versioning and the compiler's deprecated attribute should be used when managing the lifetime of a public interface.
## `libudev.so`
diff --git a/docs/CONTROL_GROUP_INTERFACE.md b/docs/CONTROL_GROUP_INTERFACE.md
index 11dc6a3..c82a2c3 100644
--- a/docs/CONTROL_GROUP_INTERFACE.md
+++ b/docs/CONTROL_GROUP_INTERFACE.md
@@ -9,14 +9,24 @@ SPDX-License-Identifier: LGPL-2.1-or-later
> _aka "I want to make use of kernel cgroups, how do I do this in the new world order?"_
-Starting with version 205 systemd provides a number of interfaces that may be used to create and manage labelled groups of processes for the purpose of monitoring and controlling them and their resource usage. This is built on top of the Linux kernel Control Groups ("cgroups") facility. Previously, the kernel's cgroups API was exposed directly as shared application API, following the rules of the [Pax Control Groups](http://www.freedesktop.org/wiki/Software/systemd/PaxControlGroups/) document. However, the kernel cgroup interface has been reworked into an API that requires that each individual cgroup is managed by a single writer only. With this change the main cgroup tree becomes private property of that userspace component and is no longer a shared resource. On systemd systems PID 1 takes this role and hence needs to provide APIs for clients to take benefit of the control groups functionality of the kernel. Note that services running on systemd systems may manage their own subtrees of the cgroups tree, as long as they explicitly turn on delegation mode for them (see below).
+Starting with version 205 systemd provides a number of interfaces that may be used to create and manage labelled groups of processes for the purpose of monitoring and controlling them and their resource usage.
+This is built on top of the Linux kernel Control Groups ("cgroups") facility.
+
+Previously, the kernel's cgroups API was exposed directly as shared application API, following the rules of the [Pax Control Groups](/PAX_CONTROL_GROUPS) document.
+However, the kernel cgroup interface has been reworked into an API that requires that each individual cgroup is managed by a single writer only.
+
+With this change the main cgroup tree becomes private property of that userspace component and is no longer a shared resource.
+
+On systemd systems PID 1 takes this role and hence needs to provide APIs for clients to take benefit of the control groups functionality of the kernel.
+
+Note that services running on systemd systems may manage their own subtrees of the cgroups tree, as long as they explicitly turn on delegation mode for them (see below).
That means explicitly, that:
1. The root control group may only be written to by systemd (PID 1). Services that create and manipulate control groups in the top level cgroup are in direct conflict with the kernel's requirement that each control group should have a single-writer only.
2. Services must set Delegate=yes for the units they intend to manage subcgroups of. If they create and manipulate cgroups outside of units that have Delegate=yes set, they violate the access contract for control groups.
-For a more high-level background story, please have a look at this [Linux Foundation News Story](http://www.linuxfoundation.org/news-media/blogs/browse/2013/08/all-about-linux-kernel-cgroup%E2%80%99s-redesign).
+For a more high-level background story, please have a look at this [Linux Foundation News Story](https://www.linuxfoundation.jp/blog/2013/08/all-about-the-linux-kernel-cgroups-redesign/).
### Why this all again?
@@ -46,7 +56,7 @@ On systemd systems use the systemd APIs as described below. At this time we are
### What's the timeframe of this? Do I need to care now?
-In the short-term future writing directly to the control group tree from applications should still be OK, as long as the [Pax Control Groups](http://www.freedesktop.org/wiki/Software/systemd/PaxControlGroups/) document is followed. In the medium-term future it will still be supported to alter/read individual attributes of cgroups directly, but no longer to create/delete cgroups without using the systemd API. In the longer-term future altering/reading attributes will also be unavailable to userspace applications, unless done via systemd's APIs (either D-Bus based IPC APIs or shared library APIs for _passive_ operations).
+In the short-term future writing directly to the control group tree from applications should still be OK, as long as the [Pax Control Groups](/PAX_CONTROL_GROUPS) document is followed. In the medium-term future it will still be supported to alter/read individual attributes of cgroups directly, but no longer to create/delete cgroups without using the systemd API. In the longer-term future altering/reading attributes will also be unavailable to userspace applications, unless done via systemd's APIs (either D-Bus based IPC APIs or shared library APIs for _passive_ operations).
It is recommended to use the new systemd APIs described below in any case. Note that the kernel cgroup interface is currently being reworked (available when the "sane_behaviour" kernel option is used). This will change the cgroupfs interface. By using systemd's APIs this change is abstracted away and invisible to applications.
@@ -193,7 +203,7 @@ Most relevant APIs are exposed via D-Bus, however some _passive_ interfaces are
### Creating and Starting
-To create and start a transient (scope, service or slice) unit in the cgroup tree use the `StartTransientUnit()` method on the `Manager` object exposed by systemd's PID 1 on the bus, see the [Bus API Documentation](http://www.freedesktop.org/wiki/Software/systemd/dbus/) for details. This call takes four arguments. The first argument is the full unit name you want this unit to be known under. This unit name is the handle to the unit, and is shown in the "systemctl" output and elsewhere. This name must be unique during runtime of the unit. You should generate a descriptive name for this that is useful for the administrator to make sense of it. The second parameter is the mode, and should usually be `replace` or `fail`. The third parameter contains an array of initial properties to set for the unit. It is an array of pairs of property names as string and values as variant. Note that this is an array and not a dictionary! This is that way in order to match the properties array of the `SetProperties()` call (see below). The fourth parameter is currently not used and should be passed as empty array. This call will first create the transient unit and then immediately queue a start job for it. This call returns an object path to a `Job` object for the start job of this unit.
+To create and start a transient (scope, service or slice) unit in the cgroup tree use the `StartTransientUnit()` method on the `Manager` object exposed by systemd's PID 1 on the bus, see the [Bus API Documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html) for details. This call takes four arguments. The first argument is the full unit name you want this unit to be known under. This unit name is the handle to the unit, and is shown in the "systemctl" output and elsewhere. This name must be unique during runtime of the unit. You should generate a descriptive name for this that is useful for the administrator to make sense of it. The second parameter is the mode, and should usually be `replace` or `fail`. The third parameter contains an array of initial properties to set for the unit. It is an array of pairs of property names as string and values as variant. Note that this is an array and not a dictionary! This is that way in order to match the properties array of the `SetProperties()` call (see below). The fourth parameter is currently not used and should be passed as empty array. This call will first create the transient unit and then immediately queue a start job for it. This call returns an object path to a `Job` object for the start job of this unit.
### Properties
@@ -209,7 +219,7 @@ To acquire a list of currently running units, use the `ListUnits()` call on the
### VM and Container Managers
-Use these APIs to register any kind of process workload with systemd to be placed in a resource controlled cgroup. Note however that for containers and virtual machines it is better to use the [`machined`](http://www.freedesktop.org/wiki/Software/systemd/machined/) interfaces since they provide integration with "ps" and similar tools beyond what mere cgroup registration provides. Also see [Writing VM and Container Managers](http://www.freedesktop.org/wiki/Software/systemd/writing-vm-managers/) for details.
+Use these APIs to register any kind of process workload with systemd to be placed in a resource controlled cgroup. Note however that for containers and virtual machines it is better to use the [`machined`](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.machine1.html) interfaces since they provide integration with "ps" and similar tools beyond what mere cgroup registration provides. Also see [Writing VM and Container Managers](/WRITING_VM_AND_CONTAINER_MANAGERS) for details.
### Reading Accounting Information
diff --git a/docs/CONVERTING_TO_HOMED.md b/docs/CONVERTING_TO_HOMED.md
index 5416a22..a31ff5a 100644
--- a/docs/CONVERTING_TO_HOMED.md
+++ b/docs/CONVERTING_TO_HOMED.md
@@ -8,35 +8,36 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Converting Existing Users to systemd-homed managed Users
Traditionally on most Linux distributions, regular (human) users are managed
-via entries in `/etc/passwd`, `/etc/shadow`, `/etc/group` and
-`/etc/gshadow`. With the advent of
+via entries in `/etc/passwd`, `/etc/shadow`, `/etc/group` and `/etc/gshadow`.
+With the advent of
[`systemd-homed`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html)
it might be desirable to convert an existing, traditional user account to a
-`systemd-homed` managed one. Below is a brief guide how to do that.
+`systemd-homed` managed one.
+Below is a brief guide how to do that.
Before continuing, please read up on these basic concepts:
-* [Home Directories](HOME_DIRECTORY)
-* [JSON User Records](USER_RECORD)
-* [JSON Group Records](GROUP_RECORD)
-* [User/Group Record Lookup API via Varlink](USER_GROUP_API)
+* [Home Directories](/HOME_DIRECTORY)
+* [JSON User Records](/USER_RECORD)
+* [JSON Group Records](/GROUP_RECORD)
+* [User/Group Record Lookup API via Varlink](/USER_GROUP_API)
## Caveat
-This is a manual process, and possibly a bit fragile. Hence, do this at your
-own risk, read up beforehand, and make a backup first. You know what's at
-stake: your own home directory, i.e. all your personal data.
+This is a manual process, and possibly a bit fragile.
+Hence, do this at your own risk, read up beforehand, and make a backup first.
+You know what's at stake: your own home directory, i.e. all your personal data.
## Step-By-Step
Here's the step-by-step guide:
0. Preparations: make sure you run a distribution that has `systemd-homed`
- enabled and properly set up, including the necessary PAM and NSS
- configuration updates. Make sure you have enough disk space in `/home/` for
- a (temporary) second copy of your home directory. Make sure to backup your
- home directory. Make sure to log out of your user account fully. Then log in
- as root on the console.
+ enabled and properly set up, including the necessary PAM and NSS configuration updates.
+ Make sure you have enough disk space in `/home/` for a (temporary) second copy of your home directory.
+ Make sure to backup your home directory.
+ Make sure to log out of your user account fully.
+ Then log in as root on the console.
1. Rename your existing home directory to something safe. Let's say your user
ID is `foobar`. Then do:
@@ -45,92 +46,86 @@ Here's the step-by-step guide:
mv /home/foobar /home/foobar.saved
```
-2. Have a look at your existing user record, as stored in `/etc/passwd` and
- related files. We want to use the same data for the new record, hence it's good
- looking at the old data. Use commands such as:
+2. Have a look at your existing user record, as stored in `/etc/passwd` and related files.
+ We want to use the same data for the new record, hence it's good looking at the old data.
+
+ Use commands such as:
```
getent passwd foobar
getent shadow foobar
```
- This will tell you the `/etc/passwd` and `/etc/shadow` entries for your
- user. For details about the fields, see the respective man pages
+ This will tell you the `/etc/passwd` and `/etc/shadow` entries for your user.
+ For details about the fields, see the respective man pages
[passwd(5)](https://man7.org/linux/man-pages/man5/passwd.5.html) and
[shadow(5)](https://man7.org/linux/man-pages/man5/shadow.5.html).
- The fourth field in the `getent passwd foobar` output tells you the GID of
- your user's main group. Depending on your distribution it's a group private
- to the user, or a group shared by most local, regular users. Let's say the
- GID reported is 1000, let's then query its details:
+ The fourth field in the `getent passwd foobar` output tells you the GID of your user's main group.
+ Depending on your distribution it's a group private to the user, or a group shared by most local, regular users.
+ Let's say the GID reported is 1000, let's then query its details:
```
getent group 1000
```
- This will tell you the name of that group. If the name is the same as your
- user name your distribution apparently provided you with a private group for
- your user. If it doesn't match (and is something like `users`) it apparently
- didn't. Note that `systemd-homed` will always manage a private group for
- each user under the same name, hence if your distribution is one of the
- latter kind, then there's a (minor) mismatch in structure when converting.
+ This will tell you the name of that group.
+ If the name is the same as your user name your distribution apparently provided you with a private group for your user.
+ If it doesn't match (and is something like `users`) it apparently didn't.
+ Note that `systemd-homed` will always manage a private group for each user under the same name,
+ hence if your distribution is one of the latter kind, then there's a (minor) mismatch in structure when converting.
- Save the information reported by these three commands somewhere, for later
- reference.
+ Save the information reported by these three commands somewhere, for later reference.
3. Now edit your `/etc/passwd` file and remove your existing record
- (i.e. delete a single line, the one of your user's account, leaving all
- other lines unmodified). Similar for `/etc/shadow`, `/etc/group` (in case
- you have a private group for your user) and `/etc/gshadow`. Most
- distributions provide you with a tool for that, that adds safe
+ (i.e. delete a single line, the one of your user's account, leaving all other lines unmodified).
+ Similar for `/etc/shadow`, `/etc/group` (in case you have a private group for your user) and `/etc/gshadow`.
+ Most distributions provide you with a tool for that, that adds safe
synchronization for these changes: `vipw`, `vipw -s`, `vigr` and `vigr -s`.
4. At this point the old user account vanished, while the home directory still
- exists safely under the `/home/foobar.saved` name. Let's now create a new
- account with `systemd-homed`, using the same username and UID as before:
+ exists safely under the `/home/foobar.saved` name.
+ Let's now create a new account with `systemd-homed`, using the same username and UID as before:
- ```
- homectl create foobar --uid=$UID --real-name=$GECOS
- ```
+ ```sh
+ homectl create foobar --uid=$UID --real-name=$GECOS
+ ```
In this command line, replace `$UID` by the UID you previously used,
- i.e. the third field of the `getent passwd foobar` output above. Similar,
- replace `$GECOS` by the GECOS field of your old account, i.e the fifth field
- of the old output. If your distribution traditionally does not assign a
- private group to regular user groups, then consider adding `--member-of=`
- with the group name to get a modicum of compatibility with the status quo
- ante: this way your new user account will still not have the old primary
+ i.e. the third field of the `getent passwd foobar` output above.
+ Similar, replace `$GECOS` by the GECOS field of your old account, i.e the fifth field of the old output.
+ If your distribution traditionally does not assign a private group to regular user groups,
+ then consider adding `--member-of=` with the group name to get a modicum of compatibility with the status quo ante:
+ this way your new user account will still not have the old primary
group as new primary group, but will have it as auxiliary group.
Consider reading through the
[homectl(1)](https://www.freedesktop.org/software/systemd/man/homectl.html)
- manual page at this point, maybe there are a couple of other settings you
- want to set for your new account. In particular, look at `--storage=` and
- `--disk-size=`, in order to change how your home directory shall be stored
+ manual page at this point, maybe there are a couple of other settings you want to set for your new account.
+ In particular, look at `--storage=` and `--disk-size=`, in order to change how your home directory shall be stored
(the default `luks` storage is recommended).
-5. Your new user account exists now, but it has an empty home directory. Let's
- now migrate your old home directory into it. For that let's mount the new
- home directory temporarily and copy the data in.
+1. Your new user account exists now, but it has an empty home directory.
+ Let's now migrate your old home directory into it.
+ For that let's mount the new home directory temporarily and copy the data in.
```
homectl with foobar -- rsync -aHANUXv --remove-source-files /home/foobar.saved/ .
```
This mounts the home directory of the user, and then runs the specified
- `rsync` command which copies the contents of the old home directory into the
- new. The new home directory is the working directory of the invoked `rsync`
- process. We are invoking this command as root, hence the `rsync` runs as
- root too. When the `rsync` command completes the home directory is
- automatically unmounted again. Since we used `--remove-source-files` all files
- copied are removed from the old home directory as the copy progresses. After
- the command completes the old home directory should be empty. Let's remove
- it hence:
+ `rsync` command which copies the contents of the old home directory into the new.
+ The new home directory is the working directory of the invoked `rsync` process.
+ We are invoking this command as root, hence the `rsync` runs as root too.
+ When the `rsync` command completes the home directory is automatically unmounted again.
+ Since we used `--remove-source-files` all files copied are removed from the old home directory as the copy progresses.
+ After the command completes the old home directory should be empty.
+ Let's remove it hence:
```
rmdir /home/foobar.saved
```
-And that's it, we are done already. You can log out now and should be able to
-log in under your user account as usual, but now with `systemd-homed` managing
-your home directory.
+And that's it, we are done already.
+You can log out now and should be able to log in under your user account as usual,
+but now with `systemd-homed` managing your home directory.
diff --git a/docs/COREDUMP.md b/docs/COREDUMP.md
index c64579e..d235479 100644
--- a/docs/COREDUMP.md
+++ b/docs/COREDUMP.md
@@ -10,36 +10,35 @@ SPDX-License-Identifier: LGPL-2.1-or-later
## Support in the Service Manager (PID 1)
The systemd service manager natively provides coredump handling functionality,
-as implemented by the Linux kernel. Specifically, PID 1 provides the following
-functionality:
+as implemented by the Linux kernel.
+Specifically, PID 1 provides the following functionality:
1. During very early boot it will raise the
[`LIMIT_CORE`](https://man7.org/linux/man-pages/man2/getrlimit.2.html)
- resource limit for itself to infinity (and thus implicitly also all its
- children). This removes any limits on the size of generated coredumps, for
- all invoked processes, from earliest boot on. (The Linux kernel sets the
- limit to 0 by default.)
+ resource limit for itself to infinity (and thus implicitly also all its children).
+ This removes any limits on the size of generated coredumps,
+ for all invoked processes, from earliest boot on.
+ (The Linux kernel sets the limit to 0 by default.)
2. At the same time it will turn off coredump handling in the kernel by writing
`|/bin/false` into `/proc/sys/kernel/core_pattern` (also known as the
"`kernel.core_pattern` sysctl"; see
[core(5)](https://man7.org/linux/man-pages/man5/core.5.html) for
- details). This means that coredumps are not actually processed. (The Linux
- kernel sets the pattern to `core` by default, so that coredumps are written
+ details).
+ This means that coredumps are not actually processed.
+ (The Linux kernel sets the pattern to `core` by default, so that coredumps are written
to the current working directory of the crashing process.)
Net effect: after PID1 has started and performed this setup coredumps are
disabled, but by means of the the `kernel.core_pattern` sysctl rather than by
-size limit. This is generally preferable, since the pattern can be updated
-trivially at the right time to enable coredumping once the system is ready,
-taking comprehensive effect on all userspace. (Or to say this differently:
-disabling coredumps via the size limit is problematic, since it cannot easily
-be undone without iterating through all already running processes once the
-system is ready for coredump handling.)
+size limit.
+This is generally preferable, since the pattern can be updated trivially at the right time to enable coredumping once the system is ready, taking comprehensive effect on all userspace.
+(Or to say this differently: disabling coredumps via the size limit is problematic, since it cannot easily
+be undone without iterating through all already running processes once the system is ready for coredump handling.)
Processing of core dumps may be enabled at the appropriate time by updating the
-`kernel.core_pattern` sysctl. Only coredumps that happen later will be
-processed.
+`kernel.core_pattern` sysctl.
+Only coredumps that happen later will be processed.
During the final shutdown phase the `kernel.core_pattern` sysctl is updated
again to `|/bin/false`, disabling coredump support again, should it have been
@@ -68,44 +67,46 @@ means the coredump handler runs for a very short time only, and the potentially
specified service unit, and thus can take benefit of regular service resource
management and sandboxing.
-The `systemd-coredump` handler will extract a backtrace and [ELF packaging
-metadata](https://systemd.io/ELF_PACKAGE_METADATA) from any coredumps it
-receives and log both. The information about coredumps stored in the journal
-can be enumerated and queried with the
+The `systemd-coredump` handler will extract a backtrace and
+[ELF packaging metadata](/ELF_PACKAGE_METADATA) from any coredumps it
+receives and log both.
+The information about coredumps stored in the journal can be enumerated and queried with the
[`coredumpctl`](https://www.freedesktop.org/software/systemd/man/coredumpctl.html)
tool, for example for directly invoking a debugger such as `gdb` on a collected
coredump.
-The handler writes coredump files to `/var/lib/systemd/coredump/`. Old files
-are cleaned up periodically by
+The handler writes coredump files to `/var/lib/systemd/coredump/`.
+Old files are cleaned up periodically by
[`systemd-tmpfiles(8)`](https://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html).
## User Experience
With the above, any coredumps generated on the system are by default collected
and turned into logged events — except during very early boot and late
-shutdown. Individual services, processes or users can opt-out of coredump
-collection, by setting `LIMIT_CORE` to 0 (or alternatively invoke
-[`PR_SET_DUMPABLE`](https://man7.org/linux/man-pages/man2/prctl.2.html)). The
-resource limit can be set freely by daemons/processes/users to arbitrary
-values, which the coredump handler will respect. The `coredumpctl` tool may be
-used to further analyze/debug coredumps.
+shutdown.
+Individual services, processes or users can opt-out of coredump collection,
+by setting `LIMIT_CORE` to 0 (or alternatively invoke
+[`PR_SET_DUMPABLE`](https://man7.org/linux/man-pages/man2/prctl.2.html)).
+The resource limit can be set freely by daemons/processes/users to arbitrary
+values, which the coredump handler will respect.
+The `coredumpctl` tool may be used to further analyze/debug coredumps.
## Alternative Coredump Handlers
While we recommend usage of the `systemd-coredump` handler, it's fully
-supported to use alternative coredump handlers instead. A similar
-implementation pattern is recommended. Specifically:
+supported to use alternative coredump handlers instead.
+A similar implementation pattern is recommended.
+Specifically:
-1. Use a `sysctl.d/` drop-in to register your handler with the kernel. Make
- sure to include the `%c` specifier in the pattern (which reflects the
- crashing process' `RLIMIT_CORE`) and act on it: limit the stored coredump
- file to the specified limit.
+1. Use a `sysctl.d/` drop-in to register your handler with the kernel.
+ Make sure to include the `%c` specifier in the pattern (which reflects the
+ crashing process' `RLIMIT_CORE`) and act on it:
+ limit the stored coredump file to the specified limit.
-2. Do not do heavy processing directly in the coredump handler. Instead,
- quickly pass off the kernel's coredump file descriptor to an
- auxiliary service running as service under the service manager, so that it
- can be done under supervision, sandboxing and resource management.
+2. Do not do heavy processing directly in the coredump handler.
+ Instead, quickly pass off the kernel's coredump file descriptor to an
+ auxiliary service running as service under the service manager,
+ so that it can be done under supervision, sandboxing and resource management.
Note that at any given time only a single handler can be enabled, i.e. the
`kernel.core_pattern` sysctl cannot reference multiple executables.
@@ -113,7 +114,8 @@ Note that at any given time only a single handler can be enabled, i.e. the
## Packaging
It might make sense to split `systemd-coredump` into a separate distribution
-package. If doing so, make sure that `/usr/lib/sysctl.d/50-coredump.conf` and
+package.
+If doing so, make sure that `/usr/lib/sysctl.d/50-coredump.conf` and
the associated service and socket units are also added to the split off package.
Note that in a scenario where `systemd-coredump` is split out and not
@@ -125,8 +127,8 @@ to legacy style handling (see below).
The default policy of the kernel to write coredumps into the current working
directory of the crashing process is considered highly problematic by many,
-including by the systemd maintainers. Nonetheless, if users locally want to
-return to this behaviour, two changes must be made (followed by a reboot):
+including by the systemd maintainers.
+Nonetheless, if users locally want to return to this behaviour, two changes must be made (followed by a reboot):
```console
$ mkdir -p /etc/sysctl.d
diff --git a/docs/CREDENTIALS.md b/docs/CREDENTIALS.md
index ed30eac..efa948b 100644
--- a/docs/CREDENTIALS.md
+++ b/docs/CREDENTIALS.md
@@ -59,7 +59,7 @@ purpose. Specifically, the following features are provided:
8. Credentials are an effective way to pass parameters into services that run
with `RootImage=` or `RootDirectory=` and thus cannot read these resources
directly from the host directory tree.
- Specifically, [Portable Services](PORTABLE_SERVICES) may be
+ Specifically, [Portable Services](/PORTABLE_SERVICES) may be
parameterized this way securely and robustly.
9. Credentials can be binary and relatively large (though currently an overall
@@ -288,7 +288,7 @@ services where they are ultimately consumed.
invokes. [`systemd-nspawn(1)`](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#Credentials)'s
`--set-credential=` and `--load-credential=` switches implement this, in
order to pass arbitrary credentials from host to container payload. Also see
- the [Container Interface](CONTAINER_INTERFACE) documentation.
+ the [Container Interface](/CONTAINER_INTERFACE) documentation.
2. Quite similar, VMs can be passed credentials via SMBIOS OEM strings (example
qemu command line switch `-smbios
diff --git a/docs/DAEMON_SOCKET_ACTIVATION.md b/docs/DAEMON_SOCKET_ACTIVATION.md
index 1a027a3..70a3299 100644
--- a/docs/DAEMON_SOCKET_ACTIVATION.md
+++ b/docs/DAEMON_SOCKET_ACTIVATION.md
@@ -7,7 +7,8 @@ SPDX-License-Identifier: LGPL-2.1-or-later
## nginx
-nginx includes an undocumented, internal socket-passing mechanism based on the `NGINX` environmental variable. It uses this to perform reloads without having to close and reopen its sockets, but it's also useful for socket activation.
+nginx includes an undocumented, internal socket-passing mechanism based on the `NGINX` environmental variable.
+It uses this to perform reloads without having to close and reopen its sockets, but it's also useful for socket activation.
**/etc/nginx/my-nginx.conf**
@@ -31,27 +32,29 @@ ExecStart=/usr/sbin/nginx -c/etc/nginx/my-nginx.conf
PrivateNetwork=true
```
-
**/etc/systemd/system/my-nginx.socket**
```
+[Unit]
+After=network.target
+Requires=network.target
+
[Socket]
ListenStream=80
ListenStream=0.0.0.0:80
BindIPv6Only=ipv6-only
-After=network.target
-Requires=network.target
[Install]
WantedBy=sockets.target
```
-
## PHP-FPM
-Like nginx, PHP-FPM includes a socket-passing mechanism an environmental variable. In PHP-FPM's case, it's `FPM_SOCKETS`.
+Like nginx, PHP-FPM includes a socket-passing mechanism an environmental variable.
+In PHP-FPM's case, it's `FPM_SOCKETS`.
-This configuration is possible with any web server that supports FastCGI (like Apache, Lighttpd, or nginx). The web server does not need to know anything special about the socket; use a normal PHP-FPM configuration.
+This configuration is possible with any web server that supports FastCGI (like Apache, Lighttpd, or nginx).
+The web server does not need to know anything special about the socket; use a normal PHP-FPM configuration.
Paths are based on a Fedora 19 system.
@@ -74,7 +77,6 @@ pm.max_children = 10
slowlog = syslog
```
-
**/etc/systemd/system/my-php-fpm-pool.service**
```
@@ -86,7 +88,6 @@ ExecStart=/usr/sbin/php-fpm --fpm-config=/etc/php-fpm.d/my-php-fpm-pool.conf
KillMode=process
```
-
**/etc/systemd/system/my-php-fpm-pool.socket**
```
@@ -97,7 +98,6 @@ ListenStream=/var/run/my-php-fpm-pool.socket
WantedBy=sockets.target
```
-
### Second, the setup commands
```sh
@@ -106,15 +106,14 @@ sudo systemctl start my-php-fpm-pool.socket
sudo systemctl enable my-php-fpm-pool.socket
```
-
After accessing the web server, the service should be running.
```sh
sudo systemctl status my-php-fpm-pool.service
```
-
-It's possible to shut down the service and re-activate it using the web browser, too. It's necessary to stop and start the socket to reset some shutdown PHP-FPM does that otherwise breaks reactivation.
+It's possible to shut down the service and re-activate it using the web browser, too.
+It's necessary to stop and start the socket to reset some shutdown PHP-FPM does that otherwise breaks reactivation.
```sh
sudo systemctl stop my-php-fpm-pool.socket my-php-fpm-pool.service
diff --git a/docs/DEBUGGING.md b/docs/DEBUGGING.md
index dc1c874..3e89a5d 100644
--- a/docs/DEBUGGING.md
+++ b/docs/DEBUGGING.md
@@ -9,36 +9,48 @@ SPDX-License-Identifier: LGPL-2.1-or-later
If your machine gets stuck during boot, first check if the hang happens before or after control passes to systemd.
-Try to boot without `rhgb` and `quiet` on the kernel command line. If you see some messages like these:
+Try to boot without `rhgb` and `quiet` on the kernel command line.
+If you see some messages like these:
* Welcome to Fedora _VERSION_ (_codename_)!"
* Starting _name_...
* \[ OK \] Started _name_.
-then systemd is running. (See an actual [screenshot](f17boot.png).)
+then systemd is running.
+(See an actual [screenshot](../assets/f17boot.png).)
-Debugging always gets easier if you can get a shell. If you do not get a login prompt, try switching to a different virtual terminal using CTRL+ALT+F\_\_. Problems with a display server startup may manifest themselves as a missing login on tty1, but other VTs working.
+Debugging always gets easier if you can get a shell.
+If you do not get a login prompt, try switching to a different virtual terminal using CTRL+ALT+F\_\_.
+Problems with a display server startup may manifest themselves as a missing login on tty1, but other VTs working.
-If the boot stops without presenting you with a login on any virtual console, let it retry for _up to 5 minutes_ before declaring it definitely stuck. There is a chance that a service that has trouble starting will be killed after this timeout and the boot will continue normally. Another possibility is that a device for an important mountpoint will fail to appear and you will be presented with _emergency mode_.
+If the boot stops without presenting you with a login on any virtual console,
+let it retry for _up to 5 minutes_ before declaring it definitely stuck.
+There is a chance that a service that has trouble starting will be killed after this timeout and the boot will continue normally.
+Another possibility is that a device for an important mountpoint will fail to appear and you will be presented with _emergency mode_.
## If You Get No Shell
-If you get neither a normal login nor the emergency mode shell, you will need to do additional steps to get debugging information out of the machine.
+If you get neither a normal login nor the emergency mode shell,
+you will need to do additional steps to get debugging information out of the machine.
* Try CTRL+ALT+DEL to reboot.
- * If it does not reboot, mention it in your bugreport. Meanwhile force the reboot with [SysRq](http://fedoraproject.org/wiki/QA/Sysrq) or hard reset.
+ * If it does not reboot, mention it in your bugreport. Meanwhile force the reboot with
+ [SysRq](http://fedoraproject.org/wiki/QA/Sysrq)
+ or hard reset.
* When booting the next time, you will have to add some kernel command line arguments depending on which of the debugging strategies you choose from the following options.
### Debug Logging to a Serial Console
-If you have a hardware serial console available or if you are debugging in a virtual machine (e.g. using virt-manager you can switch your view to a serial console in the menu View -> Text Consoles or connect from the terminal using `virsh console MACHINE`), you can ask systemd to log lots of useful debugging information to it by booting with:
+If you have a hardware serial console available or if you are debugging in a virtual machine
+(e.g. using virt-manager you can switch your view to a serial console in the menu View -> Text Consoles or connect from the terminal using `virsh console MACHINE`),
+you can ask systemd to log lots of useful debugging information to it by booting with:
```sh
systemd.log_level=debug systemd.log_target=console console=ttyS0,38400 console=tty1
```
-
-The above is useful if pid 1 is failing, but if a later but critical boot service is broken (such as networking), you can configure journald to forward to the console by using:
+The above is useful if pid 1 is failing, but if a later but critical boot service is broken (such as networking),
+you can configure journald to forward to the console by using:
```sh
systemd.journald.forward_to_console=1 console=ttyS0,38400 console=tty1
@@ -48,23 +60,31 @@ console= can be specified multiple times, systemd will output to all of them.
### Booting into Rescue or Emergency Targets
-To boot directly into rescue target add `systemd.unit=rescue.target` or just `1` to the kernel command line. This target is useful if the problem occurs somewhere after the basic system is brought up, during the starting of "normal" services. If this is the case, you should be able to disable the bad service from here. If the rescue target will not boot either, the more minimal emergency target might.
+To boot directly into rescue target add `systemd.unit=rescue.target` or just `1` to the kernel command line.
+This target is useful if the problem occurs somewhere after the basic system is brought up, during the starting of "normal" services.
+If this is the case, you should be able to disable the bad service from here.
+If the rescue target will not boot either, the more minimal emergency target might.
-To boot directly into emergency shell add `systemd.unit=emergency.target` or `emergency` to the kernel command line. Note that in the emergency shell you will have to remount the root filesystem read-write by yourself before editing any files:
+To boot directly into emergency shell add `systemd.unit=emergency.target` or `emergency` to the kernel command line.
+Note that in the emergency shell you will have to remount the root filesystem read-write by yourself before editing any files:
```sh
mount -o remount,rw /
```
-Common issues that can be resolved in the emergency shell are bad lines in **/etc/fstab**. After fixing **/etc/fstab**, run `systemctl daemon-reload` to let systemd refresh its view of it.
+Common issues that can be resolved in the emergency shell are bad lines in `/etc/fstab`.
+After fixing **/etc/fstab**, run `systemctl daemon-reload` to let systemd refresh its view of it.
-If not even the emergency target works, you can boot directly into a shell with `init=/bin/sh`. This may be necessary in case systemd itself or some libraries it depends on are damaged by filesystem corruption. You may need to reinstall working versions of the affected packages.
+If not even the emergency target works, you can boot directly into a shell with `init=/bin/sh`.
+This may be necessary in case systemd itself or some libraries it depends on are damaged by filesystem corruption.
+You may need to reinstall working versions of the affected packages.
If `init=/bin/sh` does not work, you must boot from another medium.
### Early Debug Shell
-You can enable shell access to be available very early in the startup process to fall back on and diagnose systemd related boot up issues with various systemctl commands. Enable it using:
+You can enable shell access to be available very early in the startup process to fall back on and diagnose systemd related boot up issues with various systemctl commands.
+Enable it using:
```sh
systemctl enable debug-shell.service
@@ -78,31 +98,46 @@ systemd.debug-shell=1
on the kernel command line.
-**Tip**: If you find yourself in a situation where you cannot use systemctl to communicate with a running systemd (e.g. when setting this up from a different booted system), you can avoid communication with the manager by specifying `--root=`:
+**Tip**: If you find yourself in a situation where you cannot use systemctl to communicate with a running systemd
+(e.g. when setting this up from a different booted system),
+you can avoid communication with the manager by specifying `--root=`:
```sh
systemctl --root=/ enable debug-shell.service
```
-Once enabled, the next time you boot you will be able to switch to tty9 using CTRL+ALT+F9 and have a root shell there available from an early point in the booting process. You can use the shell for checking the status of services, reading logs, looking for stuck jobs with `systemctl list-jobs`, etc.
+Once enabled, the next time you boot you will be able to switch to tty9 using CTRL+ALT+F9 and have a root shell there available from an early point in the booting process.
+You can use the shell for checking the status of services, reading logs, looking for stuck jobs with `systemctl list-jobs`, etc.
-**Warning:** Use this shell only for debugging! Do not forget to disable systemd-debug-shell.service after you've finished debugging your boot problems. Leaving the root shell always available would be a security risk.
+**Warning:** Use this shell only for debugging!
+Do not forget to disable systemd-debug-shell.service after you've finished debugging your boot problems.
+Leaving the root shell always available would be a security risk.
-It is also possible to alias `kbrequest.target` to `debug-shell.service` to start the debug shell on demand. This has the same security implications, but avoids running the shell always.
+It is also possible to alias `kbrequest.target` to `debug-shell.service` to start the debug shell on demand.
+This has the same security implications, but avoids running the shell always.
### verify prerequisites
-A (at least partly) populated `/dev` is required. Depending on your setup (e.g. on embedded systems), check that the Linux kernel config options `CONFIG_DEVTMPFS` and `CONFIG_DEVTMPFS_MOUNT` are set. Also support for cgroups and fanotify is recommended for a flawless operation, so check that the Linux kernel config options `CONFIG_CGROUPS` and `CONFIG_FANOTIFY` are set. The message "Failed to get D-Bus connection: No connection to service manager." during various `systemctl` operations is an indicator that these are missing.
+A (at least partly) populated `/dev` is required.
+Depending on your setup (e.g. on embedded systems),
+check that the Linux kernel config options `CONFIG_DEVTMPFS` and `CONFIG_DEVTMPFS_MOUNT` are set.
+Also support for cgroups and fanotify is recommended for a flawless operation, so check that the Linux kernel config options `CONFIG_CGROUPS` and `CONFIG_FANOTIFY` are set.
+The message "Failed to get D-Bus connection: No connection to service manager."
+during various `systemctl` operations is an indicator that these are missing.
## If You Can Get a Shell
-When you have systemd running to the extent that it can provide you with a shell, please use it to extract useful information for debugging. Boot with these parameters on the kernel command line:
+When you have systemd running to the extent that it can provide you with a shell,
+please use it to extract useful information for debugging.
+Boot with these parameters on the kernel command line:
```sh
systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M printk.devkmsg=on
```
-in order to increase the verbosity of systemd, to let systemd write its logs to the kernel log buffer, to increase the size of the kernel log buffer, and to prevent the kernel from discarding messages. After reaching the shell, look at the log:
+in order to increase the verbosity of systemd, to let systemd write its logs to the kernel log buffer,
+to increase the size of the kernel log buffer, and to prevent the kernel from discarding messages.
+After reaching the shell, look at the log:
```sh
journalctl -b
@@ -118,12 +153,14 @@ systemctl list-jobs
The jobs that are listed as "running" are the ones that must complete before the "waiting" ones will be allowed to start executing.
-
# Diagnosing Shutdown Problems
-Just like with boot problems, when you encounter a hang during shutting down, make sure you wait _at least 5 minutes_ to distinguish a permanent hang from a broken service that's just timing out. Then it's worth testing whether the system reacts to CTRL+ALT+DEL in any way.
+Just like with boot problems, when you encounter a hang during shutting down,
+make sure you wait _at least 5 minutes_ to distinguish a permanent hang from a broken service that's just timing out.
+Then it's worth testing whether the system reacts to CTRL+ALT+DEL in any way.
-If shutdown (whether it be to reboot or power-off) of your system gets stuck, first test if the kernel itself is able to reboot or power-off the machine forcedly using one of these commands:
+If shutdown (whether it be to reboot or power-off) of your system gets stuck,
+first test if the kernel itself is able to reboot or power-off the machine forcedly using one of these commands:
```sh
reboot -f
@@ -142,7 +179,7 @@ If normal reboot or poweroff work, but take a suspiciously long time, then
systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M printk.devkmsg=on enforcing=0
```
-* save the following script as **/usr/lib/systemd/system-shutdown/debug.sh** and make it executable:
+* save the following script as `/usr/lib/systemd/system-shutdown/debug.sh` and make it executable:
```sh
#!/bin/sh
@@ -153,17 +190,17 @@ mount -o remount,ro /
* reboot
-
-Look for timeouts logged in the resulting file **shutdown-log.txt** and/or attach it to a bugreport.
+Look for timeouts logged in the resulting file `shutdown-log.txt` and/or attach it to a bugreport.
## Shutdown Never Finishes
-If normal reboot or poweroff never finish even after waiting a few minutes, the above method to create the shutdown log will not help and the log must be obtained using other methods. Two options that are useful for debugging boot problems can be used also for shutdown problems:
+If normal reboot or poweroff never finish even after waiting a few minutes,
+the above method to create the shutdown log will not help and the log must be obtained using other methods.
+Two options that are useful for debugging boot problems can be used also for shutdown problems:
* use a serial console
* use a debug shell - not only is it available from early boot, it also stays active until late shutdown.
-
# Status and Logs of Services
When the start of a service fails, systemctl will give you a generic error message:
@@ -173,38 +210,52 @@ When the start of a service fails, systemctl will give you a generic error messa
Job failed. See system journal and 'systemctl status' for details.
```
-The service may have printed its own error message, but you do not see it, because services run by systemd are not related to your login session and their outputs are not connected to your terminal. That does not mean the output is lost though. By default the stdout, stderr of services are directed to the systemd _journal_ and the logs that services produce via `syslog(3)` go there too. systemd also stores the exit code of failed services. Let's check:
+The service may have printed its own error message, but you do not see it,
+because services run by systemd are not related to your login session and their outputs are not connected to your terminal.
+That does not mean the output is lost though.
+By default the stdout,
+stderr of services are directed to the systemd _journal_ and the logs that services produce via `syslog(3)` go there too.
+systemd also stores the exit code of failed services.
+Let's check:
```sh
# systemctl status foo.service
foo.service - mmm service
- Loaded: loaded (/etc/systemd/system/foo.service; static)
- Active: failed (Result: exit-code) since Fri, 11 May 2012 20:26:23 +0200; 4s ago
- Process: 1329 ExecStart=/usr/local/bin/foo (code=exited, status=1/FAILURE)
- CGroup: name=systemd:/system/foo.service
+Loaded: loaded (/etc/systemd/system/foo.service; static)
+Active: failed (Result: exit-code) since Fri, 11 May 2012 20:26:23 +0200; 4s ago
+Process: 1329 ExecStart=/usr/local/bin/foo (code=exited, status=1/FAILURE)
+CGroup: name=systemd:/system/foo.service
May 11 20:26:23 scratch foo[1329]: Failed to parse config
```
-
-In this example the service ran as a process with PID 1329 and exited with error code 1. If you run systemctl status as root or as a user from the `adm` group, you will get a few lines from the journal that the service wrote. In the example the service produced just one error message.
+In this example the service ran as a process with PID 1329 and exited with error code 1.
+If you run systemctl status as root or as a user from the `adm` group,
+you will get a few lines from the journal that the service wrote.
+In the example the service produced just one error message.
To list the journal, use the `journalctl` command.
-If you have a syslog service (such as rsyslog) running, the journal will also forward the messages to it, so you'll find them in **/var/log/messages** (depending on rsyslog's configuration).
-
+If you have a syslog service (such as rsyslog) running, the journal will also forward the messages to it,
+so you'll find them in `/var/log/messages` (depending on rsyslog's configuration).
# Reporting systemd Bugs
-Be prepared to include some information (logs) about your system as well. These should be complete (no snippets please), not in an archive, uncompressed.
+Be prepared to include some information (logs) about your system as well.
+These should be complete (no snippets please), not in an archive, uncompressed.
-Please report bugs to your distribution's bug tracker first. If you are sure that you are encountering an upstream bug, then first check [for existing bug reports](https://github.com/systemd/systemd/issues/), and if your issue is not listed [file a new bug](https://github.com/systemd/systemd/issues/new).
+Please report bugs to your distribution's bug tracker first.
+If you are sure that you are encountering an upstream bug, then first check
+[for existing bug reports](https://github.com/systemd/systemd/issues/),
+and if your issue is not listed
+[file a new bug](https://github.com/systemd/systemd/issues/new).
## Information to Attach to a Bug Report
Whenever possible, the following should be mentioned and attached to your bug report:
-* The exact kernel command-line used. Typically from the bootloader configuration file (e.g. **/boot/grub2/grub.cfg**) or from **/proc/cmdline**
+* The exact kernel command-line used.
+Typically from the bootloader configuration file (e.g. `/boot/grub2/grub.cfg`) or from `/proc/cmdline`
* The journal (the output of `journalctl -b > journal.txt`)
* ideally after booting with `systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M printk.devkmsg=on`
* The output of a systemd dump: `systemd-analyze dump > systemd-dump.txt`
diff --git a/docs/DESKTOP_ENVIRONMENTS.md b/docs/DESKTOP_ENVIRONMENTS.md
index 0a0eff6..1c72969 100644
--- a/docs/DESKTOP_ENVIRONMENTS.md
+++ b/docs/DESKTOP_ENVIRONMENTS.md
@@ -59,21 +59,27 @@ desktop environments should adhere to the following conventions:
- `app-KDE-org.kde.okular@12345.service`
- `app-org.kde.amarok.service`
- `app-org.gnome.Evince-12345.scope`
+
* Using `.service` units instead of `.scope` units, i.e. allowing systemd to
start the process on behalf of the caller,
instead of the caller starting the process and letting systemd know about it,
is encouraged.
+
* The RANDOM should be a string of random characters to ensure that multiple instances
of the application can be launched.
+
It can be omitted in the case of a non-transient application services which can ensure
multiple instances are not spawned, such as a DBus activated application.
+
* If no application ID is available, the launcher should generate a reasonable
name when possible (e.g. using `basename(argv[0])`). This name must not
contain a `-` character.
This has the following advantages:
+
* Using the `app-<launcher>-` prefix means that the unit defaults can be
adjusted using desktop environment specific drop-in files.
+
* The application ID can be retrieved by stripping the prefix and postfix.
This in turn should map to the corresponding `.desktop` file when available
@@ -82,8 +88,8 @@ This could be `app-<launcher>-<ApplicationID>-<RANDOM>.slice`.
TODO: Does it really make sense to insert the `<launcher>`? In GNOME I am
currently using a drop-in to configure `BindTo=graphical-session.target`,
-`CollectMode=inactive-or-failed` and `TimeoutSec=5s`. I feel that such a
-policy makes sense, but it may make much more sense to just define a
+`CollectMode=inactive-or-failed` and `TimeoutSec=5s`.
+I feel that such a policy makes sense, but it may make much more sense to just define a
global default for all (graphical) applications.
* Should application lifetime be bound to the session?
@@ -95,19 +101,17 @@ global default for all (graphical) applications.
To allow XDG autostart integration, systemd ships a cross-desktop generator
to create appropriate units for the autostart directory
(`systemd-xdg-autostart-generator`).
-Desktop Environments can opt-in to using this by starting
-`xdg-desktop-autostart.target`. The systemd generator correctly handles
-`OnlyShowIn=` and `NotShowIn=`. It also handles the KDE and GNOME specific
-`X-KDE-autostart-condition=` and `AutostartCondition=` by using desktop-environment-provided
-binaries in an `ExecCondition=` line.
-
-However, this generator is somewhat limited in what it supports. For example,
-all generated units will have `After=graphical-session.target` set on them,
+Desktop Environments can opt-in to using this by starting `xdg-desktop-autostart.target`.
+The systemd generator correctly handles `OnlyShowIn=` and `NotShowIn=`.
+It also handles the KDE and GNOME specific `X-KDE-autostart-condition=` and `AutostartCondition=` by using desktop-environment-provided binaries in an `ExecCondition=` line.
+
+However, this generator is somewhat limited in what it supports.
+For example, all generated units will have `After=graphical-session.target` set on them,
and therefore may not be useful to start session services.
Desktop files can be marked to be explicitly excluded from the generator using the line
-`X-systemd-skip=true`. This should be set if an application provides its own
-systemd service file for startup.
+`X-systemd-skip=true`.
+This should be set if an application provides its own systemd service file for startup.
## Startup and shutdown best practices
diff --git a/docs/DISTRO_PORTING.md b/docs/DISTRO_PORTING.md
index c95a829..cb23093 100644
--- a/docs/DISTRO_PORTING.md
+++ b/docs/DISTRO_PORTING.md
@@ -9,8 +9,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
## HOWTO
-You need to make the follow changes to adapt systemd to your
-distribution:
+You need to make the follow changes to adapt systemd to your distribution:
1. Find the right configure parameters for:
@@ -27,23 +26,22 @@ distribution:
2. Try it out.
Play around (as an ordinary user) with
- `/usr/lib/systemd/systemd --test --system` for a test run
- of systemd without booting. This will read the unit files and
- print the initial transaction it would execute during boot-up.
+ `/usr/lib/systemd/systemd --test --system` for a test run of systemd without booting.
+ This will read the unit files and print the initial transaction it would execute during boot-up.
This will also inform you about ordering loops and suchlike.
## Compilation options
-The default configuration does not enable any optimization or hardening
-options. This is suitable for development and testing, but not for end-user
+The default configuration does not enable any optimization or hardening options.
+This is suitable for development and testing, but not for end-user
installations.
For deployment, optimization (`-O2` or `-O3` compiler options), link time
optimization (`-Db_lto=true` meson option), and hardening (e.g.
`-D_FORTIFY_SOURCE=2`, `-fstack-protector-strong`, `-fstack-clash-protection`,
`-fcf-protection`, `-pie` compiler options, and `-z relro`, `-z now`,
-`--as-needed` linker options) are recommended. The most appropriate set of
-options depends on the architecture and distribution specifics so no default is
+`--as-needed` linker options) are recommended.
+The most appropriate set of options depends on the architecture and distribution specifics so no default is
provided.
## NTP Pool
@@ -56,8 +54,9 @@ and can be up to .5s off from servers that use stepped leap seconds.
If you prefer to use leap second steps, please register your own
vendor pool at ntp.org and make it the built-in default by
-passing `-Dntp-servers=` to meson. Registering vendor
-pools is [free](http://www.pool.ntp.org/en/vendors.html).
+passing `-Dntp-servers=` to meson.
+Registering vendor pools is
+[free](http://www.pool.ntp.org/en/vendors.html).
Use `-Dntp-servers=` to direct systemd-timesyncd to different fallback
NTP servers.
@@ -75,8 +74,8 @@ DNS servers.
The default PAM config shipped by systemd is really bare bones.
It does not include many modules your distro might want to enable
-to provide a more seamless experience. For example, limits set in
-`/etc/security/limits.conf` will not be read unless you load `pam_limits`.
+to provide a more seamless experience.
+For example, limits set in `/etc/security/limits.conf` will not be read unless you load `pam_limits`.
Make sure you add modules your distro expects from user services.
Pass `-Dpamconfdir=no` to meson to avoid installing this file and
@@ -85,10 +84,9 @@ instead install your own.
## Contributing Upstream
We generally no longer accept distribution-specific patches to
-systemd upstream. If you have to make changes to systemd's source code
-to make it work on your distribution, unless your code is generic
-enough to be generally useful, we are unlikely to merge it. Please
-always consider adopting the upstream defaults. If that is not
-possible, please maintain the relevant patches downstream.
+systemd upstream.
+If you have to make changes to systemd's source code to make it work on your distribution, unless your code is generic enough to be generally useful, we are unlikely to merge it.
+Please always consider adopting the upstream defaults.
+If that is not possible, please maintain the relevant patches downstream.
Thank you for understanding.
diff --git a/docs/ELF_PACKAGE_METADATA.md b/docs/ELF_PACKAGE_METADATA.md
index 6cb3f78..176f574 100644
--- a/docs/ELF_PACKAGE_METADATA.md
+++ b/docs/ELF_PACKAGE_METADATA.md
@@ -12,8 +12,8 @@ or parse ELF core files.*
## Motivation
-ELF binaries get stamped with a unique, build-time generated hex string identifier called
-`build-id`, [which gets embedded as an ELF note called `.note.gnu.build-id`](https://fedoraproject.org/wiki/Releases/FeatureBuildId).
+ELF binaries get stamped with a unique, build-time generated hex string identifier called `build-id`,
+[which gets embedded as an ELF note called `.note.gnu.build-id`](https://fedoraproject.org/wiki/Releases/FeatureBuildId).
In most cases, this allows to associate a stripped binary with its debugging information.
It is used, for example, to dynamically fetch DWARF symbols from a debuginfo server, or
to query the local package manager and find out the package metadata or, again, the DWARF
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 483645b..3b03726 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -7,7 +7,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Frequently Asked Questions
-Also check out the [Tips & Tricks](../TIPS_AND_TRICKS)!
+Also check out the [Tips & Tricks](/TIPS_AND_TRICKS)!
**Q: How do I change the current runlevel?**
@@ -70,7 +70,8 @@ A: Simply instantiate a new getty service for the port of your choice (internall
# systemctl start serial-getty@ttyS2.service
```
-Note that gettys on the virtual console are started on demand. You can control how many you get via the NAutoVTs= setting in [logind.conf(7)](http://www.freedesktop.org/software/systemd/man/logind.html). Also see [this blog story](http://0pointer.de/blog/projects/serial-console.html).
+Note that gettys on the virtual console are started on demand. You can control how many you get via the NAutoVTs= setting in [logind.conf(7)](http://www.freedesktop.org/software/systemd/man/systemd-logind.service).
+Also see [this blog story](http://0pointer.de/blog/projects/serial-console.html).
**Q: How to I figure out which service a process belongs to?**
@@ -103,12 +104,12 @@ A: Use:
**Q: Whenever my service tries to acquire RT scheduling for one of its threads this is refused with EPERM even though my service is running with full privileges. This works fine on my non-systemd system!**
-A: By default, systemd places all systemd daemons in their own cgroup in the "cpu" hierarchy. Unfortunately, due to a kernel limitation, this has the effect of disallowing RT entirely for the service. See [My Service Can't Get Realtime!](../MY_SERVICE_CANT_GET_REATLIME) for a longer discussion and what to do about this.
+A: By default, systemd places all systemd daemons in their own cgroup in the "cpu" hierarchy. Unfortunately, due to a kernel limitation, this has the effect of disallowing RT entirely for the service. See [My Service Can't Get Realtime!](/MY_SERVICE_CANT_GET_REATLIME) for a longer discussion and what to do about this.
**Q: My service is ordered after `network.target` but at boot it is still called before the network is up. What's going on?**
-A: That's a long story, and that's why we have a wiki page of its own about this: [Running Services After the Network is up](../NETWORK_ONLINE)
+A: That's a long story, and that's why we have a wiki page of its own about this: [Running Services After the Network is up](/NETWORK_ONLINE)
**Q: My systemd system always comes up with `/tmp` as a tiny `tmpfs`. How do I get rid of this?**
-A: That's also a long story, please have a look on [API File Systems](../API_FILE_SYSTEMS)
+A: That's also a long story, please have a look on [API File Systems](/API_FILE_SYSTEMS)
diff --git a/docs/GROUP_RECORD.md b/docs/GROUP_RECORD.md
index f463b0a..c055e49 100644
--- a/docs/GROUP_RECORD.md
+++ b/docs/GROUP_RECORD.md
@@ -8,23 +8,23 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# JSON Group Records
Long story short: JSON Group Records are to `struct group` what
-[JSON User Records](USER_RECORD) are to `struct passwd`.
+[JSON User Records](/USER_RECORD) are to `struct passwd`.
-Conceptually, much of what applies to JSON user records also applies to JSON
-group records. They also consist of seven sections, with similar properties and
+Conceptually, much of what applies to JSON user records also applies to JSON group records.
+They also consist of seven sections, with similar properties and
they carry some identical (or at least very similar) fields.
## Fields in the `regular` section
-`groupName` → A string with the UNIX group name. Matches the `gr_name` field of
-UNIX/glibc NSS `struct group`, or the shadow structure `struct sgrp`'s
-`sg_namp` field.
+`groupName` → A string with the UNIX group name.
+Matches the `gr_name` field of UNIX/glibc NSS `struct group`,
+or the shadow structure `struct sgrp`'s `sg_namp` field.
-`realm` → The "realm" the group belongs to, conceptually identical to the same
-field of user records. A string in DNS domain name syntax.
+`realm` → The "realm" the group belongs to, conceptually identical to the same field of user records.
+A string in DNS domain name syntax.
-`description` → A descriptive string for the group. This is similar to the
-`realName` field of user records, and accepts arbitrary strings, as long as
+`description` → A descriptive string for the group.
+This is similar to the `realName` field of user records, and accepts arbitrary strings, as long as
they follow the same GECOS syntax requirements as `realName`.
`disposition` → The disposition of the group, conceptually identical to the
@@ -33,39 +33,36 @@ same field of user records. A string.
`service` → A string, an identifier for the service managing this group record
(this field is typically in reverse domain name syntax.)
-`lastChangeUSec` → An unsigned 64-bit integer, a timestamp (in µs since the UNIX
-epoch 1970) of the last time the group record has been modified. (Covers only
-the `regular`, `perMachine` and `privileged` sections).
+`lastChangeUSec` → An unsigned 64-bit integer, a timestamp
+(in µs since the UNIX epoch 1970) of the last time the group record has been modified.
+(Covers only the `regular`, `perMachine` and `privileged` sections).
-`gid` → An unsigned integer in the range 0…4294967295: the numeric UNIX group
-ID (GID) to use for the group. This corresponds to the `gr_gid` field of
-`struct group`.
+`gid` → An unsigned integer in the range 0…4294967295: the numeric UNIX group ID (GID) to use for the group.
+This corresponds to the `gr_gid` field of `struct group`.
-`members` → An array of strings, listing user names that are members of this
-group. Note that JSON user records also contain a `memberOf` field, or in other
+`members` → An array of strings, listing user names that are members of this group.
+Note that JSON user records also contain a `memberOf` field, or in other
words a group membership can either be denoted in the JSON user record or in
-the JSON group record, or in both. The list of memberships should be determined
-as the combination of both lists (plus optionally others). If a user is listed
-as member of a group and doesn't exist it should be ignored. This field
-corresponds to the `gr_mem` field of `struct group` and the `sg_mem` field of
-`struct sgrp`.
+the JSON group record, or in both.
-`administrators` → Similarly, an array of strings, listing user names that
-shall be considered "administrators" of this group. This field corresponds to
-the `sg_adm` field of `struct sgrp`.
+The list of memberships should be determined as the combination of both lists (plus optionally others).
+If a user is listed as member of a group and doesn't exist it should be ignored.
+This field corresponds to the `gr_mem` field of `struct group` and the `sg_mem` field of `struct sgrp`.
+
+`administrators` → Similarly, an array of strings, listing user names that shall be considered "administrators" of this group.
+This field corresponds to the `sg_adm` field of `struct sgrp`.
`privileged`/`perMachine`/`binding`/`status`/`signature`/`secret` → The
-objects/arrays for the other six group record sections. These are organized the
-same way as for the JSON user records, and have the same semantics.
+objects/arrays for the other six group record sections.
+These are organized the same way as for the JSON user records, and have the same semantics.
## Fields in the `privileged` section
The following fields are defined:
-`hashedPassword` → An array of strings with UNIX hashed passwords; see the
-matching field for user records for details. This field corresponds to the
-`sg_passwd` field of `struct sgrp` (and `gr_passwd` of `struct group` in a
-way).
+`hashedPassword` → An array of strings with UNIX hashed passwords;
+see the matching field for user records for details.
+This field corresponds to the `sg_passwd` field of `struct sgrp` (and `gr_passwd` of `struct group` in a way).
## Fields in the `perMachine` section
diff --git a/docs/HACKING.md b/docs/HACKING.md
index aea25db..45334d8 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -11,8 +11,8 @@ We welcome all contributions to systemd. If you notice a bug or a missing
feature, please feel invited to fix it, and submit your work as a
[GitHub Pull Request (PR)](https://github.com/systemd/systemd/pull/new).
-Please make sure to follow our [Coding Style](CODING_STYLE) when submitting
-patches. Also have a look at our [Contribution Guidelines](CONTRIBUTING).
+Please make sure to follow our [Coding Style](/CODING_STYLE) when submitting
+patches. Also have a look at our [Contribution Guidelines](/CONTRIBUTING).
When adding new functionality, tests should be added. For shared functionality
(in `src/basic/` and `src/shared/`) unit tests should be sufficient. The general
@@ -23,7 +23,7 @@ test executable. For features at a higher level, tests in `src/test/` are very
strongly recommended. If that is not possible, integration tests in `test/` are
encouraged.
-Please also have a look at our list of [code quality tools](CODE_QUALITY) we
+Please also have a look at our list of [code quality tools](/CODE_QUALITY) we
have setup for systemd, to ensure our codebase stays in good shape.
Please always test your work before submitting a PR. For many of the components
@@ -117,7 +117,7 @@ Some source files are generated during build. We use two templating engines:
where jinja2 syntax is not interpreted.
See the
- [Jinja Template Designer Documentation](https://jinja2docs.readthedocs.io/en/stable/templates.html#synopsis)
+ [Jinja Template Designer Documentation](https://jinja.palletsprojects.com/en/3.1.x/templates/#synopsis)
for details.
Please note that files for both template engines use the `.in` extension.
@@ -131,7 +131,7 @@ distribution and can be disabled by setting `-Dmode=release`.
## Sanitizers in mkosi
-See [Testing systemd using sanitizers](TESTING_WITH_SANITIZERS) for more information
+See [Testing systemd using sanitizers](/TESTING_WITH_SANITIZERS) for more information
on how to build with sanitizers enabled in mkosi.
## Fuzzers
@@ -194,7 +194,7 @@ done
```
If you find a bug that impacts the security of systemd, please follow the
-guidance in [CONTRIBUTING.md](CONTRIBUTING) on how to report a security vulnerability.
+guidance in [CONTRIBUTING.md](/CONTRIBUTING) on how to report a security vulnerability.
For more details on building fuzzers and integrating with OSS-Fuzz, visit:
diff --git a/docs/HOME_DIRECTORY.md b/docs/HOME_DIRECTORY.md
index f1b7faf..2efabae 100644
--- a/docs/HOME_DIRECTORY.md
+++ b/docs/HOME_DIRECTORY.md
@@ -8,24 +8,24 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Home Directories
[`systemd-homed.service(8)`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html)
-manages home directories of regular ("human") users. Each directory it manages
-encapsulates both the data store and the user record of the user, so that it
-comprehensively describes the user account, and is thus naturally portable
-between systems without any further, external metadata. This document describes
-the format used by these home directories, in the context of the storage
+manages home directories of regular ("human") users.
+Each directory it manages encapsulates both the data store and the user record of the user,
+so that it comprehensively describes the user account, and is thus naturally portable
+between systems without any further, external metadata.
+This document describes the format used by these home directories, in the context of the storage
mechanism used.
## General Structure
Inside of the home directory a file `~/.identity` contains the JSON formatted
-user record of the user. It follows the format defined in
-[`JSON User Records`](USER_RECORD). It is recommended to bring the
-record into 'normalized' form (i.e. all objects should contain their fields
-sorted alphabetically by their key) before storing it there, though this is not
-required nor enforced. Since the user record is cryptographically signed, the
-user cannot make modifications to the file on their own (at least not without
-corrupting it, or knowing the private key used for signing the record). Note
-that user records are stored here without their `binding`, `status` and
+user record of the user.
+It follows the format defined in [`JSON User Records`](/USER_RECORD).
+It is recommended to bring the record into 'normalized' form(i.e. all objects should contain their fields
+sorted alphabetically by their key) before storing it there,
+though this is not required nor enforced.
+Since the user record is cryptographically signed, the user cannot make modifications to the file on their own
+(at least not without corrupting it, or knowing the private key used for signing the record).
+Note that user records are stored here without their `binding`, `status` and
`secret` sections, i.e. only with the sections included in the signature plus
the signature section itself.
@@ -39,127 +39,119 @@ command line) the home directory requires no special setup besides including
the user record in the `~/.identity` file.
It is recommended to name home directories managed this way by
-`systemd-homed.service` by the user name, suffixed with `.homedir` (example:
-`lennart.homedir` for a user `lennart`) but this is not enforced. When the user
-is logged in, the directory is generally mounted to `/home/$USER` (in our
-example: `/home/lennart`), thus dropping the suffix while the home directory is
-active. `systemd-homed` will automatically discover home directories named this
-way in `/home/*.homedir` and synthesize NSS user records for them as they show
-up.
+`systemd-homed.service` by the user name, suffixed with `.homedir`
+(example: `lennart.homedir` for a user `lennart`) but this is not enforced.
+When the user is logged in, the directory is generally mounted to `/home/$USER`
+(in our example: `/home/lennart`), thus dropping the suffix while the home directory is active.
+`systemd-homed` will automatically discover home directories named this
+way in `/home/*.homedir` and synthesize NSS user records for them as they show up.
## Storage Mechanism: `fscrypt` Directories
This storage mechanism is mostly identical to the plain directory storage
-mechanism, except that the home directory is encrypted using `fscrypt`. (Use
-`--storage=fscrypt` on the `homectl` command line.) Key management is
-implemented via extended attributes on the directory itself: for each password
-an extended attribute `trusted.fscrypt_slot0`, `trusted.fscrypt_slot1`,
-`trusted.fscrypt_slot2`, … is maintained. Its value contains a colon-separated
-pair of Base64 encoded data fields. The first field contains a salt value, the
-second field the encrypted volume key. The latter is encrypted using AES256 in
-counter mode, using a key derived from the password via PBKDF2-HMAC-SHA512,
-together with the salt value. The construction is similar to what LUKS does for
-`dm-crypt` encrypted volumes. Note that extended attributes are not encrypted
-by `fscrypt` and hence are suitable for carrying the key slots. Moreover, by
-using extended attributes, the slots are directly attached to the directory and
+mechanism, except that the home directory is encrypted using `fscrypt`.
+(Use `--storage=fscrypt` on the `homectl` command line.)
+Key management is implemented via extended attributes on the directory itself:
+for each password an extended attribute `trusted.fscrypt_slot0`, `trusted.fscrypt_slot1`,
+`trusted.fscrypt_slot2`, … is maintained.
+Its value contains a colon-separated pair of Base64 encoded data fields.
+The first field contains a salt value, the second field the encrypted volume key.
+The latter is encrypted using AES256 in counter mode, using a key derived from the password via PBKDF2-HMAC-SHA512,
+together with the salt value.
+The construction is similar to what LUKS does for`dm-crypt` encrypted volumes.
+Note that extended attributes are not encrypted by `fscrypt` and hence are suitable for carrying the key slots.
+Moreover, by using extended attributes, the slots are directly attached to the directory and
an independent sidecar key database is not required.
## Storage Mechanism: `cifs` Home Directories
In this storage mechanism, the home directory is mounted from a CIFS server and
-service at login, configured inside the user record. (Use `--storage=cifs` on
-the `homectl` command line.) The local password of the user is used to log into
-the CIFS service. The directory share needs to contain the user record in
-`~/.identity` as well. Note that this means that the user record needs to be
-registered locally before it can be mounted for the first time, since CIFS
-domain and server information needs to be known *before* the mount. Note that
-for all other storage mechanisms it is entirely sufficient if the directories
+service at login, configured inside the user record.
+(Use `--storage=cifs` on the `homectl` command line.)
+The local password of the user is used to log into the CIFS service.
+The directory share needs to contain the user record in `~/.identity` as well.
+Note that this means that the user record needs to be registered locally before it can be mounted for the first time,
+since CIFS domain and server information needs to be known *before* the mount.
+Note that for all other storage mechanisms it is entirely sufficient if the directories
or storage artifacts are placed at the right locations — all information to
activate them can be derived automatically from their mere availability.
## Storage Mechanism: `luks` Home Directories
This is the most advanced and most secure storage mechanism and consists of a
-Linux file system inside a LUKS2 volume inside a loopback file (or on removable
-media). (Use `--storage=luks` on the `homectl` command line.) Specifically:
-
-* The image contains a GPT partition table. For now it should only contain a
- single partition, and that partition must have the type UUID
- `773f91ef-66d4-49b5-bd83-d683bf40ad16`. Its partition label must be the
- user name.
-
-* This partition must contain a LUKS2 volume, whose label must be the user
- name. The LUKS2 volume must contain a LUKS2 token field of type
- `systemd-homed`. The JSON data of this token must have a `record` field,
- containing a string with base64-encoded data. This data is the JSON user
- record, in the same serialization as in `~/.identity`, though encrypted. The
- JSON data of this token must also have an `iv` field, which contains a
- base64-encoded binary initialization vector for the encryption. The
- encryption used is the same as the LUKS2 volume itself uses, unlocked by the
+Linux file system inside a LUKS2 volume inside a loopback file (or on removable media).
+(Use `--storage=luks` on the `homectl` command line.) Specifically:
+
+* The image contains a GPT partition table.
+ For now it should only contain a single partition,
+ and that partition must have the type UUID
+ `773f91ef-66d4-49b5-bd83-d683bf40ad16`.
+ Its partition label must be the user name.
+
+* This partition must contain a LUKS2 volume, whose label must be the user name.
+ The LUKS2 volume must contain a LUKS2 token field of type `systemd-homed`.
+ The JSON data of this token must have a `record` field, containing a string with base64-encoded data.
+ This data is the JSON user record, in the same serialization as in `~/.identity`, though encrypted.
+ The JSON data of this token must also have an `iv` field, which contains a
+ base64-encoded binary initialization vector for the encryption.
+ The encryption used is the same as the LUKS2 volume itself uses, unlocked by the
same volume key, but based on its own IV.
-* Inside of this LUKS2 volume must be a Linux file system, one of `ext4`,
- `btrfs` and `xfs`. The file system label must be the user name.
+* Inside of this LUKS2 volume must be a Linux file system, one of `ext4`, `btrfs` and `xfs`.
+ The file system label must be the user name.
-* This file system should contain a single directory named after the user. This
- directory will become the home directory of the user when activated. It
- contains a second copy of the user record in the `~/.identity` file, like in
- the other storage mechanisms.
+* This file system should contain a single directory named after the user.
+ This directory will become the home directory of the user when activated.
+ It contains a second copy of the user record in the `~/.identity` file, like in the other storage mechanisms.
The image file should reside in a directory `/home/` on the system,
-named after the user, suffixed with `.home`. When activated, the container home
-directory is mounted to the same path, though with the `.home` suffix dropped —
-unless a different mount point is defined in the user record. (e.g.: the
-loopback file `/home/waldo.home` is mounted to `/home/waldo` while activated.)
+named after the user, suffixed with `.home`.
+When activated, the container home directory is mounted to the same path,
+though with the `.home` suffix dropped — unless a different mount point is defined in the user record.
+(e.g.: the loopback file `/home/waldo.home` is mounted to `/home/waldo` while activated.)
When the image is stored on removable media (such as a USB stick), the image
-file can be directly `dd`'ed onto it; the format is unchanged. The GPT envelope
-should ensure the image is properly recognizable as a home directory both when
-used in a loopback file and on a removable USB stick. (Note that when mounting
-a home directory from a USB stick, it too defaults to a directory in `/home/`,
+file can be directly `dd`'ed onto it; the format is unchanged.
+The GPT envelope should ensure the image is properly recognizable as a home directory both when
+used in a loopback file and on a removable USB stick.
+(Note that when mounting a home directory from a USB stick, it too defaults to a directory in `/home/`,
named after the username, with no further suffix.)
-Rationale for the GPT partition table envelope: this way the image is nicely
-discoverable and recognizable already by partition managers as a home
-directory. Moreover, when copied onto a USB stick the GPT envelope makes sure
-the stick is properly recognizable as a portable home directory
-medium. (Moreover, it allows embedding additional partitions later on, for
-example on a multi-purpose USB stick that contains both a home
-directory and a generic storage volume.)
+Rationale for the GPT partition table envelope:
+this way the image is nicely discoverable and recognizable already by partition managers as a home directory.
+Moreover, when copied onto a USB stick the GPT envelope makes sure
+the stick is properly recognizable as a portable home directory medium.
+(Moreover, it allows embedding additional partitions later on, for
+example on a multi-purpose USB stick that contains both a home directory and a generic storage volume.)
Rationale for including the encrypted user record in the LUKS2 header:
Linux kernel file system implementations are generally not robust towards
maliciously formatted file systems; there's a good chance that file system
-images can be used as attack vectors, exploiting the kernel. Thus it is
-necessary to validate the home directory image *before* mounting it and
-establishing a minimal level of trust. Since the user record data is
-cryptographically signed and user records not signed with a recognized private
-key are not accepted, a minimal level of trust between the system and the home
-directory image is established.
+images can be used as attack vectors, exploiting the kernel.
+Thus it is necessary to validate the home directory image *before* mounting it and establishing a minimal level of trust.
+Since the user record data is cryptographically signed and user records not signed with a recognized private
+key are not accepted, a minimal level of trust between the system and the homedirectory image is established.
Rationale for storing the home directory one level below to root directory of
-the contained file system: this way special directories such as `lost+found/`
-do not show up in the user's home directory.
+the contained file system:
+this way special directories such as `lost+found/` do not show up in the user's home directory.
## Algorithm
Regardless of the storage mechanism used, an activated home directory
-necessarily involves a mount point to be established. In case of the
-directory-based storage mechanisms (`directory`, `subvolume` and `fscrypt`)
-this is a bind mount. In case of `cifs` this is a CIFS network mount, and in
-case of the LUKS2 backend a regular block device mount of the file system
-contained in the LUKS2 image. By requiring a mount for all cases (even for
-those that already are a directory), a clear logic is defined to distinguish
-active and inactive home directories, so that the directories become
-inaccessible under their regular path the instant they are
-deactivated. Moreover, the `nosuid`, `nodev` and `noexec` flags configured in
-the user record are applied when the bind mount is established.
+necessarily involves a mount point to be established.
+In case of the directory-based storage mechanisms (`directory`, `subvolume` and `fscrypt`) this is a bind mount.
+In case of `cifs` this is a CIFS network mount, and in case of the LUKS2 backend a regular block device mount of the file system
+contained in the LUKS2 image.
+By requiring a mount for all cases (even for those that already are a directory),
+a clear logic is defined to distinguish active and inactive home directories,
+so that the directories become inaccessible under their regular path the instant they are deactivated.
+Moreover, the `nosuid`, `nodev` and `noexec` flags configured in the user record are applied when the bind mount is established.
During activation, the user records retained on the host, the user record
stored in the LUKS2 header (in case of the LUKS2 storage mechanism) and the
-user record stored inside the home directory in `~/.identity` are
-compared. Activation is only permitted if they match the same user and are
-signed by a recognized key. When the three instances differ in `lastChangeUSec`
-field, the newest record wins, and is propagated to the other two locations.
+user record stored inside the home directory in `~/.identity` are compared.
+Activation is only permitted if they match the same user and are signed by a recognized key.
+When the three instances differ in `lastChangeUSec` field, the newest record wins, and is propagated to the other two locations.
During activation, the file system checker (`fsck`) appropriate for the
selected file system is automatically invoked, ensuring the file system is in a
diff --git a/docs/INCOMPATIBILITIES.md b/docs/INCOMPATIBILITIES.md
index 75b60b6..332f1ef 100644
--- a/docs/INCOMPATIBILITIES.md
+++ b/docs/INCOMPATIBILITIES.md
@@ -7,13 +7,17 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Compatibility with SysV
-systemd provides a fair degree of compatibility with the behavior exposed by the SysV init system as implemented by many distributions. Compatibility is provided both for the user experience and the SysV scripting APIs. However, there are some areas where compatibility is limited due to technical reasons or design decisions of systemd and the distributions. All of the following applies to SysV init scripts handled by systemd, however a number of them matter only on specific distributions. Many of the incompatibilities are specific to distribution-specific extensions of LSB/SysV init.
+systemd provides a fair degree of compatibility with the behavior exposed by the SysV init system as implemented by many distributions.
+Compatibility is provided both for the user experience and the SysV scripting APIs.
+However, there are some areas where compatibility is limited due to technical reasons or design decisions of systemd and the distributions.
+All of the following applies to SysV init scripts handled by systemd, however a number of them matter only on specific distributions.
+Many of the incompatibilities are specific to distribution-specific extensions of LSB/SysV init.
* If your distribution removes SysV init scripts in favor of systemd unit files typing "/etc/init.d/foobar start" to start a service will not work, since the script will not be available. Use the more correct "/sbin/service foobar start" instead, and your command will be forwarded to systemd. Note that invoking the init script directly has always been suboptimal since too much of the caller's execution context (environment block, umask, resource limits, audit trails, ...) ended up being inherited by the service, and invocation via "/sbin/service" used to clean this up at least partially. Invocation via /sbin/service works on both SysV and systemd systems. Also, LSB only standardizes invocation via "/sbin/service" anyway. (Note that some distributions ship both systemd unit files and SysV scripts for the services. For these invoking the init scripts will work as expected and the request be forwarded to systemd in any case.)
* LSB header dependency information matters. The SysV implementations on many distributions did not use the dependency information encoded in LSB init script headers, or used them only in very limited ways. Due to that they are often incorrect or incomplete. systemd however fully interprets these headers and follows them closely at runtime (and not at installation time like some implementations).
* Timeouts apply to all init script operations in systemd. While on SysV systems a hanging init script could freeze the system on systemd all init script operations are subject to a timeout of 5min.
* Services are executed in completely clean execution contexts, no context of the invoking user session is inherited. Not even $HOME or similar are set. Init scripts depending on these will not work correctly.
-* Services cannot read from stdin, as this will be connected to /dev/null. That means interactive init scripts are not supported (i.e. Debian's X-Interactive in the LSB header is not supported either.) Thankfully most distributions do not support interaction in init scripts anyway. If you need interaction to ask disk or SSL passphrases please consider using the minimal password querying framework systemd supports. ([details](PASSWORD_AGENTS), [manual page](http://0pointer.de/public/systemd-man/systemd-ask-password.html))
+* Services cannot read from stdin, as this will be connected to /dev/null. That means interactive init scripts are not supported (i.e. Debian's X-Interactive in the LSB header is not supported either.) Thankfully most distributions do not support interaction in init scripts anyway. If you need interaction to ask disk or SSL passphrases please consider using the minimal password querying framework systemd supports. ([details](/PASSWORD_AGENTS), [manual page](http://0pointer.de/public/systemd-man/systemd-ask-password.html))
* Additional verbs for init scripts are not supported. If your init script traditionally supported additional verbs for your init script simply move them to an auxiliary script.
* Additional parameters to the standard verbs (i.e. to "start", "stop" and "status") are not supported. This was an extension of SysV that never was standardized officially, and is not supported in systemd.
* Overriding the "restart" verb is not supported. This verb is always implemented by systemd itself, and consists of a "stop" followed by a "start".
diff --git a/docs/INHIBITOR_LOCKS.md b/docs/INHIBITOR_LOCKS.md
index 61efdc2..7dafc5e 100644
--- a/docs/INHIBITOR_LOCKS.md
+++ b/docs/INHIBITOR_LOCKS.md
@@ -10,12 +10,16 @@ SPDX-License-Identifier: LGPL-2.1-or-later
systemd 183 and newer include a logic to inhibit system shutdowns and sleep states. This is implemented as part of [systemd-logind.daemon(8)](http://www.freedesktop.org/software/systemd/man/systemd-logind.service.html) There are a couple of different use cases for this:
- A CD burning application wants to ensure that the system is not turned off or suspended while the burn process is in progress.
+
- A package manager wants to ensure that the system is not turned off while a package upgrade is in progress.
+
- An office suite wants to be notified before system suspend in order to save all data to disk, and delay the suspend logic until all data is written.
+
- A web browser wants to be notified before system hibernation in order to free its cache to minimize the amount of memory that needs to be virtualized.
+
- A screen lock tool wants to bring up the screen lock right before suspend, and delay the suspend until that's complete.
-Applications which want to make use of the inhibition logic shall take an inhibitor lock via the [logind D-Bus API](http://www.freedesktop.org/wiki/Software/systemd/logind).
+Applications which want to make use of the inhibition logic shall take an inhibitor lock via the [logind D-Bus API](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html).
Seven distinct inhibitor lock types may be taken, or a combination of them:
@@ -31,8 +35,12 @@ Seven distinct inhibitor lock types may be taken, or a combination of them:
Two different modes of locks are supported:
-1. _block_ inhibits operations entirely until the lock is released. If such a lock is taken the operation will fail (but still may be overridden if the user possesses the necessary privileges).
-2. _delay_ inhibits operations only temporarily, either until the lock is released or up to a certain amount of time. The InhibitDelayMaxSec= setting in [logind.conf(5)](http://www.freedesktop.org/software/systemd/man/logind.conf.html) controls the timeout for this. This is intended to be used by applications which need a synchronous way to execute actions before system suspend but shall not be allowed to block suspend indefinitely. This mode is only available for _sleep_ and _shutdown_ locks.
+1. _block_ inhibits operations entirely until the lock is released.
+If such a lock is taken the operation will fail (but still may be overridden if the user possesses the necessary privileges).
+
+2. _delay_ inhibits operations only temporarily, either until the lock is released or up to a certain amount of time.
+The InhibitDelayMaxSec= setting in [logind.conf(5)](http://www.freedesktop.org/software/systemd/man/logind.conf.html) controls the timeout for this. This is intended to be used by applications which need a synchronous way to execute actions before system suspend but shall not be allowed to block suspend indefinitely.
+This mode is only available for _sleep_ and _shutdown_ locks.
Inhibitor locks are taken via the Inhibit() D-Bus call on the logind Manager object:
@@ -71,17 +79,38 @@ node /org/freedesktop/login1 {
- _Why_ is a human-readable, descriptive string of why the lock is taken. Example: "Package Update in Progress"
- _Mode_ is one of `block` or `delay`, see above. Example: "block"
-Inhibit() returns a single value, a file descriptor that encapsulates the lock. As soon as the file descriptor is closed (and all its duplicates) the lock is automatically released. If the client dies while the lock is taken the kernel automatically closes the file descriptor so that the lock is automatically released. A delay lock taken this way should be released ASAP on reception of PrepareForShutdown(true) (see below), but of course only after execution of the actions the application wanted to delay the operation for in the first place.
+Inhibit() returns a single value, a file descriptor that encapsulates the lock.
+As soon as the file descriptor is closed (and all its duplicates) the lock is automatically released.
+If the client dies while the lock is taken the kernel automatically closes the file descriptor so that the lock is automatically released.
+
+A delay lock taken this way should be released ASAP on reception of PrepareForShutdown(true) (see below), but of course only after execution of the actions the application wanted to delay the operation for in the first place.
**ListInhibitors()** lists all currently active inhibitor locks. It returns an array of structs, each consisting of What, Who, Why, Mode as above, plus the PID and UID of the process that requested the lock.
-The **PrepareForShutdown()** and **PrepareForSleep()** signals are emitted when a system suspend or shutdown has been requested and is about to be executed, as well as after the the suspend/shutdown was completed (or failed). The signals carry a boolean argument. If _True_ the shutdown/sleep has been requested, and the preparation phase for it begins, if _False_ the operation has finished completion (or failed). If _True_, this should be used as indication for applications to quickly execute the operations they wanted to execute before suspend/shutdown and then release any delay lock taken. If _False_ the suspend/shutdown operation is over, either successfully or unsuccessfully (of course, this signal will never be sent if a shutdown request was successful). The signal with _False_ is generally delivered only after the system comes back from suspend, the signal with _True_ possibly as well, for example when no delay lock was taken in the first place, and the system suspend hence executed without any delay. The signal with _False_ is usually the signal on which applications request a new delay lock in order to be synchronously notified about the next suspend/shutdown cycle. Note that watching PrepareForShutdown(true)[?](//secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&from=Software%2Fsystemd%2Finhibit&page=Software%2Fsystemd%2Finhibit%2FPrepareForSleep)/PrepareForSleep(true) without taking a delay lock is racy and should not be done, as any code that an application might want to execute on this signal might not actually finish before the suspend/shutdown cycle is executed. _Again_: if you watch PrepareForSuspend(true), then you really should have taken a delay lock first. PrepareForShutdown(false) may be subscribed to by applications which want to be notified about system resume events. Note that this will only be sent out for suspend/resume cycles done via logind, i.e. generally only for high-level user-induced suspend cycles, and not automatic, low-level kernel induced ones which might exist on certain devices with more aggressive power management.
+The **PrepareForShutdown()** and **PrepareForSleep()** signals are emitted when a system suspend or shutdown has been requested and is about to be executed, as well as after the the suspend/shutdown was completed (or failed).
+
+The signals carry a boolean argument.
+If _True_ the shutdown/sleep has been requested, and the preparation phase for it begins, if _False_ the operation has finished completion (or failed).
+
+If _True_, this should be used as indication for applications to quickly execute the operations they wanted to execute before suspend/shutdown and then release any delay lock taken.
+If _False_ the suspend/shutdown operation is over, either successfully or unsuccessfully (of course, this signal will never be sent if a shutdown request was successful).
+
+The signal with _False_ is generally delivered only after the system comes back from suspend, the signal with _True_ possibly as well, for example when no delay lock was taken in the first place, and the system suspend hence executed without any delay.
+
+The signal with _False_ is usually the signal on which applications request a new delay lock in order to be synchronously notified about the next suspend/shutdown cycle.
+
+Note that watching PrepareForShutdown(true)[?](//secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&from=Software%2Fsystemd%2Finhibit&page=Software%2Fsystemd%2Finhibit%2FPrepareForSleep)/PrepareForSleep(true) without taking a delay lock is racy and should not be done, as any code that an application might want to execute on this signal might not actually finish before the suspend/shutdown cycle is executed.
+
+_Again_: if you watch PrepareForSuspend(true), then you really should have taken a delay lock first. PrepareForShutdown(false) may be subscribed to by applications which want to be notified about system resume events.
+
+Note that this will only be sent out for suspend/resume cycles done via logind, i.e. generally only for high-level user-induced suspend cycles, and not automatic, low-level kernel induced ones which might exist on certain devices with more aggressive power management.
The **BlockInhibited** and **DelayInhibited** properties encode what types of locks are currently taken. These fields are a colon separated list of `shutdown`, `sleep`, `idle`, `handle-power-key`, `handle-suspend-key`, `handle-hibernate-key`, `handle-lid-switch`. The list is basically the union of the What fields of all currently active locks of the specific mode.
**InhibitDelayMaxUSec** contains the delay timeout value as configured in [logind.conf(5)](http://www.freedesktop.org/software/systemd/man/logind.conf.html).
-The **PreparingForShutdown** and **PreparingForSleep** boolean properties are true between the two PrepareForShutdown() resp PrepareForSleep() signals that are sent out. Note that these properties do not trigger PropertyChanged signals.
+The **PreparingForShutdown** and **PreparingForSleep** boolean properties are true between the two PrepareForShutdown() resp PrepareForSleep() signals that are sent out.
+Note that these properties do not trigger PropertyChanged signals.
## Taking Blocking Locks
@@ -141,7 +170,17 @@ onPrepareForSleep(bool b) {
## Taking Key Handling Locks
-By default logind will handle the power and sleep keys of the machine, as well as the lid switch in all states. This ensures that this basic system behavior is guaranteed to work in all circumstances, on text consoles as well as on all graphical environments. However, some DE might want to do their own handling of these keys, for example in order to show a pretty dialog box before executing the relevant operation, or to simply disable the action under certain conditions. For these cases the handle-power-key, handle-suspend-key, handle-hibernate-key and handle-lid-switch type inhibitor locks are available. When taken, these locks simply disable the low-level handling of the keys, they have no effect on system suspend/hibernate/poweroff executed with other mechanisms than the hardware keys (such as the user typing "systemctl suspend" in a shell). A DE intending to do its own handling of these keys should simply take the locks at login time, and release them on logout; alternatively it might make sense to take this lock only temporarily under certain circumstances (e.g. take the lid switch lock only when a second monitor is plugged in, in order to support the common setup where people close their laptops when they have the big screen connected).
+By default logind will handle the power and sleep keys of the machine, as well as the lid switch in all states.
+
+This ensures that this basic system behavior is guaranteed to work in all circumstances, on text consoles as well as on all graphical environments.
+
+However, some DE might want to do their own handling of these keys, for example in order to show a pretty dialog box before executing the relevant operation, or to simply disable the action under certain conditions.
+For these cases the handle-power-key, handle-suspend-key, handle-hibernate-key and handle-lid-switch type inhibitor locks are available.
+
+When taken, these locks simply disable the low-level handling of the keys, they have no effect on system suspend/hibernate/poweroff executed with other mechanisms than the hardware keys (such as the user typing "systemctl suspend" in a shell).
+
+A DE intending to do its own handling of these keys should simply take the locks at login time, and release them on logout; alternatively it might make sense to take this lock only temporarily under certain circumstances
+(e.g. take the lid switch lock only when a second monitor is plugged in, in order to support the common setup where people close their laptops when they have the big screen connected).
These locks need to be taken in the "block" mode, "delay" is not supported for them.
@@ -149,12 +188,27 @@ If a DE wants to ensure the lock screen for the eventual resume is on the screen
## Miscellanea
-Taking inhibitor locks is a privileged operation. Depending on the action _org.freedesktop.login1.inhibit-block-shutdown_, _org.freedesktop.login1.inhibit-delay-shutdown_, _org.freedesktop.login1.inhibit-block-sleep_, _org.freedesktop.login1.inhibit-delay-sleep_, _org.freedesktop.login1.inhibit-block-idle_, _org.freedesktop.login1.inhibit-handle-power-key_, _org.freedesktop.login1.inhibit-handle-suspend-key_, _org.freedesktop.login1.inhibit-handle-hibernate-key_,_org.freedesktop.login1.inhibit-handle-lid-switch_. In general it should be assumed that delay locks are easier to obtain than blocking locks, simply because their impact is much more minimal. Note that the policy checks for Inhibit() are never interactive.
+Taking inhibitor locks is a privileged operation. Depending on the action _org.freedesktop.login1.inhibit-block-shutdown_, _org.freedesktop.login1.inhibit-delay-shutdown_, _org.freedesktop.login1.inhibit-block-sleep_, _org.freedesktop.login1.inhibit-delay-sleep_, _org.freedesktop.login1.inhibit-block-idle_, _org.freedesktop.login1.inhibit-handle-power-key_, _org.freedesktop.login1.inhibit-handle-suspend-key_, _org.freedesktop.login1.inhibit-handle-hibernate-key_,_org.freedesktop.login1.inhibit-handle-lid-switch_.
+
+In general it should be assumed that delay locks are easier to obtain than blocking locks, simply because their impact is much more minimal.
+Note that the policy checks for Inhibit() are never interactive.
-Inhibitor locks should not be misused. For example taking idle blocking locks without a very good reason might cause mobile devices to never auto-suspend. This can be quite detrimental for the battery.
+Inhibitor locks should not be misused.
+For example taking idle blocking locks without a very good reason might cause mobile devices to never auto-suspend.
+This can be quite detrimental for the battery.
If an application finds a lock denied it should not consider this much of an error and just continue its operation without the protecting lock.
The tool [systemd-inhibit(1)](http://www.freedesktop.org/software/systemd/man/systemd-inhibit.html) may be used to take locks or list active locks from the command line.
-Note that gnome-session also provides an [inhibitor API](http://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html#org.gnome.SessionManager.Inhibit), which is very similar to the one of systemd. Internally, locks taken on gnome-session's interface will be forwarded to logind, hence both APIs are supported. While both offer similar functionality they do differ in some regards. For obvious reasons gnome-session can offer logout locks and screensaver avoidance locks which logind lacks. logind's API OTOH supports delay locks in addition to block locks like GNOME. Also, logind is available to system components, and centralizes locks from all users, not just those of a specific one. In general: if in doubt it is probably advisable to stick to the GNOME locks, unless there is a good reason to use the logind APIs directly. When locks are to be enumerated it is better to use the logind APIs however, since they also include locks taken by system services and other users.
+Note that gnome-session also provides an [inhibitor API](http://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html#org.gnome.SessionManager.Inhibit), which is very similar to the one of systemd.
+Internally, locks taken on gnome-session's interface will be forwarded to logind, hence both APIs are supported.
+
+While both offer similar functionality they do differ in some regards.
+For obvious reasons gnome-session can offer logout locks and screensaver avoidance locks which logind lacks.
+
+logind's API OTOH supports delay locks in addition to block locks like GNOME.
+Also, logind is available to system components, and centralizes locks from all users, not just those of a specific one.
+
+In general: if in doubt it is probably advisable to stick to the GNOME locks, unless there is a good reason to use the logind APIs directly.
+When locks are to be enumerated it is better to use the logind APIs however, since they also include locks taken by system services and other users.
diff --git a/docs/INITRD_INTERFACE.md b/docs/INITRD_INTERFACE.md
index 0461ae2..402b6a9 100644
--- a/docs/INITRD_INTERFACE.md
+++ b/docs/INITRD_INTERFACE.md
@@ -26,8 +26,7 @@ Arch Linux initrds.
* It's highly recommended that the initrd also mounts `/usr/` (if split off) as
appropriate and passes it pre-mounted to the main system, to avoid the
- problems described in [Booting without /usr is
- Broken](https://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken).
+ problems described in [Booting without /usr is Broken](/SEPARATE_USR_IS_BROKEN).
* If the executable `/run/initramfs/shutdown` exists systemd will use it to
jump back into the initrd on shutdown. `/run/initramfs/` should be a usable
@@ -36,11 +35,11 @@ Arch Linux initrds.
example was needed to mount the root file system. It's the job of the initrd
to set up this directory and executable in the right way so that this works
correctly. The shutdown binary is invoked with the shutdown verb as `argv[1]`,
- optionally followed (in `argv[2]`, `argv[3]`, … systemd's original command
+ optionally followed (in `argv[2]`, `argv[3]`, …) systemd's original command
line options, for example `--log-level=` and similar.
* Storage daemons run from the initrd should follow the guide on
- [systemd and Storage Daemons for the Root File System](ROOT_STORAGE_DAEMONS)
+ [systemd and Storage Daemons for the Root File System](/ROOT_STORAGE_DAEMONS)
to survive properly from the boot initrd all the way to the point where
systemd jumps back into the initrd for shutdown.
@@ -67,4 +66,4 @@ systemd. Here are a few terse notes:
* The switch-root operation will result in a killing spree of all running
processes. Some processes might need to be excluded from that, see the guide
- on [systemd and Storage Daemons for the Root File System](ROOT_STORAGE_DAEMONS).
+ on [systemd and Storage Daemons for the Root File System](/ROOT_STORAGE_DAEMONS).
diff --git a/docs/JOURNAL_EXPORT_FORMATS.md b/docs/JOURNAL_EXPORT_FORMATS.md
index e1eb0d3..0da5252 100644
--- a/docs/JOURNAL_EXPORT_FORMATS.md
+++ b/docs/JOURNAL_EXPORT_FORMATS.md
@@ -11,16 +11,28 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_Note that this document describes the binary serialization format of journals only, as used for transfer across the network.
For interfacing with web technologies there's the Journal JSON Format, described below.
-The binary format on disk is documented as the [Journal File Format](JOURNAL_FILE_FORMAT)._
+The binary format on disk is documented as the [Journal File Format](/JOURNAL_FILE_FORMAT)._
_Before reading on, please make sure you are aware of the [basic properties of journal entries](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html), in particular realize that they may include binary non-text data (though usually don't), and the same field might have multiple values assigned within the same entry (though usually hasn't)._
-When exporting journal data for other uses or transferring it via the network/local IPC the _journal export format_ is used. It's a simple serialization of journal entries, that is easy to read without any special tools, but still binary safe where necessary. The format is like this:
+When exporting journal data for other uses or transferring it via the network/local IPC the _journal export format_ is used.
+It's a simple serialization of journal entries, that is easy to read without any special tools, but still binary safe where necessary.
+The format is like this:
* Two journal entries that follow each other are separated by a double newline.
-* Journal fields consisting only of valid non-control UTF-8 codepoints are serialized as they are (i.e. the field name, followed by '=', followed by field data), followed by a newline as separator to the next field. Note that fields containing newlines cannot be formatted like this. Non-control UTF-8 codepoints are the codepoints with value at or above 32 (' '), or equal to 9 (TAB).
-* Other journal fields are serialized in a special binary safe way: field name, followed by newline, followed by a binary 64-bit little endian size value, followed by the binary field data, followed by a newline as separator to the next field.
-* Entry metadata that is not actually a field is serialized like it was a field, but beginning with two underscores. More specifically, `__CURSOR=`, `__REALTIME_TIMESTAMP=`, `__MONOTONIC_TIMESTAMP=`, `__SEQNUM=`, `__SEQNUM_ID` are introduced this way. Note that these meta-fields are only generated when actual journal files are serialized. They are omitted for entries that do not originate from a journal file (for example because they are transferred for the first time to be stored in one). Or in other words: if you are generating this format you shouldn't care about these special double-underscore fields. But you might find them usable when you deserialize the format generated by us. Additional fields prefixed with two underscores might be added later on, your parser should skip over the fields it does not know.
+* Journal fields consisting only of valid non-control UTF-8 codepoints are serialized as they are
+ (i.e. the field name, followed by '=', followed by field data), followed by a newline as separator to the next field.
+ Note that fields containing newlines cannot be formatted like this.
+ Non-control UTF-8 codepoints are the codepoints with value at or above 32 (' '), or equal to 9 (TAB).
+* Other journal fields are serialized in a special binary safe way:
+ field name, followed by newline, followed by a binary 64-bit little endian size value, followed by the binary field data, followed by a newline as separator to the next field.
+* Entry metadata that is not actually a field is serialized like it was a field, but beginning with two underscores.
+ More specifically, `__CURSOR=`, `__REALTIME_TIMESTAMP=`, `__MONOTONIC_TIMESTAMP=`, `__SEQNUM=`, `__SEQNUM_ID` are introduced this way.
+ Note that these meta-fields are only generated when actual journal files are serialized.
+ They are omitted for entries that do not originate from a journal file (for example because they are transferred for the first time to be stored in one).
+ Or in other words: if you are generating this format you shouldn't care about these special double-underscore fields.
+ But you might find them usable when you deserialize the format generated by us.
+ Additional fields prefixed with two underscores might be added later on, your parser should skip over the fields it does not know.
* The order in which fields appear in an entry is undefined and might be different for each entry that is serialized.
And that's already it.
@@ -124,16 +136,24 @@ _SOURCE_REALTIME_TIMESTAMP=1423944916372858
_Note that this section describes the JSON serialization format of the journal only, as used for interfacing with web technologies.
For binary transfer of journal data across the network there's the Journal Export Format described above.
-The binary format on disk is documented as [Journal File Format](JOURNAL_FILE_FORMAT)._
+The binary format on disk is documented as [Journal File Format](/JOURNAL_FILE_FORMAT)._
_Before reading on, please make sure you are aware of the [basic properties of journal entries](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html), in particular realize that they may include binary non-text data (though usually don't), and the same field might have multiple values assigned within the same entry (though usually hasn't)._
In most cases the Journal JSON serialization is the obvious mapping of the entry field names (as JSON strings) to the entry field values (also as JSON strings) encapsulated in one JSON object. However, there are a few special cases to handle:
-* A field that contains non-printable or non-UTF8 is serialized as a number array instead. This is necessary to handle binary data in a safe way without losing data, since JSON cannot embed binary data natively. Each byte of the binary field will be mapped to its numeric value in the range 0…255.
-* The JSON serializer can optionally skip huge (as in larger than a specific threshold) data fields from the JSON object. If that is enabled and a data field is too large, the field name is still included in the JSON object but assigned _null_.
-* Within the same entry, Journal fields may have multiple values assigned. This is not allowed in JSON. The serializer will hence create a single JSON field only for these cases, and assign it an array of values (which the can be strings, _null_ or number arrays, see above).
-* If the JSON data originates from a journal file it may include the special addressing fields `__CURSOR`, `__REALTIME_TIMESTAMP`, `__MONOTONIC_TIMESTAMP`, `__SEQNUM`, `__SEQNUM_ID`, which contain the cursor string of this entry as string, the realtime/monotonic timestamps of this entry as formatted numeric string of usec since the respective epoch, and the sequence number and associated sequence number ID, both formatted as strings.
+* A field that contains non-printable or non-UTF8 is serialized as a number array instead.
+ This is necessary to handle binary data in a safe way without losing data, since JSON cannot embed binary data natively.
+ Each byte of the binary field will be mapped to its numeric value in the range 0…255.
+* The JSON serializer can optionally skip huge (as in larger than a specific threshold) data fields from the JSON object.
+ If that is enabled and a data field is too large, the field name is still included in the JSON object but assigned _null_.
+* Within the same entry, Journal fields may have multiple values assigned. This is not allowed in JSON.
+ The serializer will hence create a single JSON field only for these cases, and assign it an array of values
+ (which the can be strings, _null_ or number arrays, see above).
+* If the JSON data originates from a journal file it may include the special addressing fields
+ `__CURSOR`, `__REALTIME_TIMESTAMP`, `__MONOTONIC_TIMESTAMP`, `__SEQNUM`, `__SEQNUM_ID`, which contain the cursor string of this entry as string,
+ the realtime/monotonic timestamps of this entry as formatted numeric string of usec since the respective epoch,
+ and the sequence number and associated sequence number ID, both formatted as strings.
Here's an example, illustrating all cases mentioned above. Consider this entry:
diff --git a/docs/JOURNAL_FILE_FORMAT.md b/docs/JOURNAL_FILE_FORMAT.md
index e0737c5..7d3b039 100644
--- a/docs/JOURNAL_FILE_FORMAT.md
+++ b/docs/JOURNAL_FILE_FORMAT.md
@@ -8,8 +8,9 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Journal File Format
_Note that this document describes the binary on-disk format of journals only.
-For interfacing with web technologies there's the [Journal JSON Format](JOURNAL_EXPORT_FORMATS.md#journal-json-format).
-For transfer of journal data across the network there's the [Journal Export Format](JOURNAL_EXPORT_FORMATS.md#journal-export-format)._
+For interfacing with web technologies there's the [Journal JSON Format](JOURNAL_EXPORT_FORMATS#journal-json-format).
+For transfer of journal data across the network there's the
+[Journal Export Format](JOURNAL_EXPORT_FORMATS#journal-export-format)._
The systemd journal stores log data in a binary format with several features:
@@ -20,65 +21,62 @@ The systemd journal stores log data in a binary format with several features:
* Support for in-line compression
* Support for in-line Forward Secure Sealing
-This document explains the basic structure of the file format on disk. We are
-making this available primarily to allow review and provide documentation. Note
-that the actual implementation in the [systemd
-codebase](https://github.com/systemd/systemd/blob/main/src/libsystemd/sd-journal/) is the
-only ultimately authoritative description of the format, so if this document
-and the code disagree, the code is right. That said we'll of course try hard to
-keep this document up-to-date and accurate.
-
-Instead of implementing your own reader or writer for journal files we ask you
-to use the [Journal's native C
-API](https://www.freedesktop.org/software/systemd/man/sd-journal.html) to access
-these files. It provides you with full access to the files, and will not
-withhold any data. If you find a limitation, please ping us and we might add
-some additional interfaces for you.
-
-If you need access to the raw journal data in serialized stream form without C
-API our recommendation is to make use of the [Journal Export
-Format](https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format), which you can
-get via `journalctl -o export` or via `systemd-journal-gatewayd`. The export
-format is much simpler to parse, but complete and accurate. Due to its
-stream-based nature it is not indexed.
-
-_Or, to put this in other words: this low-level document is probably not what
-you want to use as base of your project. You want our [C
-API](https://www.freedesktop.org/software/systemd/man/sd-journal.html) instead!
+This document explains the basic structure of the file format on disk.
+We are making this available primarily to allow review and provide documentation.
+Note that the actual implementation in the
+[systemd codebase](https://github.com/systemd/systemd/blob/main/src/libsystemd/sd-journal/)
+is the only ultimately authoritative description of the format,
+so if this document and the code disagree, the code is right.
+That said we'll of course try hard to keep this document up-to-date and accurate.
+
+Instead of implementing your own reader or writer for journal files we ask you to use the
+[Journal's native CAPI](https://www.freedesktop.org/software/systemd/man/sd-journal.html)
+to access these files.
+It provides you with full access to the files, and will not withhold any data.
+If you find a limitation, please ping us and we might add some additional interfaces for you.
+
+If you need access to the raw journal data in serialized stream form without C API our recommendation is to make use of the
+[Journal Export Format](JOURNAL_EXPORT_FORMATS#journal-export-format),
+which you can get via `journalctl -o export` or via `systemd-journal-gatewayd`.
+The export format is much simpler to parse, but complete and accurate.
+Due to its stream-based nature it is not indexed.
+
+_Or, to put this in other words: this low-level document is probably not what you want to use as base of your project.
+You want our [C API](https://www.freedesktop.org/software/systemd/man/sd-journal.html) instead!
And if you really don't want the C API, then you want the
-[Journal Export Format or Journal JSON Format](JOURNAL_EXPORT_FORMATS)
-instead! This document is primarily for your entertainment and education.
+[Journal Export Format or Journal JSON Format](/JOURNAL_EXPORT_FORMATS) instead!
+This document is primarily for your entertainment and education.
Thank you!_
-This document assumes you have a basic understanding of the journal concepts,
-the properties of a journal entry and so on. If not, please go and read up,
-then come back! This is a good opportunity to read about the [basic properties
-of journal
-entries](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html),
-in particular realize that they may include binary non-text data (though
-usually don't), and the same field might have multiple values assigned within
-the same entry.
-
-This document describes the current format of systemd 246. The documented
-format is compatible with the format used in the first versions of the journal,
+This document assumes you have a basic understanding of the journal concepts, the properties of a journal entry and so on.
+If not, please go and read up, then come back!
+This is a good opportunity to read about the
+[basic properties of journal entries](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html),
+in particular realize that they may include binary non-text data (though usually don't),
+and the same field might have multiple values assigned within the same entry.
+
+This document describes the current format of systemd 246.
+The documented format is compatible with the format used in the first versions of the journal,
but received various compatible and incompatible additions since.
-If you are wondering why the journal file format has been created in the first
-place instead of adopting an existing database implementation, please have a
-look [at this
-thread](https://lists.freedesktop.org/archives/systemd-devel/2012-October/007054.html).
+If you are wondering why the journal file format has been created in the first place instead of adopting an existing database implementation,
+please have a look [at this thread](https://lists.freedesktop.org/archives/systemd-devel/2012-October/007054.html).
## Basics
* All offsets, sizes, time values, hashes (and most other numeric values) are 32-bit/64-bit unsigned integers in LE format.
* Offsets are always relative to the beginning of the file.
-* The 64-bit hash function siphash24 is used for newer journal files. For older files [Jenkins lookup3](https://en.wikipedia.org/wiki/Jenkins_hash_function) is used, more specifically `jenkins_hashlittle2()` with the first 32-bit integer it returns as higher 32-bit part of the 64-bit value, and the second one uses as lower 32-bit part.
+* The 64-bit hash function siphash24 is used for newer journal files.
+ For older files [Jenkins lookup3](https://en.wikipedia.org/wiki/Jenkins_hash_function) is used,
+ more specifically `jenkins_hashlittle2()` with the first 32-bit integer it returns as higher 32-bit part of the 64-bit value,
+ and the second one uses as lower 32-bit part.
* All structures are aligned to 64-bit boundaries and padded to multiples of 64-bit
* The format is designed to be read and written via memory mapping using multiple mapped windows.
* All time values are stored in usec since the respective epoch.
* Wall clock time values are relative to the Unix time epoch, i.e. January 1st, 1970. (`CLOCK_REALTIME`)
-* Monotonic time values are always stored jointly with the kernel boot ID value (i.e. `/proc/sys/kernel/random/boot_id`) they belong to. They tend to be relative to the start of the boot, but aren't for containers. (`CLOCK_MONOTONIC`)
+* Monotonic time values are always stored jointly with the kernel boot ID value (i.e. `/proc/sys/kernel/random/boot_id`) they belong to.
+ They tend to be relative to the start of the boot, but aren't for containers. (`CLOCK_MONOTONIC`)
* Randomized, unique 128-bit IDs are used in various locations. These are generally UUID v4 compatible, but this is not a requirement.
## General Rules
diff --git a/docs/MINIMAL_BUILDS.md b/docs/MINIMAL_BUILDS.md
index faa4f2d..1fc85e7 100644
--- a/docs/MINIMAL_BUILDS.md
+++ b/docs/MINIMAL_BUILDS.md
@@ -7,12 +7,21 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Minimal Builds
-systemd includes a variety of components. The core components are always built (which includes systemd itself, as well as udevd and journald). Many of the other components can be disabled at compile time with configure switches.
+systemd includes a variety of components.
+The core components are always built (which includes systemd itself, as well as udevd and journald).
+Many of the other components can be disabled at compile time with configure switches.
-For some uses the configure switches do not provide sufficient modularity. For example, they cannot be used to build only the man pages, or to build only the tmpfiles tool, only detect-virt or only udevd. If such modularity is required that goes beyond what we support in the configure script we can suggest you two options:
+For some uses the configure switches do not provide sufficient modularity.
+For example, they cannot be used to build only the man pages, or to build only the tmpfiles tool, only detect-virt or only udevd.
+
+If such modularity is required that goes beyond what we support in the configure script we can suggest you two options:
+
+1. Build systemd as usual, but pick only the built files you need from the result of "make install DESTDIR=<directory>", by using the file listing functionality of your packaging software.
+For example: if all you want is the tmpfiles tool, then build systemd normally, and list only /usr/bin/systemd-tmpfiles in the .spec file for your RPM package.
+This is simple to do, allows you to pick exactly what you need, but requires a larger number of build dependencies (but not runtime dependencies).
-1. Build systemd as usual, but pick only the built files you need from the result of "make install DESTDIR=<directory>", by using the file listing functionality of your packaging software. For example: if all you want is the tmpfiles tool, then build systemd normally, and list only /usr/bin/systemd-tmpfiles in the .spec file for your RPM package. This is simple to do, allows you to pick exactly what you need, but requires a larger number of build dependencies (but not runtime dependencies).
2. If you want to reduce the build time dependencies (though only dbus and libcap are needed as build time deps) and you know the specific component you are interested in doesn't need it, then create a dummy .pc file for that dependency (i.e. basically empty), and configure systemd with PKG_CONFIG_PATH set to the path of these dummy .pc files. Then, build only the few bits you need with "make foobar", where foobar is the file you need.
- We are open to merging patches for the build system that make more "fringe" components of systemd optional. However, please be aware that in order to keep the complexity of our build system small and its readability high, and to make our lives easier, we will not accept patches that make the minimal core components optional, i.e. systemd itself, journald and udevd.
-Note that the .pc file trick mentioned above currently doesn't work for libcap, since libcap doesn't provide a .pc file. We invite you to go ahead and post a patch to libcap upstream to get this corrected. We'll happily change our build system to look for that .pc file then. (a .pc file has been sent to upstream by Bryan Kadzban. It is also available at [http://kdzbn.homelinux.net/libcap-add-pkg-config.patch](http://kdzbn.homelinux.net/libcap-add-pkg-config.patch)).
+We are open to merging patches for the build system that make more "fringe" components of systemd optional. However, please be aware that in order to keep the complexity of our build system small and its readability high, and to make our lives easier, we will not accept patches that make the minimal core components optional, i.e. systemd itself, journald and udevd.
+
+Note that the .pc file trick mentioned above currently doesn't work for libcap, since libcap doesn't provide a .pc file. We invite you to go ahead and post a patch to libcap upstream to get this corrected. We'll happily change our build system to look for that .pc file then. (a .pc file has been sent to upstream by Bryan Kadzban).
diff --git a/docs/MY_SERVICE_CANT_GET_REATLIME.md b/docs/MY_SERVICE_CANT_GET_REATLIME.md
index 20d31fb..26a2e6e 100644
--- a/docs/MY_SERVICE_CANT_GET_REATLIME.md
+++ b/docs/MY_SERVICE_CANT_GET_REATLIME.md
@@ -7,22 +7,49 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# My Service Can't Get Realtime!
-_So, you have a service that requires real-time scheduling. When you run this service on your systemd system it is unable to acquire real-time scheduling, even though it is full root and has all possible privileges. And now you are wondering what is going on and what you can do about it?_
+_So, you have a service that requires real-time scheduling.
+When you run this service on your systemd system it is unable to acquire real-time scheduling,
+even though it is full root and has all possible privileges.
+And now you are wondering what is going on and what you can do about it?_
## What is Going on?
-By default systemd places all system services into their own control groups in the "cpu" hierarchy. This has the benefit that the CPU usage of services with many worker threads or processes (think: Apache with all its gazillion CGIs and stuff) gets roughly the same amount of CPU as a service with very few worker threads (think: MySQL). Instead of evening out CPU _per process_ this will cause CPU to be evened out _per service_.
-
-Now, the "cpu" cgroup controller of the Linux kernel has one major shortcoming: if a cgroup is created it needs an explicit, absolute RT time budget assigned, or otherwise RT is not available to any process in the group, and an attempt to acquire it will fail with EPERM. systemd will not assign any RT time budgets to the "cpu" cgroups it creates, simply because there is no feasible way to do that, since the budget needs to be specified in absolute time units and comes from a fixed pool. Or in other words: we'd love to assign a budget, but there are no sane values we could use. Thus, in its default configuration RT scheduling is simply not available for any system services.
+By default systemd places all system services into their own control groups in the "cpu" hierarchy.
+This has the benefit that the CPU usage of services with many worker threads or processes
+(think: Apache with all its gazillion CGIs and stuff)
+gets roughly the same amount of CPU as a service with very few worker threads (think: MySQL).
+Instead of evening out CPU _per process_ this will cause CPU to be evened out _per service_.
+
+Now, the "cpu" cgroup controller of the Linux kernel has one major shortcoming:
+if a cgroup is created it needs an explicit, absolute RT time budget assigned,
+or otherwise RT is not available to any process in the group, and an attempt to acquire it will fail with EPERM.
+systemd will not assign any RT time budgets to the "cpu" cgroups it creates,
+simply because there is no feasible way to do that,
+since the budget needs to be specified in absolute time units and comes from a fixed pool.
+Or in other words: we'd love to assign a budget, but there are no sane values we could use.
+Thus, in its default configuration RT scheduling is simply not available for any system services.
## Working Around the Issue
Of course, that's quite a limitation, so here's how you work around this:
-* One option is to simply globally turn off that systemd creates a "cpu" cgroup for each of the system services. For that, edit `/etc/systemd/system.conf` and set `DefaultControllers=` to the empty string, then reboot. (An alternative is to disable the "cpu" controller in your kernel, entirely. systemd will not attempt to make use of controllers that aren't available in the kernel.)
-* Another option is to turn this off for the specific service only. For that, edit your service file, and add `ControlGroup=cpu:/` to its `[Service]` section. This overrides the default logic for this one service only, and places all its processes back in the root cgroup of the "cpu" hierarchy, which has the full RT budget assigned.
-* A third option is to simply assign your service a realtime budget. For that use `ControlGroupAttribute=cpu.rt_runtime_us 500000` in its `[Service]` or suchlike. See [the kernel documentation](http://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt) for details. The latter two options are not available for System V services. A possible solution is to write a small wrapper service file that simply calls the SysV script's start verb in `ExecStart=` and the stop verb in `ExecStop=`. (It also needs to set `RemainAfterExit=1` and `Type=forking`!)
-
-Note that this all only applies to services. By default, user applications run in the root cgroup of the "cpu" hierarchy, which avoids these problems for normal user applications.
-
-In the long run we hope that the kernel is fixed to not require an RT budget to be assigned for any cgroup created before a process can acquire RT (i.e. a process' RT budget should be derived from the nearest ancestor cgroup which has a budget assigned, rather than unconditionally its own uninitialized budget.) Ideally, we'd also like to create a per-user cgroup by default, so that users with many processes get roughly the same amount of CPU as users with very few.
+* One option is to simply globally turn off that systemd creates a "cpu" cgroup for each of the system services.
+For that, edit `/etc/systemd/system.conf` and set `DefaultControllers=` to the empty string, then reboot.
+(An alternative is to disable the "cpu" controller in your kernel, entirely.
+systemd will not attempt to make use of controllers that aren't available in the kernel.)
+* Another option is to turn this off for the specific service only.
+For that, edit your service file, and add `ControlGroup=cpu:/` to its `[Service]` section.
+This overrides the default logic for this one service only,
+and places all its processes back in the root cgroup of the "cpu" hierarchy, which has the full RT budget assigned.
+* A third option is to simply assign your service a realtime budget.
+For that use `ControlGroupAttribute=cpu.rt_runtime_us 500000` in its `[Service]` or suchlike.
+See [the kernel documentation](http://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt) for details.
+The latter two options are not available for System V services.
+A possible solution is to write a small wrapper service file that simply calls the SysV script's start verb in `ExecStart=` and the stop verb in `ExecStop=`.
+(It also needs to set `RemainAfterExit=1` and `Type=forking`!)
+
+Note that this all only applies to services.
+By default, user applications run in the root cgroup of the "cpu" hierarchy, which avoids these problems for normal user applications.
+
+In the long run we hope that the kernel is fixed to not require an RT budget to be assigned for any cgroup created before a process can acquire RT (i.e. a process' RT budget should be derived from the nearest ancestor cgroup which has a budget assigned, rather than unconditionally its own uninitialized budget.)
+Ideally, we'd also like to create a per-user cgroup by default, so that users with many processes get roughly the same amount of CPU as users with very few.
diff --git a/docs/OPTIMIZATIONS.md b/docs/OPTIMIZATIONS.md
index 3c8ac48..d63d09e 100644
--- a/docs/OPTIMIZATIONS.md
+++ b/docs/OPTIMIZATIONS.md
@@ -9,44 +9,123 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_So you are working on a Linux distribution or appliance and need very fast boot-ups?_
-systemd can already offer boot times of < 1s for the Core OS (userspace only, i.e. only the bits controlled by systemd) and < 2s for a complete up-to-date desktop environments on simpler (but modern, i.e. SSDs) laptops if configured properly (examples: [http://git.fenrus.org/tmp/bootchart-20120512-1036.svg](http://git.fenrus.org/tmp/bootchart-20120512-1036.svg)). In this page we want to suggest a couple of ideas how to achieve that, and if the resulting boot times do not suffice where we believe room for improvements are that we'd like to see implemented sooner or later. If you are interested in investing engineering manpower in systemd to get to even shorter boot times, this list hopefully includes a few good suggestions to start with.
+systemd can already offer boot times of < 1s for the Core OS (userspace only, i.e. only the bits controlled by systemd) and < 2s for a complete up-to-date desktop environments on simpler (but modern, i.e. SSDs) laptops if configured properly (examples: [http://git.fenrus.org/tmp/bootchart-20120512-1036.svg](http://git.fenrus.org/tmp/bootchart-20120512-1036.svg)).
+
+In this page we want to suggest a couple of ideas how to achieve that, and if the resulting boot times do not suffice where we believe room for improvements are that we'd like to see implemented sooner or later.
+
+If you are interested in investing engineering manpower in systemd to get to even shorter boot times, this list hopefully includes a few good suggestions to start with.
Of course, before optimizing you should instrument the boot to generate profiling data, so make sure you know your way around with systemd-bootchart, systemd-analyze and pytimechart! Optimizations without profiling are premature optimizations!
-Note that systemd's fast performance is a side effect of its design but wasn't the primary design goal. As it stands now systemd (and Fedora using it) has been optimized very little and still has a lot of room for improvements. There are still many low hanging fruits to pick!
+Note that systemd's fast performance is a side effect of its design but wasn't the primary design goal.
+As it stands now systemd (and Fedora using it) has been optimized very little and still has a lot of room for improvements. There are still many low hanging fruits to pick!
-We are very interested in merging optimization work into systemd upstream. Note however that we are careful not to merge work that would drastically limit the general purpose usefulness or reliability of our code, or that would make systemd harder to maintain. So in case you work on optimizations for systemd, try to keep your stuff mainlineable. If in doubt, ask us.
+We are very interested in merging optimization work into systemd upstream.
+Note however that we are careful not to merge work that would drastically limit the general purpose usefulness or reliability of our code, or that would make systemd harder to maintain.
+So in case you work on optimizations for systemd, try to keep your stuff mainlineable. If in doubt, ask us.
-The distributions have adopted systemd to varying levels. While there are many compatibility scripts in the boot process on Debian for example, Fedora has much less (but still too many). For better performance consider disabling these scripts, or using a different distribution.
+The distributions have adopted systemd to varying levels.
+While there are many compatibility scripts in the boot process on Debian for example, Fedora has much less (but still too many).
+For better performance consider disabling these scripts, or using a different distribution.
It is our intention to optimize the upstream distributions by default (in particular Fedora) so that these optimizations won't be necessary. However, this will take some time, especially since making these changes is often not trivial when the general purpose usefulness cannot be compromised.
What you can optimize (locally) without writing any code:
-1. Make sure not to use any fake block device storage technology such as LVM (as installed by default by various distributions, including Fedora) they result in the systemd-udev-settle.service unit to be pulled in. Settling device enumeration is slow, racy and mostly obsolete. Since LVM (still) hasn't been updated to handle Linux' event based design properly, settling device enumeration is still required for it, but it will slow down boot substantially. On Fedora, use "systemctl mask fedora-wait-storage.service fedora-storage-init-late.service fedora-storage-init.service" to get rid of all those storage technologies. Of course, don't try this if you actually installed your system with LVM. (The only fake block device storage technology that currently handles this all properly and doesn't require settling device enumerations is LUKS disk encryption.)
-2. Consider bypassing the initrd, if you use one. On Fedora, make sure to install the OS on a plain disk without encryption, and without LVM/RAID/... (encrypted /home is fine) when doing this. Then, simply edit grub.conf and remove the initrd from your configuration, and change the root= kernel command line parameter so that it uses kernel device names instead of UUIDs, i.e. "root=sda5" or what is appropriate for your system. Also specify the root FS type with "rootfstype=ext4" (or as appropriate). Note that using kernel devices names is not really that nice if you have multiple hard disks, but if you are doing this for a laptop (i.e. with a single hdd), this should be fine. Note that you shouldn't need to rebuild your kernel in order to bypass the initrd. Distribution kernels (at least Fedora's) work fine with and without initrd, and systemd supports both ways to be started.
-3. Consider disabling SELinux and auditing. We recommend leaving SELinux on, for security reasons, but truth be told you can save 100ms of your boot if you disable it. Use selinux=0 on the kernel cmdline.
-4. Consider disabling Plymouth. If userspace boots in less than 1s, a boot splash is hardly useful, hence consider passing plymouth.enable=0 on the kernel command line. Plymouth is generally quite fast, but currently still forces settling device enumerations for graphics cards, which is slow. Disabling plymouth removes this bit of the boot.
-5. Consider uninstalling syslog. The journal is used anyway on newer systemd systems, and is usually more than sufficient for desktops, and embedded, and even many servers. Just uninstall all syslog implementations and remember that "journalctl" will get you a pixel perfect copy of the classic /var/log/messages message log. To make journal logs persistent (i.e. so that they aren't lost at boot) make sure to run "mkdir -p /var/log/journal".
-6. Consider masking a couple of redundant distribution boot scripts, that artificially slow down the boot. For example, on Fedora it's a good idea to mask fedora-autoswap.service fedora-configure.service fedora-loadmodules.service fedora-readonly.service. Also remove all LVM/RAID/FCOE/iSCSI related packages which slow down the boot substantially even if no storage of the specific kind is used (and if these RPMs can't be removed because some important packages require them, at least mask the respective services).
+1. Make sure not to use any fake block device storage technology such as LVM (as installed by default by various distributions, including Fedora) they result in the systemd-udev-settle.service unit to be pulled in. Settling device enumeration is slow, racy and mostly obsolete. Since LVM (still) hasn't been updated to handle Linux' event based design properly, settling device enumeration is still required for it, but it will slow down boot substantially.
+On Fedora, use "systemctl mask fedora-wait-storage.service fedora-storage-init-late.service fedora-storage-init.service" to get rid of all those storage technologies.
+Of course, don't try this if you actually installed your system with LVM. (The only fake block device storage technology that currently handles this all properly and doesn't require settling device enumerations is LUKS disk encryption.)
+
+2. Consider bypassing the initrd, if you use one.
+On Fedora, make sure to install the OS on a plain disk without encryption, and without LVM/RAID/... (encrypted /home is fine) when doing this.
+Then, simply edit grub.conf and remove the initrd from your configuration, and change the root= kernel command line parameter so that it uses kernel device names instead of UUIDs, i.e. "root=sda5" or what is appropriate for your system.
+Also specify the root FS type with "rootfstype=ext4" (or as appropriate).
+Note that using kernel devices names is not really that nice if you have multiple hard disks, but if you are doing this for a laptop (i.e. with a single hdd), this should be fine.
+Note that you shouldn't need to rebuild your kernel in order to bypass the initrd.
+Distribution kernels (at least Fedora's) work fine with and without initrd, and systemd supports both ways to be started.
+
+3. Consider disabling SELinux and auditing.
+We recommend leaving SELinux on, for security reasons, but truth be told you can save 100ms of your boot if you disable it.
+Use selinux=0 on the kernel cmdline.
+
+4. Consider disabling Plymouth. If userspace boots in less than 1s, a boot splash is hardly useful, hence consider passing plymouth.enable=0 on the kernel command line.
+Plymouth is generally quite fast, but currently still forces settling device enumerations for graphics cards, which is slow.
+Disabling plymouth removes this bit of the boot.
+
+5. Consider uninstalling syslog. The journal is used anyway on newer systemd systems, and is usually more than sufficient for desktops, and embedded, and even many servers.
+Just uninstall all syslog implementations and remember that "journalctl" will get you a pixel perfect copy of the classic /var/log/messages message log.
+To make journal logs persistent (i.e. so that they aren't lost at boot) make sure to run "mkdir -p /var/log/journal".
+
+6. Consider masking a couple of redundant distribution boot scripts, that artificially slow down the boot. For example, on Fedora it's a good idea to mask fedora-autoswap.service fedora-configure.service fedora-loadmodules.service fedora-readonly.service.
+Also remove all LVM/RAID/FCOE/iSCSI related packages which slow down the boot substantially even if no storage of the specific kind is used (and if these RPMs can't be removed because some important packages require them, at least mask the respective services).
+
7. Console output is slow. So if you measure your boot times and ship your system, make sure to use "quiet" on the command line and disable systemd debug logging (if you enabled it before).
-8. Consider removing cron from your system and use systemd timer units instead. Timer units currently have no support for calendar times (i.e. cannot be used to spawn things "at 6 am every Monday", but can do "run this every 7 days"), but for the usual /etc/cron.daily/, /etc/cron.weekly/, ... should be good enough, if the time of day of the execution doesn't matter (just add four small service and timer units for supporting these dirs. Eventually we might support these out of the box, but until then, just write your own scriplets for this).
+
+8. Consider removing cron from your system and use systemd timer units instead.
+Timer units currently have no support for calendar times (i.e. cannot be used to spawn things "at 6 am every Monday", but can do "run this every 7 days"), but for the usual /etc/cron.daily/, /etc/cron.weekly/, ... should be good enough, if the time of day of the execution doesn't matter (just add four small service and timer units for supporting these dirs. Eventually we might support these out of the box, but until then, just write your own scriplets for this).
+
9. If you work on an appliance, consider disabling readahead collection in the shipped devices, but leave readahead replay enabled.
-10. If you work on an appliance, make sure to build all drivers you need into the kernel, since module loading is slow. If you build a distribution at least built all the stuff 90% of all people need into your kernel, i.e. at least USB, AHCI and HDA!
+
+10. If you work on an appliance, make sure to build all drivers you need into the kernel, since module loading is slow.
+If you build a distribution at least built all the stuff 90% of all people need into your kernel, i.e. at least USB, AHCI and HDA!
+
11. If it works, use libahci.ignore_sss=1 when booting.
+
12. Use a modern desktop that doesn't pull in ConsoleKit anymore. For example GNOME 3.4.
-13. Get rid of a local MTA, if you are building a desktop or appliance. I.e. on Fedora remove the sendmail RPMs which are (still!) installed by default.
-14. If you build an appliance, don't forget that various components of systemd are optional and may be disabled during build time, see "./configure --help" for details. For example, get rid of the virtual console setup if you never have local console users (this is a major source of slowness, actually). In addition, if you never have local users at all, consider disabling logind. And there are more components that are frequently unnecessary on appliances.
-15. This goes without saying: the boot-up gets faster if you started less stuff at boot. So run "systemctl" and check if there's stuff you don't need and disable it, or even remove its package.
-16. Don't use debug kernels. Debug kernels are slow. Fedora exclusively uses debug kernels during the development phase of each release. If you care about boot performance, either recompile these kernels with debugging turned off or wait for the final distribution release. It's a drastic difference. That also means that if you publish boot performance data of a Fedora pre-release distribution you are doing something wrong. ;-) So much about the basics of how to get a quick boot. Now, here's an incomprehensive list of things we'd like to see improved in systemd (and elsewhere) over short or long and need a bit of hacking (sometimes more, and sometimes less):
-17. Get rid of systemd-cgroups-agent. Currently, whenever a systemd cgroup runs empty a tool "systemd-cgroups-agent" is invoked by the kernel which then notifies systemd about it. The need for this tool should really go away, which will save a number of forked processes at boot, and should make things faster (especially shutdown). This requires introduction of a new kernel interface to get notifications for cgroups running empty, for example via fanotify() on cgroupfs.
-18. Make use of EXT4_IOC_MOVE_EXT in systemd's readahead implementation. This allows reordering/defragmentation of the files needed for boot. According to the data from [http://e4rat.sourceforge.net/](http://e4rat.sourceforge.net/) this might shorten the boot time to 40%. Implementation is not trivial, but given that we already support btrfs defragmentation and example code for this exists (e4rat as linked) should be fairly straightforward.
-19. Compress readahead pack files with XZ or so. Since boot these days tends to be clearly IO bound (and not CPU bound) it might make sense to reduce the IO load for the pack file by compressing it. Since we already have a dependency on XZ we'd recommend using XZ for this.
-20. Update the readahead logic to also precache directories (in addition to files).
-21. Improve a couple of algorithms in the unit dependency graph calculation logic, as well as unit file loading. For example, right now when loading units we match them up with a subset of the other loaded units in order to add automatic dependencies between them where appropriate. Usually the set of units matched up is small, but the complexity is currently O(n^2), and this could be optimized. Since unit file loading and calculations in the dependency graphs is the only major, synchronous, computation-intensive bit of PID 1, and is executed before any services are started this should bring relevant improvements, especially on systems with big dependency graphs.
-22. Add socket activation to X. Due to the special socket allocation semantics of X this is useful only for display :0. This should allow parallelization of X startup with its clients.
-23. The usual housekeeping: get rid of shell-based services (i.e. SysV init scripts), replace them with unit files. Don't make use of Type=forking and ordering dependencies if possible, use socket activation with Type=simple instead. This allows drastically better parallelized start-up for your services. Also, if you cannot use socket activation, at least consider patching your services to support Type=notify in place of Type=forking. Consider making seldom used services activated on-demand (for example, printer services), and start frequently used services already at boot instead of delaying them until they are used.
-24. Consider making use of systemd for the session as well, the way Tizen is doing this. This still needs some love in systemd upstream to be a smooth ride, but we definitely would like to go this way sooner or later, even for the normal desktops.
-25. Add an option for service units to temporarily bump the CPU and IO priority of the startup code of important services. Note however, that we assume that this will not bring much and hence recommend looking into this only very late. Since boot-up tends to be IO bound, solutions such as readahead are probably more interesting than prioritizing service startup IO. Also, this would probably always require a certain amount of manual configuration since determining automatically which services are important is hard (if not impossible), because we cannot track properly which services other services wait for.
-26. Same as the previous item, but temporarily lower the CPU/IO priority of the startups part of unimportant leaf services. This is probably more useful than 11 as it is easier to determine which processes don't matter.
-27. Add a kernel sockopt for AF_UNIX to increase the maximum datagram queue length for SOCK_DGRAM sockets. This would allow us to queue substantially more logging datagrams in the syslog and journal sockets, and thus move the point where syslog/journal clients have to block before their message writes finish much later in the boot process. The current kernel default is rather low with 10. (As a temporary hack it is possible to increase /proc/sys/net/unix/max_dgram_qlen globally, but this has implications beyond systemd, and should probably be avoided.) The kernel patch to make this work is most likely trivial. In general, this should allow us to improve the level of parallelization between clients and servers for AF_UNIX sockets of type SOCK_DGRAM or SOCK_SEQPACKET. Again: the list above contains things we'd like to see in systemd anyway. We didn't do much profiling for these features, but we have enough indication to assume that these bits will bring some improvements. But yeah, if you work on this, keep your profiling tools ready at all times.
+
+14. Get rid of a local MTA, if you are building a desktop or appliance.
+I.e. on Fedora remove the sendmail RPMs which are (still!) installed by default.
+
+15. If you build an appliance, don't forget that various components of systemd are optional and may be disabled during build time, see "./configure --help" for details.
+For example, get rid of the virtual console setup if you never have local console users (this is a major source of slowness, actually).
+In addition, if you never have local users at all, consider disabling logind. And there are more components that are frequently unnecessary on appliances.
+
+16. This goes without saying: the boot-up gets faster if you started less stuff at boot.
+So run "systemctl" and check if there's stuff you don't need and disable it, or even remove its package.
+
+17. Don't use debug kernels. Debug kernels are slow.
+Fedora exclusively uses debug kernels during the development phase of each release.
+If you care about boot performance, either recompile these kernels with debugging turned off or wait for the final distribution release.
+It's a drastic difference. That also means that if you publish boot performance data of a Fedora pre-release distribution you are doing something wrong. ;-) So much about the basics of how to get a quick boot.
+Now, here's an incomprehensive list of things we'd like to see improved in systemd (and elsewhere) over short or long and need a bit of hacking (sometimes more, and sometimes less):
+
+18. Get rid of systemd-cgroups-agent.
+Currently, whenever a systemd cgroup runs empty a tool "systemd-cgroups-agent" is invoked by the kernel which then notifies systemd about it.
+The need for this tool should really go away, which will save a number of forked processes at boot, and should make things faster (especially shutdown).
+This requires introduction of a new kernel interface to get notifications for cgroups running empty, for example via fanotify() on cgroupfs.
+
+19. Make use of EXT4_IOC_MOVE_EXT in systemd's readahead implementation.
+This allows reordering/defragmentation of the files needed for boot.
+According to the data from [http://e4rat.sourceforge.net/](http://e4rat.sourceforge.net/) this might shorten the boot time to 40%.
+Implementation is not trivial, but given that we already support btrfs defragmentation and example code for this exists (e4rat as linked) should be fairly straightforward.
+
+20. Compress readahead pack files with XZ or so.Since boot these days tends to be clearly IO bound (and not CPU bound) it might make sense to reduce the IO load for the pack file by compressing it. Since we already have a dependency on XZ we'd recommend using XZ for this.
+
+21. Update the readahead logic to also precache directories (in addition to files).
+
+22. Improve a couple of algorithms in the unit dependency graph calculation logic, as well as unit file loading.
+For example, right now when loading units we match them up with a subset of the other loaded units in order to add automatic dependencies between them where appropriate.
+Usually the set of units matched up is small, but the complexity is currently O(n^2), and this could be optimized. Since unit file loading and calculations in the dependency graphs is the only major, synchronous, computation-intensive bit of PID 1, and is executed before any services are started this should bring relevant improvements, especially on systems with big dependency graphs.
+
+23. Add socket activation to X. Due to the special socket allocation semantics of X this is useful only for display :0. This should allow parallelization of X startup with its clients.
+
+24. The usual housekeeping: get rid of shell-based services (i.e. SysV init scripts), replace them with unit files.
+Don't make use of Type=forking and ordering dependencies if possible, use socket activation with Type=simple instead.
+This allows drastically better parallelized start-up for your services. Also, if you cannot use socket activation, at least consider patching your services to support Type=notify in place of Type=forking. Consider making seldom used services activated on-demand (for example, printer services), and start frequently used services already at boot instead of delaying them until they are used.
+
+25. Consider making use of systemd for the session as well, the way Tizen is doing this.
+This still needs some love in systemd upstream to be a smooth ride, but we definitely would like to go this way sooner or later, even for the normal desktops.
+
+26. Add an option for service units to temporarily bump the CPU and IO priority of the startup code of important services.
+Note however, that we assume that this will not bring much and hence recommend looking into this only very late.
+Since boot-up tends to be IO bound, solutions such as readahead are probably more interesting than prioritizing service startup IO. Also, this would probably always require a certain amount of manual configuration since determining automatically which services are important is hard (if not impossible), because we cannot track properly which services other services wait for.
+
+27. Same as the previous item, but temporarily lower the CPU/IO priority of the startups part of unimportant leaf services.
+This is probably more useful than 11 as it is easier to determine which processes don't matter.
+
+28. Add a kernel sockopt for AF_UNIX to increase the maximum datagram queue length for SOCK_DGRAM sockets.
+This would allow us to queue substantially more logging datagrams in the syslog and journal sockets, and thus move the point where syslog/journal clients have to block before their message writes finish much later in the boot process.
+The current kernel default is rather low with 10. (As a temporary hack it is possible to increase /proc/sys/net/unix/max_dgram_qlen globally, but this has implications beyond systemd, and should probably be avoided.) The kernel patch to make this work is most likely trivial.
+In general, this should allow us to improve the level of parallelization between clients and servers for AF_UNIX sockets of type SOCK_DGRAM or SOCK_SEQPACKET. Again: the list above contains things we'd like to see in systemd anyway.
+We didn't do much profiling for these features, but we have enough indication to assume that these bits will bring some improvements.
+But yeah, if you work on this, keep your profiling tools ready at all times.
diff --git a/docs/PASSWORD_AGENTS.md b/docs/PASSWORD_AGENTS.md
index 29bd949..297d8ea 100644
--- a/docs/PASSWORD_AGENTS.md
+++ b/docs/PASSWORD_AGENTS.md
@@ -7,11 +7,18 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Password Agents
-systemd 12 and newer support lightweight password agents which can be used to query the user for system-level passwords or passphrases. These are passphrases that are not related to a specific user, but to some kind of hardware or service. Right now this is used exclusively for encrypted hard-disk passphrases but later on this is likely to be used to query passphrases of SSL certificates at Apache startup time as well. The basic idea is that a system component requesting a password entry can simply drop a simple .ini-style file into `/run/systemd/ask-password` which multiple different agents may watch via `inotify()`, and query the user as necessary. The answer is then sent back to the querier via an `AF_UNIX`/`SOCK_DGRAM` socket. Multiple agents might be running at the same time in which case they all should query the user and the agent which answers first wins. Right now systemd ships with the following passphrase agents:
+systemd 12 and newer support lightweight password agents which can be used to query the user for system-level passwords or passphrases.
+These are passphrases that are not related to a specific user, but to some kind of hardware or service.
+Right now this is used exclusively for encrypted hard-disk passphrases but later on this is likely to be used to query passphrases of SSL certificates at Apache startup time as well.
+The basic idea is that a system component requesting a password entry can simply drop a simple .ini-style file into `/run/systemd/ask-password` which multiple different agents may watch via `inotify()`, and query the user as necessary.
+The answer is then sent back to the querier via an `AF_UNIX`/`SOCK_DGRAM` socket.
+Multiple agents might be running at the same time in which case they all should query the user and the agent which answers first wins.
+Right now systemd ships with the following passphrase agents:
* A Plymouth agent used for querying passwords during boot-up
* A console agent used in similar situations if Plymouth is not available
-* A GNOME agent which can be run as part of the normal user session which pops up a notification message and icon which when clicked receives the passphrase from the user. This is useful and necessary in case an encrypted system hard-disk is plugged in when the machine is already up.
+* A GNOME agent which can be run as part of the normal user session which pops up a notification message and icon which when clicked receives the passphrase from the user.
+ This is useful and necessary in case an encrypted system hard-disk is plugged in when the machine is already up.
* A [`wall(1)`](https://man7.org/linux/man-pages/man1/wall.1.html) agent which sends wall messages as soon as a password shall be entered.
* A simple tty agent which is built into "`systemctl start`" (and similar commands) and asks passwords to the user during manual startup of a service
* A simple tty agent which can be run manually to respond to all queued passwords
@@ -22,20 +29,36 @@ It is easy to write additional agents. The basic algorithm to follow looks like
* Ignore all events on files in that directory that do not start with "`ask.`"
* As soon as a file named "`ask.xxxx`" shows up, read it. It's a simple `.ini` file that may be parsed with the usual parsers. The `xxxx` suffix is randomized.
* Make sure to ignore unknown `.ini` file keys in those files, so that we can easily extend the format later on.
-* You'll find the question to ask the user in the `Message=` field in the `[Ask]` section. It is a single-line string in UTF-8, which might be internationalized (by the party that originally asks the question, not by the agent).
+* You'll find the question to ask the user in the `Message=` field in the `[Ask]` section.
+ It is a single-line string in UTF-8, which might be internationalized (by the party that originally asks the question, not by the agent).
* You'll find an icon name (following the XDG icon naming spec) to show next to the message in the `Icon=` field in the `[Ask]` section
-* You'll find the PID of the client asking the question in the `PID=` field in the `[Ask]` section (Before asking your question use `kill(PID, 0)` and ignore the file if this returns `ESRCH`; there's no need to show the data of this field but if you want to you may)
+* You'll find the PID of the client asking the question in the `PID=` field in the `[Ask]` section
+ (Before asking your question use `kill(PID, 0)` and ignore the file if this returns `ESRCH`;
+ there's no need to show the data of this field but if you want to you may)
* `Echo=` specifies whether the input should be obscured. If this field is missing or is `Echo=0`, the input should not be shown.
* The socket to send the response to is configured via `Socket=` in the `[Ask]` section. It is a `AF_UNIX`/`SOCK_DGRAM` socket in the file system.
-* Ignore files where the time specified in the `NotAfter=` field in the `[Ask]` section is in the past. The time is specified in usecs, and refers to the `CLOCK_MONOTONIC` clock. If `NotAfter=` is `0`, no such check should take place.
+* Ignore files where the time specified in the `NotAfter=` field in the `[Ask]` section is in the past.
+ The time is specified in usecs, and refers to the `CLOCK_MONOTONIC` clock. If `NotAfter=` is `0`, no such check should take place.
* Make sure to hide a password query dialog as soon as a) the `ask.xxxx` file is deleted, watch this with inotify. b) the `NotAfter=` time elapses, if it is set `!= 0`.
-* Access to the socket is restricted to privileged users. To acquire the necessary privileges to send the answer back, consider using PolicyKit. In fact, the GNOME agent we ship does that, and you may simply piggyback on that, by executing "`/usr/bin/pkexec /lib/systemd/systemd-reply-password 1 /path/to/socket`" or "`/usr/bin/pkexec /lib/systemd/systemd-reply-password 0 /path/to/socket`" and writing the password to its standard input. Use '`1`' as argument if a password was entered by the user, or '`0`' if the user canceled the request.
-* If you do not want to use PK ensure to acquire the necessary privileges in some other way and send a single datagram to the socket consisting of the password string either prefixed with "`+`" or with "`-`" depending on whether the password entry was successful or not. You may but don't have to include a final `NUL` byte in your message.
+* Access to the socket is restricted to privileged users.
+ To acquire the necessary privileges to send the answer back, consider using PolicyKit.
+ In fact, the GNOME agent we ship does that, and you may simply piggyback on that, by executing "`/usr/bin/pkexec /lib/systemd/systemd-reply-password 1 /path/to/socket`" or "`/usr/bin/pkexec /lib/systemd/systemd-reply-password 0 /path/to/socket`" and writing the password to its standard input.
+ Use '`1`' as argument if a password was entered by the user, or '`0`' if the user canceled the request.
+* If you do not want to use PK ensure to acquire the necessary privileges in some other way and send a single datagram
+ to the socket consisting of the password string either prefixed with "`+`" or with "`-`" depending on whether the password entry was successful or not.
+ You may but don't have to include a final `NUL` byte in your message.
Again, it is essential that you stop showing the password box/notification/status icon if the `ask.xxx` file is removed or when `NotAfter=` elapses (if it is set `!= 0`)!
-It may happen that multiple password entries are pending at the same time. Your agent needs to be able to deal with that. Depending on your environment you may either choose to show all outstanding passwords at the same time or instead only one and as soon as the user has replied to that one go on to the next one.
+It may happen that multiple password entries are pending at the same time.
+Your agent needs to be able to deal with that. Depending on your environment you may either choose to show all outstanding passwords at the same time or instead only one and as soon as the user has replied to that one go on to the next one.
-You may test this all with manually invoking the "`systemd-ask-password`" tool on the command line. Pass `--no-tty` to ensure the password is asked via the agent system. Note that only privileged users may use this tool (after all this is intended purely for system-level passwords).
+You may test this all with manually invoking the "`systemd-ask-password`" tool on the command line.
+Pass `--no-tty` to ensure the password is asked via the agent system.
+Note that only privileged users may use this tool (after all this is intended purely for system-level passwords).
-If you write a system level agent a smart way to activate it is using systemd `.path` units. This will ensure that systemd will watch the `/run/systemd/ask-password` directory and spawn the agent as soon as that directory becomes non-empty. In fact, the console, wall and Plymouth agents are started like this. If systemd is used to maintain user sessions as well you can use a similar scheme to automatically spawn your user password agent as well. (As of this moment we have not switched any DE over to use systemd for session management, however.)
+If you write a system level agent a smart way to activate it is using systemd `.path` units.
+This will ensure that systemd will watch the `/run/systemd/ask-password` directory and spawn the agent as soon as that directory becomes non-empty.
+In fact, the console, wall and Plymouth agents are started like this.
+If systemd is used to maintain user sessions as well you can use a similar scheme to automatically spawn your user password agent as well.
+(As of this moment we have not switched any DE over to use systemd for session management, however.)
diff --git a/docs/PAX_CONTROL_GROUPS.md b/docs/PAX_CONTROL_GROUPS.md
new file mode 100644
index 0000000..4b2374a
--- /dev/null
+++ b/docs/PAX_CONTROL_GROUPS.md
@@ -0,0 +1,117 @@
+---
+title: Pax Controla Groupiana
+category: Users, Groups and Home Directories
+layout: default
+SPDX-License-Identifier: LGPL-2.1-or-later
+---
+
+# Pax Controla Groupiana
+
+_aka "How to behave nicely in the cgroupfs trees"_
+
+**Important Update: Please consult this document only as a historical reference.
+It was written under the assumption that the cgroups tree was a shared resource.
+However, after much discussion this concept has been deemed outdated.
+The cgroups tree can no longer be considered a shared resource.
+Instead, a management daemon of some kind needs to arbitrate access to it, and it needs to actively propagate changes between the entities it manages.
+More specifically, on systemd systems this management daemon is systemd itself, accessible via a number of bus APIs.
+This means instead of dealing directly with the low-level interfaces of the cgroup file system, please use systemd's high-level APIs as a replacement, see the
+[New Control Group Interfaces](/CONTROL_GROUP_INTERFACE)
+for details. They offer similar functionality.**
+
+Are you writing an application interfacing with the cgroups tree?
+The cgroups trees are a shared resource, other applications will use them too.
+Here are a few recommendations how to write your application in a way that minimizes conflicts with other applications.
+If you follow these guidelines applications should not step on any other application's toes and users will be happy.
+
+Before you read these recommendations please make sure you understand cgroups thoroughly,
+and specifically are aware what a controller is, what a named hierarchy is and so on.
+
+## Intended Audience
+
+You should consider these recommendations if you are you working on one of the following:
+
+- You write a system or session manager based on cgroups (like systemd)
+- You write a VM manager based on cgroups (like libvirt)
+- You write a terminal application and want to place every shell in a separate cgroup (like gnome-terminal)
+- You write a web browser and want to place every renderer in a separate cgroup (like Firefox or Chrome)
+- You create a container for some purpose (such as systemd-nspawn)
+- Or you use cgroups for any other purpose and want things to work nicely with other applications.
+
+## General Recommendations
+
+- If you use one of the kernel controllers, do _not_ assume you are the only one who uses them.
+ Other programs may manipulate the tree, add cgroups and change group attributes at any time, and they will not inform you about it.
+ The kernel provided controller hierarchies are a shared resource, so be nice.
+- If you use a generic named hierarchy with no controller attached, then you may assume it's yours and only yours, and that no other programs interfere with it.
+- If you use a generic named hierarchy with no controller attached, then make sure to name it after your project in order to minimize namespacing conflicts.
+ A hierarchy named "name=web" is a bit generic.
+ A hierarchy named "name=apache" a much better choice, if you are an Apache developer and need an entire hierarchy all for yourself.
+- Do _not_ assume everybody uses the same library to manipulate the cgroups tree as you are.
+ In fact most likely most applications and the user himself will manipulate the tree without any further indirection (i.e. will use naked system calls/shell commands)
+- Never create cgroups at the top of the tree (i.e. with an absolute path).
+ If possible find the cgroup your own process was started in and create subgroups only below that group (read /proc/self/cgroup to find it).
+ If that's not applicable, then at least place yourself below the cgroup path of PID 1 (read /proc/1/cgroup to find it).
+ This is important to ensure that containers work properly (the cgroupfs tree is currently not virtualized for containers!), and solves permission problems, and makes the whole system nicely stackable.
+- A corollary of this: If you spawn subprocesses expect that they will create subcgroups.
+ That means when terminating there might be subcgroups below the ones you created and you hence need to recursively remove them too.
+ In fact, many of your operations must probably be executed in a recursive fashion.
+- Do not play permission games: if you are an unprivileged user application then it's _not_ your business to ensure you have the right permissions
+ (i.e. do not include any setuid code in your app to create groups).
+ Instead your system manager (such as systemd),
+ should provide you with the right set of permissions on the cgroup you are running in to create subgroups.
+ Normally that should mean that depending on administrator configuration, you will or will not get access to create subgroups under the cgroup you are running in and the ability to add PIDs to it.
+ If you don't get access to these hierarchies then this might be a decision by the administrator and you should do your best to go on, and fail gracefully.
+- If you create a cgroup, then you are in charge of removing it too after using it.
+ Do not remove other program's cgroups.
+ Special exception: in some cases it is OK to pre-set attributes on certain cgroups that are primarily managed by another program.
+ (Example: in systemd we are fine if you externally pre-create or manipulate service cgroups, for example to make changes to some attributes you cannot control with systemd natively, see below).
+ In that case: create the cgroup and set the sticky bit (+t) on the tasks file in it.
+ This will then be used as an indication to the primary manager of the group not to remove the cgroup at the end, in order to avoid that your settings are lost.
+ This is of course a bit of a misuse of the sticky bit, but given that it serves no other purpose on Linux for normal files, it is an OK use, with a fitting meaning given the name of "sticky bit".
+- If you find a process in a cgroup you are about to remove, and it is not yours, consider leaving the cgroup around.
+ I.e. if rmdir returns EEMPTY, ignore this.
+- The cgroup mount point for a specific hierarchy is /sys/fs/cgroup/$CONTROLLER/.
+ (Example: /sys/fs/cgroup/cpu for the "cpu" controller).
+ In your application you are welcome to rely on these standardized mount points,
+ and it is not necessary to dynamically determine the current mount point via /proc/self/mountinfo (but if you do, that's of course fine, too).
+ Note that /sys/fs/cgroup/$CONTROLLER/ might actually just be a symlink to some other mount point (see below).
+- If multiple controllers are mounted into the same hierarchy, it is guaranteed that symlinks exist to make sure all jointly mounted controllers are still available under /sys/fs/cgroup/$CONTROLLER/.
+ Example: if "cpu" and "cpuacct" are mounted together, then symlinks /sys/fs/cgroup/cpu and /sys/fs/cgroup/cpuacct will point to the joint mountpoint (which could be something like /sys/fs/cgroup/cpu+cpuacct).
+- Your application should not mount the cgroup controller file systems (unless it is your own private named hierarchy).
+ This is exclusively a job for the system manager or a system-wide init script such as cgconfig.
+ If you work on a system manager or such an init script you must mount the cgroup controllers to /sys/fs/cgroup/$CONTROLLER/ or provide compatibility symlinks.
+- It's a good idea not to fail if a cgroup already exists when you try to create it.
+ Ignore EEXIST on mkdir.
+- Avoid renaming cgroups or similar fancier file operations.
+- Expect that other programs might readjust the attributes on your cgroups dynamically during runtime.
+- When creating a cgroup pick a nice a descriptive name that is guessable and no surprise to the admin.
+ The admin will thank you for this if he has to read the output of "ps -eo pid,args,cgroups"
+- /sys/fs/cgroup is a tmpfs. If you create your own private named hierarchy then you are welcome to mount it into a subdirectory of this directory.
+ This minimizes surprises for the user.
+- /sys/fs/cgroup is a tmpfs, but it's only intended use is to act as place where control group hierarchies can be mounted or symlinked to.
+ You should not place any other kind of file in this directory.
+ The same way as /dev/shm is for POSIX shared memory segments only -- and nothing else -- this directory is for cgroup hierarchies only.
+ Just because something is a tmpfs it doesn't mean you can actually use it for "temporary" files, thank you.
+- Avoid creating orthogonal hierarchies in the various kernel controller hierarchies.
+ Please make sure that the controllers contain the same hierarchy or subsets of each other.
+
+## Cooperation with systemd
+
+systemd adheres to the recommendations above and guarantees additional behavior which might be useful for writing applications that cooperate with systemd on cgroup management:
+
+- If a service cgroup already exists, systemd will make use of it and not recreate it.
+ (If +t is set on the tasks file it will not remove it when stopping a service, otherwise it will, see above).
+ It is hence OK to pre-create cgroups and then let systemd use it, without having systemd remove it afterwards.
+- If a service cgroup already exists, systemd will not override the attributes of the cgroup with the exception of those explicitly configured in the systemd unit files.
+ It is hence OK to pre-create cgroups for use in systemd, and pre-apply attributes to it.
+- To avoid that systemd places all services in automatic cgroups in the "cpu" hierarchy change the [?](https://secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&amp;from=Software%2Fsystemd%2FPaxControlGroups&amp;page=DefaultControllers) DefaultControllers= in /etc/systemd/system.conf and set it to the empty string.
+- By default systemd will place services only in automatic cgroups in the "cpu" hierarchy and in its own private tree "name=systemd".
+ If you want it to duplicate these trees in other hierarchies add them to [?](https://secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&amp;from=Software%2Fsystemd%2FPaxControlGroups&amp;page=DefaultControllers) DefaultControllers= in /etc/systemd/system.conf
+- To opt-out or opt-in specific services from the automatic tree generation in the kernel controller hierarchies use [?](https://secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&amp;from=Software%2Fsystemd%2FPaxControlGroups&amp;page=ControlGroup) ControlGroup= in the unit file.
+ Use "[?](https://secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&amp;from=Software%2Fsystemd%2FPaxControlGroups&amp;page=ControlGroup) ControlGroup=cpu:/" to opt-out of cgroup assignment for a service or
+ [?](https://secure.freedesktop.org/write/www/ikiwiki.cgi?do=create&amp;from=Software%2Fsystemd%2FPaxControlGroups&amp;page=ControlGroup) ControlGroup=cpu:/foo/bar" to manipulate the cgroup path.
+- Stay away from the name=systemd named hierarchy.
+ It's private property of systemd.
+ You are welcome to explore it, but it is uncool to modify it from outside systemd.
+Thanks.
diff --git a/docs/PORTABILITY_AND_STABILITY.md b/docs/PORTABILITY_AND_STABILITY.md
index abdc3dc..e611c3b 100644
--- a/docs/PORTABILITY_AND_STABILITY.md
+++ b/docs/PORTABILITY_AND_STABILITY.md
@@ -7,23 +7,37 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Interface Portability and Stability Promise
-systemd provides various interfaces developers and programs might rely on. Starting with version 26 (the first version released with Fedora 15) we promise to keep a number of them stable and compatible for the future.
+systemd provides various interfaces developers and programs might rely on.
+Starting with version 26 (the first version released with Fedora 15) we promise to keep a number of them stable and compatible for the future.
The stable interfaces are:
-* **The unit configuration file format**. Unit files written now will stay compatible with future versions of systemd. Extensions to the file format will happen in a way that existing files remain compatible.
+* **The unit configuration file format**. Unit files written now will stay compatible with future versions of systemd.
+ Extensions to the file format will happen in a way that existing files remain compatible.
-* **The command line interface** of `systemd`, `systemctl`, `loginctl`, `journalctl`, and all other command line utilities installed in `$PATH` and documented in a man page. We will make sure that scripts invoking these commands will continue to work with future versions of systemd. Note however that the output generated by these commands is generally not included in the promise, unless it is documented in the man page. Example: the output of `systemctl status` is not stable, but that of `systemctl show` is, because the former is intended to be human readable and the latter computer readable, and this is documented in the man page.
+* **The command line interface** of `systemd`, `systemctl`, `loginctl`, `journalctl`, and all other command line utilities installed in `$PATH` and documented in a man page.
+ We will make sure that scripts invoking these commands will continue to work with future versions of systemd.
+ Note however that the output generated by these commands is generally not included in the promise, unless it is documented in the man page.
+ Example: the output of `systemctl status` is not stable, but that of `systemctl show` is, because the former is intended to be human readable and the latter computer readable, and this is documented in the man page.
-* **The protocol spoken on the socket referred to by `$NOTIFY_SOCKET`**, as documented in [sd_notify(3)](https://www.freedesktop.org/software/systemd/man/sd_notify.html).
+* **The protocol spoken on the socket referred to by `$NOTIFY_SOCKET`**, as documented in
+ [sd_notify(3)](https://www.freedesktop.org/software/systemd/man/sd_notify.html). Note that, although using
+ libsystemd is a good choice, this protocol can also be reimplemented without external dependencies, as
+ demonstrated in the example listed in
+ [sd_notify(3)](https://www.freedesktop.org/software/systemd/man/devel/sd_notify.html#Notes)
-* Some of the **"special" unit names** and their semantics. To be precise the ones that are necessary for normal services, and not those required only for early boot and late shutdown, with very few exceptions. To list them here: `basic.target`, `shutdown.target`, `sockets.target`, `network.target`, `getty.target`, `graphical.target`, `multi-user.target`, `rescue.target`, `emergency.target`, `poweroff.target`, `reboot.target`, `halt.target`, `runlevel[1-5].target`.
+* Some of the **"special" unit names** and their semantics.
+ To be precise the ones that are necessary for normal services, and not those required only for early boot and late shutdown, with very few exceptions.
+ To list them here: `basic.target`, `shutdown.target`, `sockets.target`, `network.target`, `getty.target`, `graphical.target`, `multi-user.target`, `rescue.target`, `emergency.target`, `poweroff.target`, `reboot.target`, `halt.target`, `runlevel[1-5].target`.
-* **The D-Bus interfaces of the main service daemon and other daemons**. We try to always preserve backwards compatibility, and intentional breakage is never introduced. Nevertheless, when we find bugs that mean that the existing interface was not useful, or when the implementation did something different than stated by the documentation and the implemented behaviour is not useful, we will fix the implementation and thus introduce a change in behaviour. But the API (parameter counts and types) is never changed, and existing attributes and methods will not be removed.
+* **The D-Bus interfaces of the main service daemon and other daemons**. We try to always preserve backwards compatibility, and intentional breakage is never introduced.
+ Nevertheless, when we find bugs that mean that the existing interface was not useful, or when the implementation did something different than stated by the documentation and the implemented behaviour is not useful, we will fix the implementation and thus introduce a change in behaviour.
+ But the API (parameter counts and types) is never changed, and existing attributes and methods will not be removed.
* For a more comprehensive and authoritative list, consult the chart below.
-The following interfaces will not necessarily be kept stable for now, but we will eventually make a stability promise for these interfaces too. In the meantime we will however try to keep breakage of these interfaces at a minimum:
+The following interfaces will not necessarily be kept stable for now, but we will eventually make a stability promise for these interfaces too.
+In the meantime we will however try to keep breakage of these interfaces at a minimum:
* **The set of states of the various state machines used in systemd**, e.g. the high-level unit states inactive, active, deactivating, and so on, as well (and in particular) the low-level per-unit states.
@@ -35,42 +49,64 @@ The following interfaces are considered private to systemd, and are not and will
* **The internal protocols** used on the various sockets such as the sockets `/run/systemd/shutdown`, `/run/systemd/private`.
-One of the main goals of systemd is to unify basic Linux configurations and service behaviors across all distributions. Systemd project does not contain any distribution-specific parts. Distributions are expected to convert over time their individual configurations to the systemd format, or they will need to carry and maintain patches in their package if they still decide to stay different.
+One of the main goals of systemd is to unify basic Linux configurations and service behaviors across all distributions.
+Systemd project does not contain any distribution-specific parts.
+Distributions are expected to convert over time their individual configurations to the systemd format, or they will need to carry and maintain patches in their package if they still decide to stay different.
-What does this mean for you? When developing with systemd, don't use any of the latter interfaces, or we will tell your mom, and she won't love you anymore. You are welcome to use the other interfaces listed here, but if you use any of the second kind (i.e. those where we don't yet make a stability promise), then make sure to subscribe to our mailing list, where we will announce API changes, and be prepared to update your program eventually.
+What does this mean for you? When developing with systemd, don't use any of the latter interfaces, or we will tell your mom, and she won't love you anymore.
+You are welcome to use the other interfaces listed here, but if you use any of the second kind (i.e. those where we don't yet make a stability promise), then make sure to subscribe to our mailing list, where we will announce API changes, and be prepared to update your program eventually.
-Note that this is a promise, not an eternal guarantee. These are our intentions, but if in the future there are very good reasons to change or get rid of an interface we have listed above as stable, then we might take the liberty to do so, despite this promise. However, if we do this, then we'll do our best to provide a smooth and reasonably long transition phase.
+Note that this is a promise, not an eternal guarantee.
+These are our intentions, but if in the future there are very good reasons to change or get rid of an interface we have listed above as stable, then we might take the liberty to do so, despite this promise.
+However, if we do this, then we'll do our best to provide a smooth and reasonably long transition phase.
## Interface Portability And Stability Chart
-systemd provides a number of APIs to applications. Below you'll find a table detailing which APIs are considered stable and how portable they are.
+systemd provides a number of APIs to applications.
+Below you'll find a table detailing which APIs are considered stable and how portable they are.
This list is intended to be useful for distribution and OS developers who are interested in maintaining a certain level of compatibility with the new interfaces systemd introduced, without relying on systemd itself.
-In general it is our intention to cooperate through interfaces and not code with other distributions and OSes. That means that the interfaces where this applies are best reimplemented in a compatible fashion on those other operating systems. To make this easy we provide detailed interface documentation where necessary. That said, it's all Open Source, hence you have the option to a) fork our code and maintain portable versions of the parts you are interested in independently for your OS, or b) build systemd for your distro, but leave out all components except the ones you are interested in and run them without the core of systemd involved. We will try not to make this any more difficult than necessary. Patches to allow systemd code to be more portable will be accepted on case-by-case basis (essentially, patches to follow well-established standards instead of e.g. glibc or linux extensions have a very high chance of being accepted, while patches which make the code ugly or exist solely to work around bugs in other projects have a low chance of being accepted).
+In general it is our intention to cooperate through interfaces and not code with other distributions and OSes.
+That means that the interfaces where this applies are best reimplemented in a compatible fashion on those other operating systems.
+To make this easy we provide detailed interface documentation where necessary.
+That said, it's all Open Source, hence you have the option to a) fork our code and maintain portable versions of the parts you are interested in independently for your OS, or b) build systemd for your distro, but leave out all components except the ones you are interested in and run them without the core of systemd involved.
+We will try not to make this any more difficult than necessary.
+Patches to allow systemd code to be more portable will be accepted on case-by-case basis (essentially, patches to follow well-established standards instead of e.g. glibc or linux extensions have a very high chance of being accepted, while patches which make the code ugly or exist solely to work around bugs in other projects have a low chance of being accepted).
-Many of these interfaces are already being used by applications and 3rd party code. If you are interested in compatibility with these applications, please consider supporting these interfaces in your distribution, where possible.
+Many of these interfaces are already being used by applications and 3rd party code.
+If you are interested in compatibility with these applications, please consider supporting these interfaces in your distribution, where possible.
## General Portability of systemd and its Components
-**Portability to OSes:** systemd is not portable to non-Linux systems. It makes use of a large number of Linux-specific interfaces, including many that are used by its very core. We do not consider it feasible to port systemd to other Unixes (let alone non-Unix operating systems) and will not accept patches for systemd core implementing any such portability (but hey, it's git, so it's as easy as it can get to maintain your own fork...). APIs that are supposed to be used as library code are exempted from this: it is important to us that these compile nicely on non-Linux and even non-Unix platforms, even if they might just become NOPs.
+**Portability to OSes:** systemd is not portable to non-Linux systems.
+It makes use of a large number of Linux-specific interfaces, including many that are used by its very core.
+We do not consider it feasible to port systemd to other Unixes (let alone non-Unix operating systems) and will not accept patches for systemd core implementing any such portability (but hey, it's git, so it's as easy as it can get to maintain your own fork...).
+APIs that are supposed to be used as library code are exempted from this: it is important to us that these compile nicely on non-Linux and even non-Unix platforms, even if they might just become NOPs.
-**Portability to Architectures:** It is important to us that systemd is portable to little endian as well as big endian systems. We will make sure to provide portability with all important architectures and hardware Linux runs on and are happy to accept patches for this.
+**Portability to Architectures:** It is important to us that systemd is portable to little endian as well as big endian systems.
+We will make sure to provide portability with all important architectures and hardware Linux runs on and are happy to accept patches for this.
-**Portability to Distributions:** It is important to us that systemd is portable to all Linux distributions. However, the goal is to unify many of the needless differences between the distributions, and hence will not accept patches for certain distribution-specific work-arounds. Compatibility with the distribution's legacy should be maintained in the distribution's packaging, and not in the systemd source tree.
+**Portability to Distributions:** It is important to us that systemd is portable to all Linux distributions.
+However, the goal is to unify many of the needless differences between the distributions, and hence will not accept patches for certain distribution-specific work-arounds.
+Compatibility with the distribution's legacy should be maintained in the distribution's packaging, and not in the systemd source tree.
-**Compatibility with Specific Versions of Other packages:** We generally avoid adding compatibility kludges to systemd that work around bugs in certain versions of other software systemd interfaces with. We strongly encourage fixing bugs where they are, and if that's not systemd we rather not try to fix it there. (There are very few exceptions to this rule possible, and you need an exceptionally strong case for it).
+**Compatibility with Specific Versions of Other packages:** We generally avoid adding compatibility kludges to systemd that work around bugs in certain versions of other software systemd interfaces with. We strongly encourage fixing bugs where they are, and if that's not systemd we rather not try to fix it there.
+(There are very few exceptions to this rule possible, and you need an exceptionally strong case for it).
## General Portability of systemd's APIs
-systemd's APIs are available everywhere where systemd is available. Some of the APIs we have defined are supposed to be generic enough to be implementable independently of systemd, thus allowing compatibility with systems systemd itself is not compatible with, i.e. other OSes, and distributions that are unwilling to fully adopt systemd.
+systemd's APIs are available everywhere where systemd is available.
+Some of the APIs we have defined are supposed to be generic enough to be implementable independently of systemd, thus allowing compatibility with systems systemd itself is not compatible with, i.e. other OSes, and distributions that are unwilling to fully adopt systemd.
-A number of systemd's APIs expose Linux or systemd-specific features that cannot sensibly be implemented elsewhere. Please consult the table below for information about which ones these are.
+A number of systemd's APIs expose Linux or systemd-specific features that cannot sensibly be implemented elsewhere.
+Please consult the table below for information about which ones these are.
-Note that not all of these interfaces are our invention (but most), we just adopted them in systemd to make them more prominently implemented. For example, we adopted many Debian facilities in systemd to push it into the other distributions as well.
+Note that not all of these interfaces are our invention (but most), we just adopted them in systemd to make them more prominently implemented.
+For example, we adopted many Debian facilities in systemd to push it into the other distributions as well.
---
@@ -83,9 +119,9 @@ And now, here's the list of (hopefully) all APIs that we have introduced with sy
| [hostnamed](https://www.freedesktop.org/software/systemd/man/org.freedesktop.hostname1.html) | D-Bus | yes | yes | GNOME | yes | [Ubuntu](https://launchpad.net/ubuntu/+source/ubuntu-system-service), [Gentoo](http://www.gentoo.org/proj/en/desktop/gnome/openrc-settingsd.xml), [BSD](http://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=systembsd.git;a=summary) | partially |
| [localed](https://www.freedesktop.org/software/systemd/man/org.freedesktop.locale1.html) | D-Bus | yes | yes | GNOME | yes | [Ubuntu](https://launchpad.net/ubuntu/+source/ubuntu-system-service), [Gentoo](http://www.gentoo.org/proj/en/desktop/gnome/openrc-settingsd.xml), [BSD](http://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=systembsd.git;a=summary) | partially |
| [timedated](https://www.freedesktop.org/software/systemd/man/org.freedesktop.timedate1.html) | D-Bus | yes | yes | GNOME | yes | [Gentoo](http://www.gentoo.org/proj/en/desktop/gnome/openrc-settingsd.xml), [BSD](http://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=systembsd.git;a=summary) | partially |
-| [initrd interface](INITRD_INTERFACE) | Environment, flag files | yes | yes | mkosi, dracut, ArchLinux | yes | ArchLinux | no |
-| [Container interface](CONTAINER_INTERFACE) | Environment, Mounts | yes | yes | libvirt/LXC | yes | - | no |
-| [Boot Loader interface](BOOT_LOADER_INTERFACE) | EFI variables | yes | yes | gummiboot | yes | - | no |
+| [initrd interface](/INITRD_INTERFACE) | Environment, flag files | yes | yes | mkosi, dracut, ArchLinux | yes | ArchLinux | no |
+| [Container interface](/CONTAINER_INTERFACE) | Environment, Mounts | yes | yes | libvirt/LXC | yes | - | no |
+| [Boot Loader interface](/BOOT_LOADER_INTERFACE) | EFI variables | yes | yes | gummiboot | yes | - | no |
| [Service bus API](https://www.freedesktop.org/software/systemd/man/org.freedesktop.systemd1.html) | D-Bus | yes | yes | system-config-services | no | - | no |
| [logind](https://www.freedesktop.org/software/systemd/man/org.freedesktop.login1.html) | D-Bus | yes | yes | GNOME | no | - | no |
| [sd-bus.h API](https://www.freedesktop.org/software/systemd/man/sd-bus.html) | C Library | yes | yes | - | maybe | - | maybe |
@@ -102,15 +138,15 @@ And now, here's the list of (hopefully) all APIs that we have introduced with sy
| [$XDG_RUNTIME_DIR](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) | Environment | yes | yes | glib, GNOME | yes | - | no |
| [$LISTEN_FDS $LISTEN_PID FD Passing](https://www.freedesktop.org/software/systemd/man/sd_listen_fds.html) | Environment | yes | yes | numerous (via sd-daemon.h) | yes | - | no |
| [$NOTIFY_SOCKET Daemon Notifications](https://www.freedesktop.org/software/systemd/man/sd_notify.html) | Environment | yes | yes | a few, including udev | yes | - | no |
-| [argv&#91;0&#93;&#91;0&#93;='@' Logic](ROOT_STORAGE_DAEMONS) | `/proc` marking | yes | yes | mdadm | yes | - | no |
+| [argv&#91;0&#93;&#91;0&#93;='@' Logic](/ROOT_STORAGE_DAEMONS) | `/proc` marking | yes | yes | mdadm | yes | - | no |
| [Unit file format](https://www.freedesktop.org/software/systemd/man/systemd.unit.html) | File format | yes | yes | numerous | no | - | no |
| [Network](https://www.freedesktop.org/software/systemd/man/systemd.network.html) & [Netdev file format](https://www.freedesktop.org/software/systemd/man/systemd.netdev.html) | File format | yes | yes | no | no | - | no |
| [Link file format](https://www.freedesktop.org/software/systemd/man/systemd.link.html) | File format | yes | yes | no | no | - | no |
-| [Journal File Format](JOURNAL_FILE_FORMAT) | File format | yes | yes | - | maybe | - | no |
-| [Journal Export Format](JOURNAL_EXPORT_FORMATS.md#journal-export-format) | File format | yes | yes | - | yes | - | no |
-| [Journal JSON Format](JOURNAL_EXPORT_FORMATS.md#journal-json-format) | File format | yes | yes | - | yes | - | no |
-| [Cooperation in cgroup tree](https://www.freedesktop.org/wiki/Software/systemd/PaxControlGroups) | Treaty | yes | yes | libvirt | yes | libvirt | no |
-| [Password Agents](PASSWORD_AGENTS) | Socket+Files | yes | yes | - | yes | - | no |
+| [Journal File Format](/JOURNAL_FILE_FORMAT) | File format | yes | yes | - | maybe | - | no |
+| [Journal Export Format](JOURNAL_EXPORT_FORMATS#journal-export-format) | File format | yes | yes | - | yes | - | no |
+| [Journal JSON Format](JOURNAL_EXPORT_FORMATS#journal-json-format) | File format | yes | yes | - | yes | - | no |
+| [Cooperation in cgroup tree](/PAX_CONTROL_GROUPS) | Treaty | yes | yes | libvirt | yes | libvirt | no |
+| [Password Agents](/PASSWORD_AGENTS) | Socket+Files | yes | yes | - | yes | - | no |
| [udev multi-seat properties](https://www.freedesktop.org/software/systemd/man/sd-login.html) | udev Property | yes | yes | X11, gdm | no | - | no |
| udev session switch ACL properties | udev Property | no | no | - | no | - | no |
| [CLI of systemctl,...](https://www.freedesktop.org/software/systemd/man/systemctl.html) | CLI | yes | yes | numerous | no | - | no |
@@ -135,15 +171,21 @@ And now, here's the list of (hopefully) all APIs that we have introduced with sy
### Explanations
-Items for which "systemd implementation portable to other OSes" is "partially" means that it is possible to run the respective tools that are included in the systemd tarball outside of systemd. Note however that this is not officially supported, so you are more or less on your own if you do this. If you are opting for this solution simply build systemd as you normally would but drop all files except those which you are interested in.
+Items for which "systemd implementation portable to other OSes" is "partially" means that it is possible to run the respective tools that are included in the systemd tarball outside of systemd.
+Note however that this is not officially supported, so you are more or less on your own if you do this.
+If you are opting for this solution simply build systemd as you normally would but drop all files except those which you are interested in.
-Of course, it is our intention to eventually document all interfaces we defined. If we haven't documented them for now, this is usually because we want the flexibility to still change things, or don't want 3rd party applications to make use of these interfaces already. That said, our sources are quite readable and open source, so feel free to spelunk around in the sources if you want to know more.
+Of course, it is our intention to eventually document all interfaces we defined.
+If we haven't documented them for now, this is usually because we want the flexibility to still change things, or don't want 3rd party applications to make use of these interfaces already.
+That said, our sources are quite readable and open source, so feel free to spelunk around in the sources if you want to know more.
If you decide to reimplement one of the APIs for which "Reimplementable independently" is "no", then we won't stop you, but you are on your own.
-This is not an attempt to comprehensively list all users of these APIs. We are just listing the most obvious/prominent ones which come to our mind.
+This is not an attempt to comprehensively list all users of these APIs.
+We are just listing the most obvious/prominent ones which come to our mind.
-Of course, one last thing I can't make myself not ask you before we finish here, and before you start reimplementing these APIs in your distribution: are you sure it's time well spent if you work on reimplementing all this code instead of just spending it on adopting systemd on your distro as well?
+Of course, one last thing I can't make myself not ask you before we finish here, and before you start reimplementing these APIs in your distribution:
+are you sure it's time well spent if you work on reimplementing all this code instead of just spending it on adopting systemd on your distro as well?
## Independent Operation of systemd Programs
diff --git a/docs/PREDICTABLE_INTERFACE_NAMES.md b/docs/PREDICTABLE_INTERFACE_NAMES.md
index 9d79f8f..9fa9fea 100644
--- a/docs/PREDICTABLE_INTERFACE_NAMES.md
+++ b/docs/PREDICTABLE_INTERFACE_NAMES.md
@@ -7,24 +7,37 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Predictable Network Interface Names
-Starting with v197 systemd/udev will automatically assign predictable, stable network interface names for all local Ethernet, WLAN and WWAN interfaces. This is a departure from the traditional interface naming scheme (`eth0`, `eth1`, `wlan0`, ...), but should fix real problems.
+Starting with v197 systemd/udev will automatically assign predictable, stable network interface names for all local Ethernet, WLAN and WWAN interfaces.
+This is a departure from the traditional interface naming scheme (`eth0`, `eth1`, `wlan0`, ...), but should fix real problems.
## Why?
-The classic naming scheme for network interfaces applied by the kernel is to simply assign names beginning with `eth0`, `eth1`, ... to all interfaces as they are probed by the drivers. As the driver probing is generally not predictable for modern technology this means that as soon as multiple network interfaces are available the assignment of the names `eth0`, `eth1` and so on is generally not fixed anymore and it might very well happen that `eth0` on one boot ends up being `eth1` on the next. This can have serious security implications, for example in firewall rules which are coded for certain naming schemes, and which are hence very sensitive to unpredictable changing names.
+The classic naming scheme for network interfaces applied by the kernel is to simply assign names beginning with `eth0`, `eth1`, ... to all interfaces as they are probed by the drivers.
+As the driver probing is generally not predictable for modern technology this means that as soon as multiple network interfaces are available the assignment of the names `eth0`, `eth1` and so on is generally not fixed anymore and it might very well happen that `eth0` on one boot ends up being `eth1` on the next.
+This can have serious security implications, for example in firewall rules which are coded for certain naming schemes, and which are hence very sensitive to unpredictable changing names.
-To fix this problem multiple solutions have been proposed and implemented. For a longer time udev shipped support for assigning permanent `ethX` names to certain interfaces based on their MAC addresses. This turned out to have a multitude of problems, among them: this required a writable root directory which is generally not available; the statelessness of the system is lost as booting an OS image on a system will result in changed configuration of the image; on many systems MAC addresses are not actually fixed, such as on a lot of embedded hardware and particularly on all kinds of virtualization solutions. The biggest of all however is that the userspace components trying to assign the interface name raced against the kernel assigning new names from the same `ethX` namespace, a race condition with all kinds of weird effects, among them that assignment of names sometimes failed. As a result support for this has been removed from systemd/udev a while back.
+To fix this problem multiple solutions have been proposed and implemented.
+For a longer time udev shipped support for assigning permanent `ethX` names to certain interfaces based on their MAC addresses.
+This turned out to have a multitude of problems, among them: this required a writable root directory which is generally not available; the statelessness of the system is lost as booting an OS image on a system will result in changed configuration of the image; on many systems MAC addresses are not actually fixed, such as on a lot of embedded hardware and particularly on all kinds of virtualization solutions.
+The biggest of all however is that the userspace components trying to assign the interface name raced against the kernel assigning new names from the same `ethX` namespace, a race condition with all kinds of weird effects, among them that assignment of names sometimes failed.
+As a result support for this has been removed from systemd/udev a while back.
-Another solution that has been implemented is `biosdevname` which tries to find fixed slot topology information in certain firmware interfaces and uses them to assign fixed names to interfaces which incorporate their physical location on the mainboard. In a way this naming scheme is similar to what is already done natively in udev for various device nodes via `/dev/*/by-path/` symlinks. In many cases, biosdevname departs from the low-level kernel device identification schemes that udev generally uses for these symlinks, and instead invents its own enumeration schemes.
+Another solution that has been implemented is `biosdevname` which tries to find fixed slot topology information in certain firmware interfaces and uses them to assign fixed names to interfaces which incorporate their physical location on the mainboard.
+In a way this naming scheme is similar to what is already done natively in udev for various device nodes via `/dev/*/by-path/` symlinks.
+In many cases, biosdevname departs from the low-level kernel device identification schemes that udev generally uses for these symlinks, and instead invents its own enumeration schemes.
-Finally, many distributions support renaming interfaces to user-chosen names (think: `internet0`, `dmz0`, ...) keyed off their MAC addresses or physical locations as part of their networking scripts. This is a very good choice but does have the problem that it implies that the user is willing and capable of choosing and assigning these names.
+Finally, many distributions support renaming interfaces to user-chosen names (think: `internet0`, `dmz0`, ...) keyed off their MAC addresses or physical locations as part of their networking scripts.
+This is a very good choice but does have the problem that it implies that the user is willing and capable of choosing and assigning these names.
-We believe it is a good default choice to generalize the scheme pioneered by `biosdevname`. Assigning fixed names based on firmware/topology/location information has the big advantage that the names are fully automatic, fully predictable, that they stay fixed even if hardware is added or removed (i.e. no reenumeration takes place) and that broken hardware can be replaced seamlessly. That said, they admittedly are sometimes harder to read than the `eth0` or `wlan0` everybody is used to. Example: `enp5s0`
+We believe it is a good default choice to generalize the scheme pioneered by `biosdevname`.
+Assigning fixed names based on firmware/topology/location information has the big advantage that the names are fully automatic, fully predictable, that they stay fixed even if hardware is added or removed (i.e. no reenumeration takes place) and that broken hardware can be replaced seamlessly.
+That said, they admittedly are sometimes harder to read than the `eth0` or `wlan0` everybody is used to. Example: `enp5s0`
## What precisely has changed in v197?
-With systemd 197 we have added native support for a number of different naming policies into systemd/udevd proper and made a scheme similar to biosdevname's (but generally more powerful, and closer to kernel-internal device identification schemes) the default. The following different naming schemes for network interfaces are now supported by udev natively:
+With systemd 197 we have added native support for a number of different naming policies into systemd/udevd proper and made a scheme similar to biosdevname's (but generally more powerful, and closer to kernel-internal device identification schemes) the default.
+The following different naming schemes for network interfaces are now supported by udev natively:
1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: `eno1`)
1. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: `ens1`)
@@ -32,9 +45,13 @@ With systemd 197 we have added native support for a number of different naming p
1. Names incorporating the interfaces's MAC address (example: `enx78e7d1ea46da`)
1. Classic, unpredictable kernel-native ethX naming (example: `eth0`)
-By default, systemd v197 will now name interfaces following policy 1) if that information from the firmware is applicable and available, falling back to 2) if that information from the firmware is applicable and available, falling back to 3) if applicable, falling back to 5) in all other cases. Policy 4) is not used by default, but is available if the user chooses so.
+By default, systemd v197 will now name interfaces following policy 1) if that information from the firmware is applicable and available, falling back to 2) if that information from the firmware is applicable and available, falling back to 3) if applicable, falling back to 5) in all other cases.
+Policy 4) is not used by default, but is available if the user chooses so.
-This combined policy is only applied as last resort. That means, if the system has biosdevname installed, it will take precedence. If the user has added udev rules which change the name of the kernel devices these will take precedence too. Also, any distribution specific naming schemes generally take precedence.
+This combined policy is only applied as last resort.
+That means, if the system has biosdevname installed, it will take precedence.
+If the user has added udev rules which change the name of the kernel devices these will take precedence too.
+Also, any distribution specific naming schemes generally take precedence.
## Come again, what good does this do?
@@ -54,7 +71,9 @@ With this new scheme you now get:
* The same on all distributions that adopted systemd/udev
* It's easy to opt out of the scheme (see below)
-Does this have any drawbacks? Yes, it does. Previously it was practically guaranteed that hosts equipped with a single ethernet card only had a single `eth0` interface. With this new scheme in place, an administrator now has to check first what the local interface name is before they can invoke commands on it, where previously they had a good chance that `eth0` was the right name.
+Does this have any drawbacks? Yes, it does.
+Previously it was practically guaranteed that hosts equipped with a single ethernet card only had a single `eth0` interface.
+With this new scheme in place, an administrator now has to check first what the local interface name is before they can invoke commands on it, where previously they had a good chance that `eth0` was the right name.
## I don't like this, how do I disable this?
@@ -67,4 +86,5 @@ You basically have three options:
## How does the new naming scheme look like, precisely?
-That's documented in detail the [systemd.net-naming-scheme(7)](https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html) man page. Please refer to this in case you are wondering how to decode the new interface names.
+That's documented in detail the [systemd.net-naming-scheme(7)](https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html) man page.
+Please refer to this in case you are wondering how to decode the new interface names.
diff --git a/docs/PRESET.md b/docs/PRESET.md
index a2ae323..62aab96 100644
--- a/docs/PRESET.md
+++ b/docs/PRESET.md
@@ -9,21 +9,32 @@ SPDX-License-Identifier: LGPL-2.1-or-later
## Why?
-Different **distributions** have different policies on which services shall be enabled by default when the package they are shipped in is installed. On Fedora all services stay off by default, so that installing a package will not cause a service to be enabled (with some exceptions). On Debian all services are immediately enabled by default, so that installing a package will cause its service(s) to be enabled right-away.
+Different **distributions** have different policies on which services shall be enabled by default when the package they are shipped in is installed.
+On Fedora all services stay off by default, so that installing a package will not cause a service to be enabled (with some exceptions).
+On Debian all services are immediately enabled by default, so that installing a package will cause its service(s) to be enabled right-away.
-Different **spins** (flavours, remixes, whatever you might want to call them) of a distribution also have different policies on what services to enable, and what services to leave off. For example, the Fedora default will enable gdm as display manager by default, while the Fedora KDE spin will enable kdm instead.
+Different **spins** (flavours, remixes, whatever you might want to call them) of a distribution also have different policies on what services to enable, and what services to leave off.
+For example, the Fedora default will enable gdm as display manager by default, while the Fedora KDE spin will enable kdm instead.
-Different **sites** might also have different policies what to turn on by default and what to turn off. For example, one administrator would prefer to enforce the policy of "ssh should be always on, but everything else off", while another one might say "snmp always on, and for everything else use the distribution policy defaults".
+Different **sites** might also have different policies what to turn on by default and what to turn off.
+For example, one administrator would prefer to enforce the policy of "ssh should be always on, but everything else off", while another one might say "snmp always on, and for everything else use the distribution policy defaults".
## The Logic
-Traditionally, policy about what services shall be enabled and what services shall not have been decided globally by the distributions, and were enforced in each package individually. This made it cumbersome to implement different policies per spin or per site, or to create software packages that do the right thing on more than one distribution. The enablement _mechanism_ was also encoding the enablement _policy_.
+Traditionally, policy about what services shall be enabled and what services shall not have been decided globally by the distributions, and were enforced in each package individually.
+This made it cumbersome to implement different policies per spin or per site, or to create software packages that do the right thing on more than one distribution.
+The enablement _mechanism_ was also encoding the enablement _policy_.
-systemd 32 and newer support package "preset" policies. These encode which units shall be enabled by default when they are installed, and which units shall not be enabled.
+systemd 32 and newer support package "preset" policies.
+These encode which units shall be enabled by default when they are installed, and which units shall not be enabled.
-Preset files may be written for specific distributions, for specific spins or for specific sites, in order to enforce different policies as needed. Preset policies are stored in .preset files in /usr/lib/systemd/system-preset/. If no policy exists the default implied policy of "enable everything" is enforced, i.e. in Debian style.
+Preset files may be written for specific distributions, for specific spins or for specific sites, in order to enforce different policies as needed.
+Preset policies are stored in .preset files in /usr/lib/systemd/system-preset/.
+If no policy exists the default implied policy of "enable everything" is enforced, i.e. in Debian style.
-The policy encoded in preset files is applied to a unit by invoking "systemctl preset ". It is recommended to use this command in all package post installation scriptlets. "systemctl preset " is identical to "systemctl enable " resp. "systemctl disable " depending on the policy.
+The policy encoded in preset files is applied to a unit by invoking "systemctl preset ".
+It is recommended to use this command in all package post installation scriptlets.
+"systemctl preset " is identical to "systemctl enable " resp. "systemctl disable " depending on the policy.
Preset files allow clean separation of enablement mechanism (inside the package scriptlets, by invoking "systemctl preset"), and enablement policy (centralized in the preset files).
@@ -39,6 +50,10 @@ Documentation for the recommended package scriptlets you find here: [http://www.
For the preset logic to be useful, distributions need to implement a couple of steps:
-- The default distribution policy needs to be encoded in a preset file /usr/lib/systemd/system-preset/99-default.preset or suchlike, unless the implied policy of "enable everything" is the right choice. For a Fedora-like policy of "enable nothing" it is sufficient to include the single line "disable" into that file. The default preset file should be installed as part of one the core packages of the distribution.
+- The default distribution policy needs to be encoded in a preset file /usr/lib/systemd/system-preset/99-default.preset or suchlike, unless the implied policy of "enable everything" is the right choice.
+For a Fedora-like policy of "enable nothing" it is sufficient to include the single line "disable" into that file.
+The default preset file should be installed as part of one the core packages of the distribution.
+
- All packages need to be updated to use "systemctl preset" in the post install scriptlets.
+
- (Optionally) spins/remixes/flavours should define their own preset file, either overriding or extending the default distribution preset policy. Also see the fedora feature page: [https://fedoraproject.org/wiki/Features/PackagePresets](https://fedoraproject.org/wiki/Features/PackagePresets)
diff --git a/docs/RANDOM_SEEDS.md b/docs/RANDOM_SEEDS.md
index b2712ca..49d3329 100644
--- a/docs/RANDOM_SEEDS.md
+++ b/docs/RANDOM_SEEDS.md
@@ -12,81 +12,73 @@ random numbers from early boot on.
## Linux Kernel Entropy Pool
-Today's computer systems require random number generators for numerous
-cryptographic and other purposes. On Linux systems, the kernel's entropy pool
-is typically used as high-quality source of random numbers. The kernel's
-entropy pool combines various entropy inputs together, mixes them and provides
-an API to userspace as well as to internal kernel subsystems to retrieve
-it. This entropy pool needs to be initialized with a minimal level of entropy
-before it can provide high quality, cryptographic random numbers to
-applications. Until the entropy pool is fully initialized application requests
-for high-quality random numbers cannot be fulfilled.
+Today's computer systems require random number generators for numerous cryptographic and other purposes.
+On Linux systems, the kernel's entropy pool is typically used as high-quality source of random numbers. The kernel's entropy pool combines various entropy inputs together, mixes them and provides
+an API to userspace as well as to internal kernel subsystems to retrieve it.
+
+This entropy pool needs to be initialized with a minimal level of entropy
+before it can provide high quality, cryptographic random numbers to applications.
+Until the entropy pool is fully initialized application requests for high-quality random numbers cannot be fulfilled.
The Linux kernel provides three relevant userspace APIs to request random data
from the kernel's entropy pool:
* The [`getrandom()`](https://man7.org/linux/man-pages/man2/getrandom.2.html)
- system call with its `flags` parameter set to 0. If invoked, the calling
- program will synchronously block until the random pool is fully initialized
+ system call with its `flags` parameter set to 0.
+ If invoked, the calling program will synchronously block until the random pool is fully initialized
and the requested bytes can be provided.
-* The `getrandom()` system call with its `flags` parameter set to
- `GRND_NONBLOCK`. If invoked, the request for random bytes will fail if the
- pool is not initialized yet.
+* The `getrandom()` system call with its `flags` parameter set to `GRND_NONBLOCK`.
+ If invoked, the request for random bytes will fail if the pool is not initialized yet.
* Reading from the
[`/dev/urandom`](https://man7.org/linux/man-pages/man4/urandom.4.html)
- pseudo-device will always return random bytes immediately, even if the pool
- is not initialized. The provided random bytes will be of low quality in this
- case however. Moreover, the kernel will log about all programs using this
- interface in this state, and which thus potentially rely on an uninitialized
- entropy pool.
+ pseudo-device will always return random bytes immediately, even if the pool is not initialized.
+ The provided random bytes will be of low quality in this case however.
+ Moreover, the kernel will log about all programs using this interface in this state, and which thus potentially rely on an uninitialized entropy pool.
(Strictly speaking, there are more APIs, for example `/dev/random`, but these
should not be used by almost any application and hence aren't mentioned here.)
-Note that the time it takes to initialize the random pool may differ between
-systems. If local hardware random number generators are available,
-initialization is likely quick, but particularly in embedded and virtualized
-environments available entropy is small and thus random pool initialization
+Note that the time it takes to initialize the random pool may differ between systems.
+If local hardware random number generators are available, initialization is likely quick, but particularly in embedded and virtualized environments available entropy is small and thus random pool initialization
might take a long time (up to tens of minutes!).
-Modern hardware tends to come with a number of hardware random number
-generators (hwrng), that may be used to relatively quickly fill up the entropy
-pool. Specifically:
+Modern hardware tends to come with a number of hardware random number generators (hwrng), that may be used to relatively quickly fill up the entropy pool.
+Specifically:
* All recent Intel and AMD CPUs provide the CPU opcode
- [RDRAND](https://en.wikipedia.org/wiki/RdRand) to acquire random bytes. Linux
- includes random bytes generated this way in its entropy pool, but didn't use
+ [RDRAND](https://en.wikipedia.org/wiki/RdRand) to acquire random bytes.
+ Linux includes random bytes generated this way in its entropy pool, but didn't use
to credit entropy for it (i.e. data from this source wasn't considered good
- enough to consider the entropy pool properly filled even though it was
- used). This has changed recently however, and most big distributions have
- turned on the `CONFIG_RANDOM_TRUST_CPU=y` kernel compile time option. This
- means systems with CPUs supporting this opcode will be able to very quickly
+ enough to consider the entropy pool properly filled even though it was used).
+ This has changed recently however, and most big distributions have
+ turned on the `CONFIG_RANDOM_TRUST_CPU=y` kernel compile time option.
+ This means systems with CPUs supporting this opcode will be able to very quickly
reach the "pool filled" state.
-* The TPM security chip that is available on all modern desktop systems has a
- hwrng. It is also fed into the entropy pool, but generally not credited
- entropy. You may use `rng_core.default_quality=1000` on the kernel command
- line to change that, but note that this is a global setting affect all
- hwrngs. (Yeah, that's weird.)
+* The TPM security chip that is available on all modern desktop systems has a hwrng.
+ It is also fed into the entropy pool, but generally not credited entropy.
+ You may use `rng_core.default_quality=1000` on the kernel command line to change that,
+ but note that this is a global setting affect all hwrngs.
+ (Yeah, that's weird.)
-* Many Intel and AMD chipsets have hwrng chips. Their Linux drivers usually
- don't credit entropy. (But there's `rng_core.default_quality=1000`, see
- above.)
+* Many Intel and AMD chipsets have hwrng chips.
+ Their Linux drivers usually don't credit entropy.
+ (But there's `rng_core.default_quality=1000`, see above.)
-* Various embedded boards have hwrng chips. Some drivers automatically credit
- entropy, others do not. Some WiFi chips appear to have hwrng sources too, and
+* Various embedded boards have hwrng chips.
+ Some drivers automatically credit entropy, others do not.
+ Some WiFi chips appear to have hwrng sources too, and
they usually do not credit entropy for them.
* `virtio-rng` is used in virtualized environments and retrieves random data
from the VM host. It credits full entropy.
-* The EFI firmware typically provides a RNG API. When transitioning from UEFI
- to kernel mode Linux will query some random data through it, and feed it into
- the pool, but not credit entropy to it. What kind of random source is behind
- the EFI RNG API is often not entirely clear, but it hopefully is some kind of
- hardware source.
+* The EFI firmware typically provides a RNG API.
+ When transitioning from UEFI to kernel mode Linux will query some random data through it, and feed it into
+ the pool, but not credit entropy to it.
+ What kind of random source is behind the EFI RNG API is often not entirely clear, but it hopefully is some kind of hardware source.
If neither of these are available (in fact, even if they are), Linux generates
entropy from various non-hwrng sources in various subsystems, all of which
@@ -95,31 +87,30 @@ particular in virtualized environments.
## `systemd`'s Use of Random Numbers
-systemd is responsible for bringing up the OS. It generally runs as the first
-userspace process the kernel invokes. Because of that it runs at a time where
-the entropy pool is typically not yet initialized, and thus requests to acquire
-random bytes will either be delayed, will fail or result in a noisy kernel log
+systemd is responsible for bringing up the OS.
+It generally runs as the first userspace process the kernel invokes.
+Because of that it runs at a time where the entropy pool is typically not yet initialized,
+and thus requests to acquire random bytes will either be delayed, will fail or result in a noisy kernel log
message (see above).
-Various other components run during early boot that require random bytes. For
-example, initrds nowadays communicate with encrypted networks or access
-encrypted storage which might need random numbers. systemd itself requires
-random numbers as well, including for the following uses:
+Various other components run during early boot that require random bytes.
+For example, initrds nowadays communicate with encrypted networks or access
+encrypted storage which might need random numbers.
+systemd itself requires random numbers as well, including for the following uses:
* systemd assigns 'invocation' UUIDs to all services it invokes that uniquely
- identify each invocation. This is useful to retain a global handle on a specific
- service invocation and relate it to other data. For example, log data
- collected by the journal usually includes the invocation UUID and thus the
- runtime context the service manager maintains can be neatly matched up with
- the log data a specific service invocation generated. systemd also
- initializes `/etc/machine-id` with a randomized UUID. (systemd also makes use
- of the randomized "boot id" the kernel exposes in
- `/proc/sys/kernel/random/boot_id`). These UUIDs are exclusively Type 4 UUIDs,
- i.e. randomly generated ones.
-
-* systemd maintains various hash tables internally. In order to harden them
- against [collision
- attacks](https://www.cs.auckland.ac.nz/~mcw/Teaching/refs/misc/denial-of-service.pdf)
+ identify each invocation.
+ This is useful to retain a global handle on a specific service invocation and relate it to other data.
+ For example, log data collected by the journal usually includes the invocation UUID
+ and thus the runtime context the service manager maintains can be neatly matched up with
+ the log data a specific service invocation generated.
+ systemd also initializes `/etc/machine-id` with a randomized UUID.
+ (systemd also makes use of the randomized "boot id" the kernel exposes in `/proc/sys/kernel/random boot_id`).
+ These UUIDs are exclusively Type 4 UUIDs, i.e. randomly generated ones.
+
+* systemd maintains various hash tables internally.
+ In order to harden them against
+ [collision attacks](https://www.cs.auckland.ac.nz/~mcw/Teaching/refs/misc/denial-of-service.pdf)
they are seeded with random numbers.
* At various places systemd needs random bytes for temporary file name
@@ -133,20 +124,18 @@ random numbers as well, including for the following uses:
Note that these cases generally do not require a cryptographic-grade random
number generator, as most of these utilize random numbers to minimize risk of
-collision and not to generate secret key material. However, they usually do
-require "medium-grade" random data. For example: systemd's hash-maps are
-reseeded if they grow beyond certain thresholds (and thus collisions are more
-likely). This means they are generally fine with low-quality (even constant)
-random numbers initially as long as they get better with time, so that
-collision attacks are eventually thwarted as better, non-guessable seeds are
+collision and not to generate secret key material.
+However, they usually do require "medium-grade" random data.
+For example: systemd's hash-maps are reseeded if they grow beyond certain thresholds (and thus collisions are more likely).
+This means they are generally fine with low-quality (even constant)random numbers initially as long as they get better with time, so that collision attacks are eventually thwarted as better, non-guessable seeds are
acquired.
## Keeping `systemd'`s Demand on the Kernel Entropy Pool Minimal
Since most of systemd's own use of random numbers do not require
cryptographic-grade RNGs, it tries to avoid blocking reads to the kernel's RNG,
-opting instead for using `getrandom(GRND_INSECURE)`. After the pool is
-initialized, this is identical to `getrandom(0)`, returning cryptographically
+opting instead for using `getrandom(GRND_INSECURE)`.
+After the pool is initialized, this is identical to `getrandom(0)`, returning cryptographically
secure random numbers, but before it's initialized it has the nice effect of
not blocking system boot.
@@ -158,51 +147,47 @@ boot, in order to ensure the entropy pool is filled up quickly.
1. When systemd's PID 1 detects it runs in a virtualized environment providing
the `virtio-rng` interface it will load the necessary kernel modules to make
use of it during earliest boot, if possible — much earlier than regular
- kernel module loading done by `systemd-udevd.service`. This should ensure
- that in VM environments the entropy pool is quickly filled, even before
+ kernel module loading done by `systemd-udevd.service`.
+ This should ensure that in VM environments the entropy pool is quickly filled, even before
systemd invokes the first service process — as long as the VM environment
provides virtualized RNG hardware (and VM environments really should!).
2. The
[`systemd-random-seed.service`](https://www.freedesktop.org/software/systemd/man/systemd-random-seed.service.html)
system service will load a random seed from `/var/lib/systemd/random-seed`
- into the kernel entropy pool. By default it does not credit entropy for it
- though, since the seed is — more often than not — not reset when 'golden'
- master images of an OS are created, and thus replicated into every
- installation. If OS image builders carefully reset the random seed file
- before generating the image it should be safe to credit entropy, which can
- be enabled by setting the `$SYSTEMD_RANDOM_SEED_CREDIT` environment variable
- for the service to `1` (or even `force`, see man page). Note however, that
- this service typically runs relatively late during early boot: long after
- the initrd completed, and after the `/var/` file system became
- writable. This is usually too late for many applications, it is hence not
- advised to rely exclusively on this functionality to seed the kernel's
- entropy pool. Also note that this service synchronously waits until the
- kernel's entropy pool is initialized before completing start-up. It may thus
- be used by other services as synchronization point to order against, if they
+ into the kernel entropy pool.
+ By default it does not credit entropy for it though, since the seed is — more often than not — not reset when 'golden' master images of an OS are created, and thus replicated into every installation.
+ If OS image builders carefully reset the random seed file before generating the image it should be safe to credit entropy, which can be enabled by setting the `$SYSTEMD_RANDOM_SEED_CREDIT` environment variable
+ for the service to `1` (or even `force`, see man page).
+ Note however, that this service typically runs relatively late during early boot: long after
+ the initrd completed, and after the `/var/` file system became writable.
+ This is usually too late for many applications, it is hence not advised to rely exclusively on this functionality to seed the kernel's entropy pool.
+ Also note that this service synchronously waits until the kernel's entropy pool is initialized before completing start-up.
+ It may thus be used by other services as synchronization point to order against, if they
require an initialized entropy pool to operate correctly.
3. The
[`systemd-boot`](https://www.freedesktop.org/software/systemd/man/systemd-boot.html)
EFI boot loader included in systemd is able to maintain and provide a random
seed stored in the EFI System Partition (ESP) to the booted OS, which allows
- booting up with a fully initialized entropy pool from earliest boot
- on. During installation of the boot loader (or when invoking [`bootctl
- random-seed`](https://www.freedesktop.org/software/systemd/man/bootctl.html#random-seed))
- a seed file with an initial seed is placed in a file `/loader/random-seed`
- in the ESP. In addition, an identically sized randomized EFI variable called
- the 'system token' is set, which is written to the machine's firmware NVRAM.
+ booting up with a fully initialized entropy pool from earliest boot on.
+ During installation of the boot loader (or when invoking
+ [`bootctlrandom-seed`](https://www.freedesktop.org/software/systemd/man/bootctl.html#random-seed))
+ a seed file with an initial seed is placed in a file `/loader/random-seed` in the ESP.
+ In addition, an identically sized randomized EFI variable called the 'system token' is set, which is written to the machine's firmware NVRAM.
+
During boot, when `systemd-boot` finds both the random seed file and the
system token they are combined and hashed with SHA256 (in counter mode, to
generate sufficient data), to generate a new random seed file to store in
- the ESP as well as a random seed to pass to the OS kernel. The new random
- seed file for the ESP is then written to the ESP, ensuring this is completed
+ the ESP as well as a random seed to pass to the OS kernel.
+ The new random seed file for the ESP is then written to the ESP, ensuring this is completed
before the OS is invoked.
The kernel then reads the random seed that the boot loader passes to it, via
the EFI configuration table entry, `LINUX_EFI_RANDOM_SEED_TABLE_GUID`
(1ce1e5bc-7ceb-42f2-81e5-8aadf180f57b), which is allocated with pool memory
- of type `EfiACPIReclaimMemory`. Its contents have the form:
+ of type `EfiACPIReclaimMemory`.
+ Its contents have the form:
```
struct linux_efi_random_seed {
u32 size; // of the 'seed' array in bytes
@@ -216,17 +201,16 @@ boot, in order to ensure the entropy pool is filled up quickly.
This mechanism is able to safely provide an initialized entropy pool before
userspace even starts and guarantees that different seeds are passed from
the boot loader to the OS on every boot (in a way that does not allow
- regeneration of an old seed file from a new seed file). Moreover, when an OS
- image is replicated between multiple images and the random seed is not
- reset, this will still result in different random seeds being passed to the
- OS, as the per-machine 'system token' is specific to the physical host, and
- not included in OS disk images. If the 'system token' is properly
- initialized and kept sufficiently secret it should not be possible to
+ regeneration of an old seed file from a new seed file).
+
+ Moreover, when an OS image is replicated between multiple images and the random seed is not reset, this will still result in different random seeds being passed to the OS, as the per-machine 'system token' is specific to the physical host, and not included in OS disk images.
+
+ If the 'system token' is properly initialized and kept sufficiently secret it should not be possible to
regenerate the entropy pool of different machines, even if this seed is the
only source of entropy.
- Note that the writes to the ESP needed to maintain the random seed should be
- minimal. Because the size of the random seed file is generally set to 32 bytes,
+ Note that the writes to the ESP needed to maintain the random seed should be minimal.
+ Because the size of the random seed file is generally set to 32 bytes,
updating the random seed in the ESP should be doable safely with a single
sector write (since hard-disk sectors typically happen to be 512 bytes long,
too), which should be safe even with FAT file system drivers built into
@@ -234,10 +218,10 @@ boot, in order to ensure the entropy pool is filled up quickly.
4. A kernel command line option `systemd.random_seed=` may be used to pass in a
base64 encoded seed to initialize the kernel's entropy pool from during
- early service manager initialization. This option is only safe in testing
- environments, as the random seed passed this way is accessible to
- unprivileged programs via `/proc/cmdline`. Using this option outside of
- testing environments is a security problem since cryptographic key material
+ early service manager initialization.
+ This option is only safe in testing environments, as the random seed passed this way is accessible to
+ unprivileged programs via `/proc/cmdline`.
+ Using this option outside of testing environments is a security problem since cryptographic key material
derived from the entropy pool initialized with a seed accessible to
unprivileged programs should not be considered secret.
@@ -250,9 +234,9 @@ early-boot entropy in most cases. Specifically:
2. On virtualized systems, the early `virtio-rng` hookup should ensure entropy
is available early on — as long as the VM environment provides virtualized
- RNG devices, which they really should all do in 2019. Complain to your
- hosting provider if they don't. For VMs used in testing environments,
- `systemd.random_seed=` may be used as an alternative to a virtualized RNG.
+ RNG devices, which they really should all do in 2019.
+ Complain to your hosting provider if they don't.
+ For VMs used in testing environments, `systemd.random_seed=` may be used as an alternative to a virtualized RNG.
3. In general, systemd's own reliance on the kernel entropy pool is minimal
(due to the use of `GRND_INSECURE`).
@@ -263,20 +247,20 @@ early-boot entropy in most cases. Specifically:
This primarily leaves two kind of systems in the cold:
1. Some embedded systems. Many embedded chipsets have hwrng functionality these
- days. Consider using them while crediting
- entropy. (i.e. `rng_core.default_quality=1000` on the kernel command line is
- your friend). Or accept that the system might take a bit longer to
- boot. Alternatively, consider implementing a solution similar to
- systemd-boot's random seed concept in your platform's boot loader.
+ days.
+ Consider using them while crediting entropy.
+ (i.e. `rng_core.default_quality=1000` on the kernel command line is your friend).
+ Or accept that the system might take a bit longer to boot.
+ Alternatively, consider implementing a solution similar to systemd-boot's random seed concept in your platform's boot loader.
2. Virtualized environments that lack both virtio-rng and RDRAND, outside of
- test environments. Tough luck. Talk to your hosting provider, and ask them
- to fix this.
+ test environments.
+ Tough luck. Talk to your hosting provider, and ask them to fix this.
3. Also note: if you deploy an image without any random seed and/or without
installing any 'system token' in an EFI variable, as described above, this
- means that on the first boot no seed can be passed to the OS
- either. However, as the boot completes (with entropy acquired elsewhere),
+ means that on the first boot no seed can be passed to the OS either.
+ However, as the boot completes (with entropy acquired elsewhere),
systemd will automatically install both a random seed in the GPT and a
'system token' in the EFI variable space, so that any future boots will have
entropy from earliest boot on — all provided `systemd-boot` is used.
@@ -286,12 +270,13 @@ This primarily leaves two kind of systems in the cold:
1. *Why don't you just use getrandom()? That's all you need!*
Did you read any of the above? getrandom() is hooked to the kernel entropy
- pool, and during early boot it's not going to be filled yet, very likely. We
- do use it in many cases, but not in all. Please read the above again!
+ pool, and during early boot it's not going to be filled yet, very likely.
+ We do use it in many cases, but not in all.
+ Please read the above again!
2. *Why don't you use
- [getentropy()](https://man7.org/linux/man-pages/man3/getentropy.3.html)? That's
- all you need!*
+ [getentropy()](https://man7.org/linux/man-pages/man3/getentropy.3.html)?
+ That's all you need!*
Same story. That call is just a different name for `getrandom()` with
`flags` set to zero, and some additional limitations, and thus it also needs
@@ -299,16 +284,14 @@ This primarily leaves two kind of systems in the cold:
are trying to address here.
3. *Why don't you generate your UUIDs with
- [`uuidd`](https://man7.org/linux/man-pages/man8/uuidd.8.html)? That's all you
- need!*
+ [`uuidd`](https://man7.org/linux/man-pages/man8/uuidd.8.html)?
+ That's all you need!*
First of all, that's a system service, i.e. something that runs as "payload"
of systemd, long after systemd is already up and hence can't provide us
- UUIDs during earliest boot yet. Don't forget: to assign the invocation UUID
- for the `uuidd.service` start we already need a UUID that the service is
- supposed to provide us. More importantly though, `uuidd` needs state/a random
- seed/a MAC address/host ID to operate, all of which are not available during
- early boot.
+ UUIDs during earliest boot yet.
+ Don't forget: to assign the invocation UUID for the `uuidd.service` start we already need a UUID that the service is supposed to provide us.
+ More importantly though, `uuidd` needs state/a random seed/a MAC address/host ID to operate, all of which are not available during early boot.
4. *Why don't you generate your UUIDs with `/proc/sys/kernel/random/uuid`?
That's all you need!*
@@ -316,19 +299,21 @@ This primarily leaves two kind of systems in the cold:
This is just a different, more limited interface to `/dev/urandom`. It gains
us nothing.
-5. *Why don't you use [`rngd`](https://github.com/nhorman/rng-tools),
+5. *Why don't you use
+ [`rngd`](https://github.com/nhorman/rng-tools),
[`haveged`](http://www.issihosts.com/haveged/),
- [`egd`](http://egd.sourceforge.net/)? That's all you need!*
+ [`egd`](http://egd.sourceforge.net/)?
+ That's all you need!*
- Like `uuidd` above these are system services, hence come too late for our
- use-case. In addition much of what `rngd` provides appears to be equivalent
+ Like `uuidd` above these are system services, hence come too late for our use-case.
+ In addition much of what `rngd` provides appears to be equivalent
to `CONFIG_RANDOM_TRUST_CPU=y` or `rng_core.default_quality=1000`, except
- being more complex and involving userspace. These services partly measure
- system behavior (such as scheduling effects) which the kernel either
+ being more complex and involving userspace.
+ These services partly measure system behavior (such as scheduling effects) which the kernel either
already feeds into its pool anyway (and thus shouldn't be fed into it a
second time, crediting entropy for it a second time) or is at least
- something the kernel could much better do on its own. Hence, if what these
- daemons do is still desirable today, this would be much better implemented
+ something the kernel could much better do on its own.
+ Hence, if what these daemons do is still desirable today, this would be much better implemented
in kernel (which would be very welcome of course, but wouldn't really help
us here in our specific problem, see above).
@@ -337,29 +322,27 @@ This primarily leaves two kind of systems in the cold:
This doesn't solve the issue, since it requires a nonce to start from, and
it gets that from `getrandom()`, and thus we have to wait for random pool
- initialization the same way as calling `getrandom()`
- directly. `arc4random()` is nothing more than optimization, in fact it
+ initialization the same way as calling `getrandom()` directly.
+
+ `arc4random()` is nothing more than optimization, in fact it
implements similar algorithms that the kernel entropy pool implements
anyway, hence besides being able to provide random bytes with higher
- throughput there's little it gets us over just using `getrandom()`. Also,
- it's not supported by glibc. And as long as that's the case we are not keen
- on using it, as we'd have to maintain that on our own, and we don't want to
- maintain our own cryptographic primitives if we don't have to. Since
- systemd's uses are not performance relevant (besides the pool initialization
- delay, which this doesn't solve), there's hence little benefit for us to
- call these functions. That said, if glibc learns these APIs one day, we'll
- certainly make use of them where appropriate.
-
-7. *This is boring: NetBSD had [boot loader entropy seed
- support](https://netbsd.gw.com/cgi-bin/man-cgi?boot+8) since ages!*
+ throughput there's little it gets us over just using `getrandom()`.
+
+ Also, it's not supported by glibc.
+ And as long as that's the case we are not keen on using it, as we'd have to maintain that on our own, and we don't want to maintain our own cryptographic primitives if we don't have to.
+ Since systemd's uses are not performance relevant (besides the pool initialization
+ delay, which this doesn't solve), there's hence little benefit for us to call these functions.
+ That said, if glibc learns these APIs one day, we'll certainly make use of them where appropriate.
+
+7. *This is boring: NetBSD had [boot loader entropy seed support](https://man.netbsd.org/entropy.7) since ages!*
Yes, NetBSD has that, and the above is inspired by that (note though: this
- article is about a lot more than that). NetBSD's support is not really safe,
- since it neither updates the random seed before using it, nor has any
- safeguards against replicating the same disk image with its random seed on
- multiple machines (which the 'system token' mentioned above is supposed to
- address). This means reuse of the same random seed by the boot loader is
- much more likely.
+ article is about a lot more than that).
+ NetBSD's support is not really safe, since it neither updates the random seed before using it,
+ nor has any safeguards against replicating the same disk image with its random seed on
+ multiple machines (which the 'system token' mentioned above is supposed to address).
+ This means reuse of the same random seed by the boot loader is much more likely.
8. *Why does PID 1 upload the boot loader provided random seed into kernel
instead of kernel doing that on its own?*
@@ -370,11 +353,10 @@ This primarily leaves two kind of systems in the cold:
9. *What about non-EFI?*
The boot loader random seed logic described above uses EFI variables to pass
- the seed from the boot loader to the OS. Other systems might have similar
- functionality though, and it shouldn't be too hard to implement something
- similar for them. Ideally, we'd have an official way to pass such a seed as
- part of the `struct boot_params` from the boot loader to the kernel, but
- this is currently not available.
+ the seed from the boot loader to the OS.
+ Other systems might have similar functionality though, and it shouldn't be too hard to implement something
+ similar for them.
+ Ideally, we'd have an official way to pass such a seed as part of the `struct boot_params` from the boot loader to the kernel, but this is currently not available.
10. *I use a different boot loader than `systemd-boot`, I'd like to use boot
loader random seeds too!*
@@ -384,25 +366,23 @@ This primarily leaves two kind of systems in the cold:
for an introduction why. That said, any boot loader can re-implement the
logic described above, and can pass a random seed that systemd as PID 1
will then upload into the kernel's entropy pool. For details see the
- [Boot Loader Interface](BOOT_LOADER_INTERFACE) documentation.
+ [Boot Loader Interface](/BOOT_LOADER_INTERFACE) documentation.
11. *Why not pass the boot loader random seed via kernel command line instead
of as EFI variable?*
- The kernel command line is accessible to unprivileged processes via
- `/proc/cmdline`. It's not desirable if unprivileged processes can use this
- information to possibly gain too much information about the current state
- of the kernel's entropy pool.
+ The kernel command line is accessible to unprivileged processes via `/proc/cmdline`.
+ It's not desirable if unprivileged processes can use this information to possibly gain too much information about the current state of the kernel's entropy pool.
That said, we actually do implement this with the `systemd.random_seed=`
- kernel command line option. Don't use this outside of testing environments,
- however, for the aforementioned reasons.
+ kernel command line option.
+ Don't use this outside of testing environments, however, for the aforementioned reasons.
12. *Why doesn't `systemd-boot` rewrite the 'system token' too each time
when updating the random seed file stored in the ESP?*
- The system token is stored as persistent EFI variable, i.e. in some form of
- NVRAM. These memory chips tend be of low quality in many machines, and
- hence we shouldn't write them too often. Writing them once during
- installation should generally be OK, but rewriting them on every single
+ The system token is stored as persistent EFI variable, i.e. in some form of NVRAM.
+ These memory chips tend be of low quality in many machines, and
+ hence we shouldn't write them too often.
+ Writing them once during installation should generally be OK, but rewriting them on every single
boot would probably wear the chip out too much, and we shouldn't risk that.
diff --git a/docs/ROOT_STORAGE_DAEMONS.md b/docs/ROOT_STORAGE_DAEMONS.md
index 69812c9..41fc602 100644
--- a/docs/ROOT_STORAGE_DAEMONS.md
+++ b/docs/ROOT_STORAGE_DAEMONS.md
@@ -106,7 +106,7 @@ to find a different solution to your problem._
The recommended way to distinguish between run-from-initrd and run-from-rootfs
for a daemon is to check for `/etc/initrd-release` (which exists on all modern
-initrd implementations, see the [initrd Interface](INITRD_INTERFACE) for
+initrd implementations, see the [initrd Interface](/INITRD_INTERFACE) for
details) which when exists results in `argv[0][0]` being set to `@`, and
otherwise doesn't. Something like this:
@@ -191,4 +191,4 @@ few additional notes for supporting these setups:
program consult this blog story: [Socket
Activation](https://0pointer.de/blog/projects/socket-activation.html)
-* Consider having a look at the [initrd Interface of systemd](INITRD_INTERFACE).
+* Consider having a look at the [initrd Interface of systemd](/INITRD_INTERFACE).
diff --git a/docs/SECURITY.md b/docs/SECURITY.md
index a44b90d..f9f2e91 100644
--- a/docs/SECURITY.md
+++ b/docs/SECURITY.md
@@ -7,8 +7,12 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Reporting of Security Vulnerabilities
-If you discover a security vulnerability, we'd appreciate a non-public disclosure. systemd developers can be contacted privately on the **[systemd-security@redhat.com](mailto:systemd-security@redhat.com) mailing list**. The disclosure will be coordinated with distributions.
+If you discover a security vulnerability, we'd appreciate a non-public disclosure.
+systemd developers can be contacted privately on the **[systemd-security@redhat.com](mailto:systemd-security@redhat.com) mailing list**.
+The disclosure will be coordinated with distributions.
(The [issue tracker](https://github.com/systemd/systemd/issues) and [systemd-devel mailing list](https://lists.freedesktop.org/mailman/listinfo/systemd-devel) are fully public.)
-Subscription to the systemd-security mailing list is open to **regular systemd contributors and people working in the security teams of various distributions**. Those conditions should be backed by publicly accessible information (ideally, a track of posts and commits from the mail address in question). If you fall into one of those categories and wish to be subscribed, submit a **[subscription request](https://www.redhat.com/mailman/listinfo/systemd-security)**.
+Subscription to the systemd-security mailing list is open to **regular systemd contributors and people working in the security teams of various distributions**.
+Those conditions should be backed by publicly accessible information (ideally, a track of posts and commits from the mail address in question).
+If you fall into one of those categories and wish to be subscribed, submit a **[subscription request](https://www.redhat.com/mailman/listinfo/systemd-security)**.
diff --git a/docs/SEPARATE_USR_IS_BROKEN.md b/docs/SEPARATE_USR_IS_BROKEN.md
index 8e9390e..5612945 100644
--- a/docs/SEPARATE_USR_IS_BROKEN.md
+++ b/docs/SEPARATE_USR_IS_BROKEN.md
@@ -7,34 +7,83 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Booting Without /usr is Broken
-You probably discovered this page because your shiny new systemd system referred you here during boot time, when it warned you that booting without /usr pre-mounted wasn't supported anymore. And now you wonder what this all is about. Here's an attempt of an explanation:
+You probably discovered this page because your shiny new systemd system referred you here during boot time,
+when it warned you that booting without `/usr` pre-mounted wasn't supported anymore.
+And now you wonder what this all is about.
+Here's an attempt of an explanation:
-One thing in advance: systemd itself is actually mostly fine with /usr on a separate file system that is not pre-mounted at boot time. However, the common basic set of OS components of modern Linux machines is not, and has not been in quite some time. And it is unlikely that this is going to be fixed any time soon, or even ever.
+One thing in advance:
+systemd itself is actually mostly fine with `/usr` on a separate file system that is not pre-mounted at boot time.
+However, the common basic set of OS components of modern Linux machines is not, and has not been in quite some time.
+And it is unlikely that this is going to be fixed any time soon, or even ever.
-Most of the failures you will experience with /usr split off and not pre-mounted in the initramfs are graceful failures: they won't become directly visible, however certain features become unavailable due to these failures. Quite a number of programs these days hook themselves into the early boot process at various stages. A popular way to do this is for example via udev rules. The binaries called from these rules are sometimes located on /usr/bin, or link against libraries in /usr/lib, or use data files from /usr/share. If these rules fail udev will proceed with the next one, however later on applications will then not properly detect these udev devices or features of these devices. Here's a short, very in-comprehensive list of software we are aware of that currently are not able to provide the full set of functionality when /usr is split off and not pre-mounted at boot: udev-pci-db/udev-usb-db and all rules depending on this (using the PCI/USB database in /usr/share), PulseAudio, NetworkManager, ModemManager, udisks, libatasmart, usb\_modeswitch, gnome-color-manager, usbmuxd, ALSA, D-Bus, CUPS, Plymouth, LVM, hplip, multipath, Argyll, VMWare, the locale logic of most programs and a lot of other stuff.
+Most of the failures you will experience with `/usr` split off and not pre-mounted in the initramfs are graceful failures:
+they won't become directly visible, however certain features become unavailable due to these failures.
+Quite a number of programs these days hook themselves into the early boot process at various stages.
+A popular way to do this is for example via udev rules.
+The binaries called from these rules are sometimes located on `/usr/bin`, or link against libraries in `/usr/lib`,
+or use data files from `/usr/share`.
+If these rules fail udev will proceed with the next one,
+however later on applications will then not properly detect these udev devices or features of these devices.
+Here's a short, very in-comprehensive list of software we are aware of that currently are not able to provide the full set of functionality when `/usr` is split off and not pre-mounted at boot:
+udev-pci-db/udev-usb-db and all rules depending on this
+(using the PCI/USB database in `/usr/share`),
+PulseAudio, NetworkManager, ModemManager, udisks, libatasmart, usb\_modeswitch,
+gnome-color-manager, usbmuxd, ALSA, D-Bus, CUPS, Plymouth, LVM, hplip, multipath, Argyll, VMWare,
+the locale logic of most programs and a lot of other stuff.
-You don't believe us? Well, here's a command line that reveals a few obvious cases of udev rules that will silently fail to work if /usr is split off and not pre-mounted: `egrep 'usb-db|pci-db|FROM_DATABASE|/usr' /*/udev/rules.d/*` -- and you find a lot more if you actually look for it. On my fresh Fedora 15 install that's 23 obvious cases.
+You don't believe us?
+Well, here's a command line that reveals a few obvious cases of udev rules that will silently fail to work if `/usr` is split off and not pre-mounted:
+`egrep 'usb-db|pci-db|FROM_DATABASE|/usr' /*/udev/rules.d/*`
+-- and you find a lot more if you actually look for it.
+On my fresh Fedora 15 install that's 23 obvious cases.
## The Status Quo
-Due to this, many upstream developers have decided to consider the problem of a separate /usr that is not mounted during early boot an outdated question, and started to close bugs regarding these issues as WONTFIX. We certainly cannot blame them, as the benefit of supporting this is questionable and brings a lot of additional work with it.
+Due to this, many upstream developers have decided to consider the problem of a separate
+`/usr` that is not mounted during early boot an outdated question,
+and started to close bugs regarding these issues as WONTFIX.
+We certainly cannot blame them, as the benefit of supporting this is questionable and brings a lot of additional work with it.
And let's clarify a few things:
-1. **It isn't systemd's fault.** systemd mostly works fine with /usr on a separate file system that is not pre-mounted at boot.
+1. **It isn't systemd's fault.** systemd mostly works fine with `/usr` on a separate file system that is not pre-mounted at boot.
2. **systemd is merely the messenger.** Don't shoot the messenger.
-3. **There's no news in all of this.** The message you saw is just a statement of fact, describing the status quo. Things have been this way since a while.
+3. **There's no news in all of this.** The message you saw is just a statement of fact, describing the status quo.
+ Things have been this way since a while.
4. **The message is merely a warning.** You can choose to ignore it.
-5. **Don't blame us**, don't abuse us, it's not our fault. We have been working on the Linux userspace since quite some time, and simply have enough of the constant bug reports regarding these issues, since they are actually very hard to track down because the failures are mostly graceful. Hence we placed this warning into the early boot process of every systemd Linux system with a split off and not pre-mounted /usr, so that people understand what is going on.
+5. **Don't blame us**, don't abuse us, it's not our fault.
+We have been working on the Linux userspace since quite some time,
+and simply have enough of the constant bug reports regarding these issues,
+since they are actually very hard to track down because the failures are mostly graceful.
+Hence we placed this warning into the early boot process of every systemd Linux system with a split off and not pre-mounted
+`/usr`, so that people understand what is going on.
## Going Forward
-/usr on its own filesystem is useful in some custom setups. But instead of expecting the traditional Unix way to (sometimes mindlessly) distributing tools between /usr and /, and require more and more tools to move to /, we now just expect /usr to be pre-mounted from inside the initramfs, to be available before 'init' starts. The duty of the minimal boot system that consisted of /bin, /sbin and /lib on traditional Unix, has been taken over by the initramfs of modern Linux. An initramfs that supports mounting /usr on top of / before it starts 'init', makes all existing setups work properly.
+`/usr` on its own filesystem is useful in some custom setups.
+But instead of expecting the traditional Unix way to (sometimes mindlessly) distributing tools between `/usr` and `/`,
+and require more and more tools to move to `/`,
+we now just expect `/usr` to be pre-mounted from inside the initramfs, to be available before 'init' starts.
+The duty of the minimal boot system that consisted of `/bin`, `/sbin` and `/lib` on traditional Unix,
+has been taken over by the initramfs of modern Linux.
+An initramfs that supports mounting `/usr` on top of `/` before it starts 'init', makes all existing setups work properly.
-There is no way to reliably bring up a modern system with an empty /usr. There are two alternatives to fix it: move /usr back to the rootfs or use an initramfs which can hide the split-off from the system.
+There is no way to reliably bring up a modern system with an empty `/usr`.
+There are two alternatives to fix it: move `/usr` back to the rootfs or use an initramfs which can hide the split-off from the system.
-On the Fedora distribution we have succeeded to clean up the situation and the confusion the current split between / and /usr has created. We have moved all tools that over time have been moved to / back to /usr (where they belong), and the root file system only contains compatibility symlinks for /bin and /sbin into /usr. All binaries of the system are exclusively located within the /usr hierarchy.
+On the Fedora distribution we have succeeded to clean up the situation and the confusion the current split between `/` and `/usr` has created.
+We have moved all tools that over time have been moved to `/` back to `/usr` (where they belong),
+and the root file system only contains compatibility symlinks for `/bin` and `/sbin` into `/usr`.
+All binaries of the system are exclusively located within the `/usr` hierarchy.
-In this new definition of /usr, the directory can be mounted read-only by default, while the rootfs may be either read-write or read-only (for stateless systems) and contains only the empty mount point directories, compat-symlinks to /usr and the host-specific data like /etc, /root, /srv. In comparison to today's setups, the rootfs will be very small. The host-specific data will be properly separated from the installed operating system. The new /usr could also easily be shared read-only across several systems. Such a setup would be more efficient, can provide additional security, is more flexible to use, provides saner options for custom setups, and is much simpler to setup and maintain.
+In this new definition of `/usr`, the directory can be mounted read-only by default,
+while the rootfs may be either read-write or read-only (for stateless systems) and contains only the empty mount point directories,
+compat-symlinks to `/usr` and the host-specific data like `/etc`, `/root`, `/srv`.
+In comparison to today's setups, the rootfs will be very small.
+The host-specific data will be properly separated from the installed operating system.
+The new `/usr` could also easily be shared read-only across several systems.
+Such a setup would be more efficient, can provide additional security, is more flexible to use,
+provides saner options for custom setups, and is much simpler to setup and maintain.
-For more information on this please continue to [The Case for the /usr Merge](../THE_CASE_FOR_THE_USR_MERGE).
+For more information on this please continue to [The Case for the /usr Merge](/THE_CASE_FOR_THE_USR_MERGE).
diff --git a/docs/SYSLOG.md b/docs/SYSLOG.md
index 35c6225..9999a8d 100644
--- a/docs/SYSLOG.md
+++ b/docs/SYSLOG.md
@@ -7,28 +7,56 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Writing syslog Daemons Which Cooperate Nicely With systemd
-Here are a few notes on things to keep in mind when you work on a classic BSD syslog daemon for Linux, to ensure that your syslog daemon works nicely together with systemd. If your syslog implementation does not follow these rules, then it will not be compatible with systemd v38 and newer.
+Here are a few notes on things to keep in mind when you work on a classic BSD syslog daemon for Linux, to ensure that your syslog daemon works nicely together with systemd.
+If your syslog implementation does not follow these rules, then it will not be compatible with systemd v38 and newer.
-A few notes in advance: systemd centralizes all log streams in the Journal daemon. Messages coming in via /dev/log, via the native protocol, via STDOUT/STDERR of all services and via the kernel are received in the journal daemon. The journal daemon then stores them to disk or in RAM (depending on the configuration of the Storage= option in journald.conf), and optionally forwards them to the console, the kernel log buffer, or to a classic BSD syslog daemon -- and that's where you come in.
+A few notes in advance: systemd centralizes all log streams in the Journal daemon.
+Messages coming in via /dev/log, via the native protocol, via STDOUT/STDERR of all services and via the kernel are received in the journal daemon.
-Note that it is now the journal that listens on /dev/log, no longer the BSD syslog daemon directly. If your logging daemon wants to get access to all logging data then it should listen on /run/systemd/journal/syslog instead via the syslog.socket unit file that is shipped along with systemd. On a systemd system it is no longer OK to listen on /dev/log directly, and your daemon may not bind to the /run/systemd/journal/syslog socket on its own. If you do that then you will lose logging from STDOUT/STDERR of services (as well as other stuff).
+The journal daemon then stores them to disk or in RAM (depending on the configuration of the Storage= option in journald.conf), and optionally forwards them to the console, the kernel log buffer, or to a classic BSD syslog daemon -- and that's where you come in.
-Your BSD compatible logging service should alias `syslog.service` to itself (i.e. symlink) when it is _enabled_. That way [syslog.socket](http://cgit.freedesktop.org/systemd/systemd/plain/units/syslog.socket) will activate your service when things are logged. Of course, only one implementation of BSD syslog can own that symlink, and hence only one implementation can be enabled at a time, but that's intended as there can only be one process listening on that socket. (see below for details how to manage this symlink.) Note that this means that syslog.socket as shipped with systemd is _shared_ among all implementations, and the implementation that is in control is configured with where syslog.service points to.
+Note that it is now the journal that listens on /dev/log, no longer the BSD syslog daemon directly.
+If your logging daemon wants to get access to all logging data then it should listen on /run/systemd/journal/syslog instead via the syslog.socket unit file that is shipped along with systemd.
+On a systemd system it is no longer OK to listen on /dev/log directly, and your daemon may not bind to the /run/systemd/journal/syslog socket on its own.
+If you do that then you will lose logging from STDOUT/STDERR of services (as well as other stuff).
-Note that journald tries hard to forward to your BSD syslog daemon as much as it can. That means you will get more than you traditionally got on /dev/log, such as stuff all daemons log on STDOUT/STDERR and the messages that are logged natively to systemd. Also, we will send stuff like the original SCM_CREDENTIALS along if possible.
+Your BSD compatible logging service should alias `syslog.service` to itself (i.e. symlink) when it is _enabled_.
+That way [syslog.socket](http://cgit.freedesktop.org/systemd/systemd/plain/units/syslog.socket) will activate your service when things are logged.
+Of course, only one implementation of BSD syslog can own that symlink, and hence only one implementation can be enabled at a time, but that's intended as there can only be one process listening on that socket.
+(see below for details how to manage this symlink.)
-(BTW, journald is smart enough not to forward the kernel messages it gets to you, you should read that on your own, directly from /proc/kmsg, as you always did. It's also smart enough never to forward kernel messages back to the kernel, but that probably shouldn't concern you too much...)
+Note that this means that syslog.socket as shipped with systemd is _shared_ among all implementations, and the implementation that is in control is configured with where syslog.service points to.
+
+Note that journald tries hard to forward to your BSD syslog daemon as much as it can.
+That means you will get more than you traditionally got on /dev/log, such as stuff all daemons log on STDOUT/STDERR and the messages that are logged natively to systemd. Also, we will send stuff like the original SCM_CREDENTIALS along if possible.
+
+(BTW, journald is smart enough not to forward the kernel messages it gets to you, you should read that on your own, directly from /proc/kmsg, as you always did.
+It's also smart enough never to forward kernel messages back to the kernel, but that probably shouldn't concern you too much...)
And here are the recommendations:
-- First of all, make sure your syslog daemon installs a native service unit file (SysV scripts are not sufficient!) and is socket activatable. Newer systemd versions (v35+) do not support non-socket-activated syslog daemons anymore and we do no longer recommend people to order their units after syslog.target. That means that unless your syslog implementation is socket activatable many services will not be able to log to your syslog implementation and early boot messages are lost entirely to your implementation. Note that your service should install only one unit file, and nothing else. Do not install socket unit files.
-- Make sure that in your unit file you set StandardOutput=null in the [Service] block. This makes sure that regardless what the global default for StandardOutput= is the output of your syslog implementation goes to /dev/null. This matters since the default StandardOutput= value for all units can be set to syslog and this should not create a feedback loop with your implementation where the messages your syslog implementation writes out are fed back to it. In other words: you need to explicitly opt out of the default standard output redirection we do for other services. (Also note that you do not need to set StandardError= explicitly, since that inherits the setting of StandardOutput= by default)
+- First of all, make sure your syslog daemon installs a native service unit file (SysV scripts are not sufficient!) and is socket activatable. Newer systemd versions (v35+) do not support non-socket-activated syslog daemons anymore and we do no longer recommend people to order their units after syslog.target.
+That means that unless your syslog implementation is socket activatable many services will not be able to log to your syslog implementation and early boot messages are lost entirely to your implementation.
+Note that your service should install only one unit file, and nothing else. Do not install socket unit files.
+
+- Make sure that in your unit file you set StandardOutput=null in the [Service] block.
+This makes sure that regardless what the global default for StandardOutput= is the output of your syslog implementation goes to /dev/null.
+This matters since the default StandardOutput= value for all units can be set to syslog and this should not create a feedback loop with your implementation where the messages your syslog implementation writes out are fed back to it.
+In other words: you need to explicitly opt out of the default standard output redirection we do for other services.
+(Also note that you do not need to set StandardError= explicitly, since that inherits the setting of StandardOutput= by default)
+
- /proc/kmsg is your property, flush it to disk as soon as you start up.
-- Name your service unit after your daemon (e.g. rsyslog.service or syslog-ng.service) and make sure to include Alias=syslog.service in your [Install] section in the unit file. This is ensures that the symlink syslog.service is created if your service is enabled and that it points to your service. Also add WantedBy=multi-user.target so that your service gets started at boot, and add Requires=syslog.socket in [Unit] so that you pull in the socket unit.
+
+- Name your service unit after your daemon (e.g. rsyslog.service or syslog-ng.service) and make sure to include Alias=syslog.service in your [Install] section in the unit file.
+This is ensures that the symlink syslog.service is created if your service is enabled and that it points to your service.
+Also add WantedBy=multi-user.target so that your service gets started at boot, and add Requires=syslog.socket in [Unit] so that you pull in the socket unit.
Here are a few other recommendations, that are not directly related to systemd:
-- Make sure to read the priority prefixes of the kmsg log messages the same way like from normal userspace syslog messages. When systemd writes to kmsg it will prefix all messages with valid priorities which include standard syslog facility values. OTOH for kernel messages the facility is always 0. If you need to know whether a message originated in the kernel rely on the facility value, not just on the fact that you read the message from /proc/kmsg! A number of userspace applications write messages to kmsg (systemd, udev, dracut, others), and they'll nowadays all set correct facility values.
+- Make sure to read the priority prefixes of the kmsg log messages the same way like from normal userspace syslog messages.
+When systemd writes to kmsg it will prefix all messages with valid priorities which include standard syslog facility values. OTOH for kernel messages the facility is always 0.
+If you need to know whether a message originated in the kernel rely on the facility value, not just on the fact that you read the message from /proc/kmsg! A number of userspace applications write messages to kmsg (systemd, udev, dracut, others), and they'll nowadays all set correct facility values.
+
- When you read a message from the socket use SCM_CREDENTIALS to get information about the client generating it, and possibly patch the message with this data in order to make it impossible for clients to fake identities.
The unit file you install for your service should look something like this:
diff --git a/docs/SYSTEMD_FILE_HIERARCHY_REQUIREMENTS.md b/docs/SYSTEMD_FILE_HIERARCHY_REQUIREMENTS.md
index 574df93..81d6f43 100644
--- a/docs/SYSTEMD_FILE_HIERARCHY_REQUIREMENTS.md
+++ b/docs/SYSTEMD_FILE_HIERARCHY_REQUIREMENTS.md
@@ -7,14 +7,26 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# systemd File Hierarchy Requirements
-There are various attempts to standardize the file system hierarchy of Linux systems. In systemd we leave much of the file system layout open to the operating system, but here's what systemd strictly requires:
+There are various attempts to standardize the file system hierarchy of Linux systems.
+In systemd we leave much of the file system layout open to the operating system, but here's what systemd strictly requires:
-- /, /usr, /etc must be mounted when the host systemd is first invoked. This may be achieved either by using the kernel's built-in root disk mounting (in which case /, /usr and /etc need to be on the same file system), or via an initrd, which could mount the three directories from different sources.
-- /bin, /sbin, /lib (and /lib64 if applicable) should reside on /, or be symlinks to the /usr file system (recommended). All of them must be available before the host systemd is first executed.
-- /var does not have to be mounted when the host systemd is first invoked, however, it must be configured so that it is mounted writable before local-fs.target is reached (for example, by simply listing it in /etc/fstab).
-- /tmp is recommended to be a tmpfs (default), but doesn't have to. If configured, it must be mounted before local-fs.target is reached (for example, by listing it in /etc/fstab).
-- /dev must exist as an empty mount point and will automatically be mounted by systemd with a devtmpfs. Non-devtmpfs boots are not supported.
-- /proc and /sys must exist as empty mount points and will automatically be mounted by systemd with procfs and sysfs.
-- /run must exist as an empty mount point and will automatically be mounted by systemd with a tmpfs.
+- `/`, `/usr`, `/etc` must be mounted when the host systemd is first invoked.
+ This may be achieved either by using the kernel's built-in root disk mounting (in which case `/`, `/usr` and `/etc` need to be on the same file system), or via an initrd, which could mount the three directories from different sources.
-The other directories usually found in the root directory (such as /home, /boot, /opt) are irrelevant to systemd. If they are defined they may be mounted from any source and at any time, though it is a good idea to mount them also before local-fs.target is reached.
+- `/bin`, `/sbin`, `/lib` (and `/lib64` if applicable) should reside on `/`, or be symlinks to the `/usr` file system (recommended).
+ All of them must be available before the host systemd is first executed.
+
+- `/var` does not have to be mounted when the host systemd is first invoked, however,
+ it must be configured so that it is mounted writable before local-fs.target is reached (for example, by simply listing it in` /etc/fstab`).
+
+- `/tmp` is recommended to be a tmpfs (default), but doesn't have to.
+ If configured, it must be mounted before local-fs.target is reached (for example, by listing it in `/etc/fstab`).
+
+- `/dev` must exist as an empty mount point and will automatically be mounted by systemd with a devtmpfs. Non-devtmpfs boots are not supported.
+
+- `/proc` and `/sys` must exist as empty mount points and will automatically be mounted by systemd with procfs and sysfs.
+
+- `/run` must exist as an empty mount point and will automatically be mounted by systemd with a tmpfs.
+
+The other directories usually found in the root directory (such as `/home`, `/boot`, `/opt`) are irrelevant to systemd.
+If they are defined they may be mounted from any source and at any time, though it is a good idea to mount them also before local-fs.target is reached.
diff --git a/docs/THE_CASE_FOR_THE_USR_MERGE.md b/docs/THE_CASE_FOR_THE_USR_MERGE.md
index 2cdb6db..c603e14 100644
--- a/docs/THE_CASE_FOR_THE_USR_MERGE.md
+++ b/docs/THE_CASE_FOR_THE_USR_MERGE.md
@@ -104,7 +104,7 @@ _With all vendor-supplied OS resources in a single directory /usr they may be sh
**Myth #10**: The status quo of a split /usr with mounting it without initrd is perfectly well supported right now and works.
-**Fact**: A split /usr without involvement of an initrd mounting it before jumping into the root file system [hasn't worked correctly since a long time](http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken).
+**Fact**: A split /usr without involvement of an initrd mounting it before jumping into the root file system [hasn't worked correctly since a long time](/SEPARATE_USR_IS_BROKEN).
**Myth #11**: Instead of merging / into /usr it would make a lot more sense to merge /usr into /.
diff --git a/docs/TIPS_AND_TRICKS.md b/docs/TIPS_AND_TRICKS.md
index f181f12..208f444 100644
--- a/docs/TIPS_AND_TRICKS.md
+++ b/docs/TIPS_AND_TRICKS.md
@@ -7,7 +7,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Tips & Tricks
-Also check out the [Frequently Asked Questions](http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions)!
+Also check out the [Frequently Asked Questions](/FAQ)!
## Listing running services
@@ -155,13 +155,16 @@ $ psc
$ ln -sf /usr/lib/systemd/system/multi-user.target /etc/systemd/system/default.target
```
-This line makes the multi user target (i.e. full system, but no graphical UI) the default target to boot into. This is kinda equivalent to setting runlevel 3 as the default runlevel on Fedora/sysvinit systems.
+This line makes the multi user target (i.e. full system, but no graphical UI) the default target to boot into.
+This is kinda equivalent to setting runlevel 3 as the default runlevel on Fedora/sysvinit systems.
```sh
$ ln -sf /usr/lib/systemd/system/graphical.target /etc/systemd/system/default.target
```
-This line makes the graphical target (i.e. full system, including graphical UI) the default target to boot into. Kinda equivalent to runlevel 5 on fedora/sysvinit systems. This is how things are shipped by default.
+This line makes the graphical target (i.e. full system, including graphical UI) the default target to boot into.
+Kinda equivalent to runlevel 5 on fedora/sysvinit systems.
+This is how things are shipped by default.
## What other units does a unit depend on?
@@ -172,7 +175,8 @@ $ systemctl show -p "Wants" multi-user.target
Wants=rc-local.service avahi-daemon.service rpcbind.service NetworkManager.service acpid.service dbus.service atd.service crond.service auditd.service ntpd.service udisks.service bluetooth.service cups.service wpa_supplicant.service getty.target modem-manager.service portreserve.service abrtd.service yum-updatesd.service upowerd.service test-first.service pcscd.service rsyslog.service haldaemon.service remote-fs.target plymouth-quit.service systemd-update-utmp-runlevel.service sendmail.service lvm2-monitor.service cpuspeed.service udev-post.service mdmonitor.service iscsid.service livesys.service livesys-late.service irqbalance.service iscsi.service netfs.service
```
-Instead of "Wants" you might also try "WantedBy", "Requires", "RequiredBy", "Conflicts", "ConflictedBy", "Before", "After" for the respective types of dependencies and their inverse.
+Instead of "Wants" you might also try "WantedBy", "Requires", "RequiredBy", "Conflicts", "ConflictedBy", "Before", "After"
+for the respective types of dependencies and their inverse.
## What would get started if I booted into a specific target?
@@ -182,4 +186,6 @@ If you want systemd to calculate the "initial" transaction it would execute on b
$ systemd --test --system --unit=foobar.target
```
-for a boot target foobar.target. Note that this is mostly a debugging tool that actually does a lot more than just calculate the initial transaction, so don't build scripts based on this.
+for a boot target foobar.target.
+Note that this is mostly a debugging tool that actually does a lot more than just calculate the initial transaction,
+so don't build scripts based on this.
diff --git a/docs/UIDS-GIDS.md b/docs/UIDS-GIDS.md
index e84f037..4b28d95 100644
--- a/docs/UIDS-GIDS.md
+++ b/docs/UIDS-GIDS.md
@@ -10,11 +10,10 @@ SPDX-License-Identifier: LGPL-2.1-or-later
Here's a summary of the requirements `systemd` (and Linux) make on UID/GID
assignments and their ranges.
-Note that while in theory UIDs and GIDs are orthogonal concepts they really
-aren't IRL. With that in mind, when we discuss UIDs below it should be assumed
-that whatever we say about UIDs applies to GIDs in mostly the same way, and all
-the special assignments and ranges for UIDs always have mostly the same
-validity for GIDs too.
+Note that while in theory UIDs and GIDs are orthogonal concepts they really aren't IRL.
+With that in mind, when we discuss UIDs below it should be assumed
+that whatever we say about UIDs applies to GIDs in mostly the same way,
+and all the special assignments and ranges for UIDs always have mostly the same validity for GIDs too.
## Special Linux UIDs
@@ -23,28 +22,28 @@ i.e. 0…4294967295. However, four UIDs are special on Linux:
1. 0 → The `root` super-user.
-2. 65534 → The `nobody` UID, also called the "overflow" UID or similar. It's
- where various subsystems map unmappable users to, for example file systems
- only supporting 16-bit UIDs, NFS or user namespacing. (The latter can be
- changed with a sysctl during runtime, but that's not supported on
- `systemd`. If you do change it you void your warranty.) Because Fedora is a
- bit confused the `nobody` user is called `nfsnobody` there (and they have a
- different `nobody` user at UID 99). I hope this will be corrected eventually
- though. (Also, some distributions call the `nobody` group `nogroup`. I wish
- they didn't.)
+2. 65534 → The `nobody` UID, also called the "overflow" UID or similar.
+ It's where various subsystems map unmappable users to, for example file systems
+ only supporting 16-bit UIDs, NFS or user namespacing.
+ (The latter can be changed with a sysctl during runtime, but that's not supported on
+ `systemd`. If you do change it you void your warranty.)
+ Because Fedora is a bit confused the `nobody` user is called `nfsnobody` there
+ (and they have a different `nobody` user at UID 99).
+ I hope this will be corrected eventually though.
+ (Also, some distributions call the `nobody` group `nogroup`. I wish they didn't.)
3. 4294967295, aka "32-bit `(uid_t) -1`" → This UID is not a valid user ID, as
`setresuid()`, `chown()` and friends treat -1 as a special request to not
- change the UID of the process/file. This UID is hence not available for
- assignment to users in the user database.
+ change the UID of the process/file.
+ This UID is hence not available for assignment to users in the user database.
4. 65535, aka "16-bit `(uid_t) -1`" → Before Linux kernel 2.4 `uid_t` used to be
16-bit, and programs compiled for that would hence assume that `(uid_t) -1`
is 65535. This UID is hence not usable either.
The `nss-systemd` glibc NSS module will synthesize user database records for
-the UIDs 0 and 65534 if the system user database doesn't list them. This means
-that any system where this module is enabled works to some minimal level
+the UIDs 0 and 65534 if the system user database doesn't list them.
+This means that any system where this module is enabled works to some minimal level
without `/etc/passwd`.
## Special Distribution UID ranges
@@ -58,8 +57,7 @@ Distributions generally split the available UID range in two:
2. 1000…65533 and 65536…4294967294 → Everything else, i.e. regular (human) users.
Some older systems placed the boundary at 499/500, or even 99/100,
-and some distributions allow the boundary between system and regular users to be changed
-via local configuration.
+and some distributions allow the boundary between system and regular users to be changed via local configuration.
In `systemd`, the boundary is configurable during compilation time
and is also queried from `/etc/login.defs` at runtime,
if the `-Dcompat-mutable-uid-boundaries=true` compile-time setting is used.
@@ -70,91 +68,88 @@ available regular user range only, usually 1000..60000.
This range can also be configured using `/etc/login.defs`.
Note that systemd requires that system users and groups are resolvable without
-network — a requirement that is not made for regular users. This
-means regular users may be stored in remote LDAP or NIS databases, but system
-users may not (except when there's a consistent local cache kept, that is
+network — a requirement that is not made for regular users.
+This means regular users may be stored in remote LDAP or NIS databases,
+but system users may not (except when there's a consistent local cache kept, that is
available during earliest boot, including in the initrd).
## Special `systemd` GIDs
-`systemd` defines no special UIDs beyond what Linux already defines (see
-above). However, it does define some special group/GID assignments, which are
-primarily used for `systemd-udevd`'s device management. The precise list of the
-currently defined groups is found in this `sysusers.d` snippet:
+`systemd` defines no special UIDs beyond what Linux already defines (see above).
+However, it does define some special group/GID assignments,
+which are primarily used for `systemd-udevd`'s device management.
+The precise list of the currently defined groups is found in this `sysusers.d` snippet:
[basic.conf](https://raw.githubusercontent.com/systemd/systemd/main/sysusers.d/basic.conf.in)
It's strongly recommended that downstream distributions include these groups in
their default group databases.
Note that the actual GID numbers assigned to these groups do not have to be
-constant beyond a specific system. There's one exception however: the `tty`
-group must have the GID 5. That's because it must be encoded in the `devpts`
-mount parameters during earliest boot, at a time where NSS lookups are not
-possible. (Note that the actual GID can be changed during `systemd` build time,
-but downstreams are strongly advised against doing that.)
+constant beyond a specific system.
+There's one exception however: the `tty` group must have the GID 5.
+That's because it must be encoded in the `devpts` mount parameters during earliest boot, at a time where NSS lookups are not
+possible.
+(Note that the actual GID can be changed during `systemd` build time, but downstreams are strongly advised against doing that.)
## Special `systemd` UID ranges
`systemd` defines a number of special UID ranges:
1. 60001…60513 → UIDs for home directories managed by
- [`systemd-homed.service(8)`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html). UIDs
- from this range are automatically assigned to any home directory discovered,
- and persisted locally on first login. On different systems the same user
- might get different UIDs assigned in case of conflict, though it is
+ [`systemd-homed.service(8)`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html).
+ UIDs from this range are automatically assigned to any home directory discovered,
+ and persisted locally on first login.
+ On different systems the same user might get different UIDs assigned in case of conflict, though it is
attempted to make UID assignments stable, by deriving them from a hash of
the user name.
2. 61184…65519 → UIDs for dynamic users are allocated from this range (see the
`DynamicUser=` documentation in
- [`systemd.exec(5)`](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)). This
- range has been chosen so that it is below the 16-bit boundary (i.e. below
- 65535), in order to provide compatibility with container environments that
- assign a 64K range of UIDs to containers using user namespacing. This range
- is above the 60000 boundary, so that its allocations are unlikely to be
- affected by `adduser` allocations (see above). And we leave some room
- upwards for other purposes. (And if you wonder why precisely these numbers:
- if you write them in hexadecimal, they might make more sense: 0xEF00 and
- 0xFFEF). The `nss-systemd` module will synthesize user records implicitly
- for all currently allocated dynamic users from this range. Thus, NSS-based
- user record resolving works correctly without those users being in
- `/etc/passwd`.
+ [`systemd.exec(5)`](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)).
+ This range has been chosen so that it is below the 16-bit boundary
+ (i.e. below 65535), in order to provide compatibility with container environments that
+ assign a 64K range of UIDs to containers using user namespacing.
+ This range is above the 60000 boundary, so that its allocations are unlikely to be
+ affected by `adduser` allocations (see above).
+ And we leave some room upwards for other purposes.
+ (And if you wonder why precisely these numbers: if you write them in hexadecimal, they might make more sense: 0xEF00 and 0xFFEF).
+ The `nss-systemd` module will synthesize user records implicitly
+ for all currently allocated dynamic users from this range.
+ Thus, NSS-based user record resolving works correctly without those users being in `/etc/passwd`.
3. 524288…1879048191 → UID range for `systemd-nspawn`'s automatic allocation of
- per-container UID ranges. When the `--private-users=pick` switch is used (or
- `-U`) then it will automatically find a so far unused 16-bit subrange of this
- range and assign it to the container. The range is picked so that the upper
- 16-bit of the 32-bit UIDs are constant for all users of the container, while
- the lower 16-bit directly encode the 65536 UIDs assigned to the
- container. This mode of allocation means that the upper 16-bit of any UID
+ per-container UID ranges.
+ When the `--private-users=pick` switch is used (or `-U`) then it will automatically find a so far unused 16-bit subrange of this
+ range and assign it to the container.
+ The range is picked so that the upper 16-bit of the 32-bit UIDs are constant for all users of the container,
+ while the lower 16-bit directly encode the 65536 UIDs assigned to the container.
+ This mode of allocation means that the upper 16-bit of any UID
assigned to a container are kind of a "container ID", while the lower 16-bit
- directly expose the container's own UID numbers. If you wonder why precisely
- these numbers, consider them in hexadecimal: 0x00080000…0x6FFFFFFF. This
- range is above the 16-bit boundary. Moreover it's below the 31-bit boundary,
- as some broken code (specifically: the kernel's `devpts` file system)
- erroneously considers UIDs signed integers, and hence can't deal with values
- above 2^31. The `systemd-machined.service` service will synthesize user
- database records for all UIDs assigned to a running container from this
- range.
+ directly expose the container's own UID numbers.
+ If you wonder why precisely these numbers, consider them in hexadecimal: 0x00080000…0x6FFFFFFF.
+ This range is above the 16-bit boundary.
+ Moreover it's below the 31-bit boundary, as some broken code (specifically: the kernel's `devpts` file system)
+ erroneously considers UIDs signed integers, and hence can't deal with values above 2^31.
+ The `systemd-machined.service` service will synthesize user database records for all UIDs assigned to a running container from this range.
Note for both allocation ranges: when a UID allocation takes place NSS is
-checked for collisions first, and a different UID is picked if an entry is
-found. Thus, the user database is used as synchronization mechanism to ensure
-exclusive ownership of UIDs and UID ranges. To ensure compatibility with other
-subsystems allocating from the same ranges it is hence essential that they
+checked for collisions first, and a different UID is picked if an entry is found.
+Thus, the user database is used as synchronization mechanism to ensure
+exclusive ownership of UIDs and UID ranges.
+To ensure compatibility with other subsystems allocating from the same ranges it is hence essential that they
ensure that whatever they pick shows up in the user/group databases, either by
-providing an NSS module, or by adding entries directly to `/etc/passwd` and
-`/etc/group`. For performance reasons, do note that `systemd-nspawn` will only
-do an NSS check for the first UID of the range it allocates, not all 65536 of
-them. Also note that while the allocation logic is operating, the glibc
-`lckpwdf()` user database lock is taken, in order to make this logic race-free.
+providing an NSS module, or by adding entries directly to `/etc/passwd` and `/etc/group`.
+For performance reasons, do note that `systemd-nspawn` will only
+do an NSS check for the first UID of the range it allocates, not all 65536 of them.
+Also note that while the allocation logic is operating,
+the glibc `lckpwdf()` user database lock is taken, in order to make this logic race-free.
## Figuring out the system's UID boundaries
The most important boundaries of the local system may be queried with
`pkg-config`:
-```
+```sh
$ pkg-config --variable=system_uid_max systemd
999
$ pkg-config --variable=dynamic_uid_min systemd
@@ -172,9 +167,9 @@ pick — given that 64K UIDs are assigned to each container according to this
allocation logic, the maximum UID used for this range is hence
1878982656+65535=1879048191.)
-Systemd has compile-time default for these boundaries. Using those defaults is
-recommended. It will nevertheless query `/etc/login.defs` at runtime, when
-compiled with `-Dcompat-mutable-uid-boundaries=true` and that file is present.
+Systemd has compile-time default for these boundaries.
+Using those defaults is recommended.
+It will nevertheless query `/etc/login.defs` at runtime, when compiled with `-Dcompat-mutable-uid-boundaries=true` and that file is present.
Support for this is considered only a compatibility feature and should not be
used except when upgrading systems which were created with different defaults.
@@ -183,75 +178,71 @@ used except when upgrading systems which were created with different defaults.
If you hack on a container manager, and wonder how and how many UIDs best to
assign to your containers, here are a few recommendations:
-1. Definitely, don't assign less than 65536 UIDs/GIDs. After all the `nobody`
-user has magic properties, and hence should be available in your container, and
-given that it's assigned the UID 65534, you should really cover the full 16-bit
-range in your container. Note that systemd will — as mentioned — synthesize
-user records for the `nobody` user, and assumes its availability in various
-other parts of its codebase, too, hence assigning fewer users means you lose
-compatibility with running systemd code inside your container. And most likely
-other packages make similar restrictions.
+1. Definitely, don't assign less than 65536 UIDs/GIDs.
+After all the `nobody` user has magic properties, and hence should be available in your container,
+and given that it's assigned the UID 65534, you should really cover the full 16-bit range in your container.
+Note that systemd will — as mentioned — synthesize user records for the `nobody` user,
+and assumes its availability in various other parts of its codebase, too, hence assigning fewer users means you lose
+compatibility with running systemd code inside your container.
+And most likely other packages make similar restrictions.
2. While it's fine to assign more than 65536 UIDs/GIDs to a container, there's
most likely not much value in doing so, as Linux distributions won't use the
higher ranges by default (as mentioned neither `adduser` nor `systemd`'s
-dynamic user concept allocate from above the 16-bit range). Unless you actively
-care for nested containers, it's hence probably a good idea to allocate exactly
-65536 UIDs per container, and neither less nor more. A pretty side-effect is
-that by doing so, you expose the same number of UIDs per container as Linux 2.2
+dynamic user concept allocate from above the 16-bit range).
+Unless you actively care for nested containers, it's hence probably a good idea to allocate exactly
+65536 UIDs per container, and neither less nor more.
+A pretty side-effect is that by doing so, you expose the same number of UIDs per container as Linux 2.2
supported for the whole system, back in the days.
-3. Consider allocating UID ranges for containers so that the first UID you
-assign has the lower 16-bits all set to zero. That way, the upper 16-bits become
-a container ID of some kind, while the lower 16-bits directly encode the
-internal container UID. This is the way `systemd-nspawn` allocates UID ranges
-(see above). Following this allocation logic ensures best compatibility with
-`systemd-nspawn` and all other container managers following the scheme, as it
-is sufficient then to check NSS for the first UID you pick regarding conflicts,
-as that's what they do, too. Moreover, it makes `chown()`ing container file
-system trees nicely robust to interruptions: as the external UID encodes the
+3. Consider allocating UID ranges for containers so that the first UID you assign has the lower 16-bits all set to zero.
+That way, the upper 16-bits become a container ID of some kind,
+while the lower 16-bits directly encode the internal container UID.
+This is the way `systemd-nspawn` allocates UID ranges(see above).
+Following this allocation logic ensures best compatibility with `systemd-nspawn`
+and all other container managers following the scheme, as it
+is sufficient then to check NSS for the first UID you pick regarding conflicts, as that's what they do, too.
+Moreover, it makes `chown()`ing container file system trees nicely robust to interruptions: as the external UID encodes the
internal UID in a fixed way, it's very easy to adjust the container's base UID
without the need to know the original base UID: to change the container base,
-just mask away the upper 16-bit, and insert the upper 16-bit of the new container
-base instead. Here are the easy conversions to derive the internal UID, the
-external UID, and the container base UID from each other:
+just mask away the upper 16-bit, and insert the upper 16-bit of the new container base instead.
+Here are the easy conversions to derive the internal UID, the external UID, and the container base UID from each other:
- ```
- INTERNAL_UID = EXTERNAL_UID & 0x0000FFFF
- CONTAINER_BASE_UID = EXTERNAL_UID & 0xFFFF0000
- EXTERNAL_UID = INTERNAL_UID | CONTAINER_BASE_UID
- ```
+```sh
+INTERNAL_UID = EXTERNAL_UID & 0x0000FFFF
+CONTAINER_BASE_UID = EXTERNAL_UID & 0xFFFF0000
+EXTERNAL_UID = INTERNAL_UID | CONTAINER_BASE_UID
+```
4. When picking a UID range for containers, make sure to check NSS first, with
a simple `getpwuid()` call: if there's already a user record for the first UID
-you want to pick, then it's already in use: pick a different one. Wrap that
-call in a `lckpwdf()` + `ulckpwdf()` pair, to make allocation
-race-free. Provide an NSS module that makes all UIDs you end up taking show up
+you want to pick, then it's already in use: pick a different one.
+Wrap that call in a `lckpwdf()` + `ulckpwdf()` pair, to make allocation race-free.
+Provide an NSS module that makes all UIDs you end up taking show up
in the user database, and make sure that the NSS module returns up-to-date
information before you release the lock, so that other system components can
-safely use the NSS user database as allocation check, too. Note that if you
-follow this scheme no changes to `/etc/passwd` need to be made, thus minimizing
+safely use the NSS user database as allocation check, too.
+Note that if you follow this scheme no changes to `/etc/passwd` need to be made, thus minimizing
the artifacts the container manager persistently leaves in the system.
-5. `systemd-homed` by default mounts the home directories it manages with UID
-mapping applied. It will map four UID ranges into that uidmap, and leave
-everything else unmapped: the range from 0…60000, the user's own UID, the range
-60514…65534, and the container range 524288…1879048191. This means
-files/directories in home directories managed by `systemd-homed` cannot be
+5. `systemd-homed` by default mounts the home directories it manages with UID mapping applied.
+It will map four UID ranges into that uidmap, and leave everything else unmapped:
+the range from 0…60000, the user's own UID,
+the range 60514…65534, and the container range 524288…1879048191.
+This means files/directories in home directories managed by `systemd-homed` cannot be
owned by UIDs/GIDs outside of these four ranges (attempts to `chown()` files to
-UIDs outside of these ranges will fail). Thus, if container trees are to be
-placed within a home directory managed by `systemd-homed` they should take
-these ranges into consideration and either place the trees at base UID 0 (and
-then map them to a higher UID range for use in user namespacing via another
-level of UID mapped mounts, at *runtime*) or at a base UID from the container
-UID range. That said, placing container trees (and in fact any
-files/directories not owned by the home directory's user) in home directories
+UIDs outside of these ranges will fail).
+Thus, if container trees are to be placed within a home directory managed by `systemd-homed` they should take
+these ranges into consideration and either place the trees at base UID 0
+(and then map them to a higher UID range for use in user namespacing via another
+level of UID mapped mounts, at *runtime*) or at a base UID from the container UID range.
+That said, placing container trees (and in fact any files/directories not owned by the home directory's user) in home directories
is generally a questionable idea (regardless of whether `systemd-homed` is used
or not), given this typically breaks quota assumptions, makes it impossible for
users to properly manage all files in their own home directory due to
permission problems, introduces security issues around SETUID and severely
-restricts compatibility with networked home directories. Typically, it's a much
-better idea to place container images outside of the home directory,
+restricts compatibility with networked home directories.
+Typically, it's a much better idea to place container images outside of the home directory,
i.e. somewhere below `/var/` or similar.
## Summary
@@ -276,51 +267,47 @@ i.e. somewhere below `/var/` or similar.
| 2147483648…4294967294 | HIC SVNT LEONES | | |
| 4294967295 | 32-bit `(uid_t) -1` | Linux | |
-Note that "Unused" in the table above doesn't mean that these ranges are
-really unused. It just means that these ranges have no well-established
-pre-defined purposes between Linux, generic low-level distributions and
-`systemd`. There might very well be other packages that allocate from these
-ranges.
+Note that "Unused" in the table above doesn't mean that these ranges are really unused.
+It just means that these ranges have no well-established
+pre-defined purposes between Linux, generic low-level distributions and `systemd`.
+There might very well be other packages that allocate from theseranges.
-Note that the range 2147483648…4294967294 (i.e. 2^31…2^32-2) should be handled
-with care. Various programs (including kernel file systems — see `devpts` — or
+Note that the range 2147483648…4294967294 (i.e. 2^31…2^32-2) should be handled with care.
+Various programs (including kernel file systems — see `devpts` — or
even kernel syscalls – see `setfsuid()`) have trouble with UIDs outside of the
-signed 32-bit range, i.e any UIDs equal to or above 2147483648. It is thus
-strongly recommended to stay away from this range in order to avoid
-complications. This range should be considered reserved for future, special
-purposes.
+signed 32-bit range, i.e any UIDs equal to or above 2147483648.
+It is thus strongly recommended to stay away from this range in order to avoid complications.
+This range should be considered reserved for future, special purposes.
## Notes on resolvability of user and group names
User names, UIDs, group names and GIDs don't have to be resolvable using NSS
-(i.e. getpwuid() and getpwnam() and friends) all the time. However, systemd
-makes the following requirements:
+(i.e. getpwuid() and getpwnam() and friends) all the time.
+However, systemd makes the following requirements:
-System users generally have to be resolvable during early boot already. This
-means they should not be provided by any networked service (as those usually
+System users generally have to be resolvable during early boot already.
+This means they should not be provided by any networked service (as those usually
become available during late boot only), except if a local cache is kept that
-makes them available during early boot too (i.e. before networking is
-up). Specifically, system users need to be resolvable at least before
-`systemd-udevd.service` and `systemd-tmpfiles-setup.service` are started, as both
-need to resolve system users — but note that there might be more services
+makes them available during early boot too (i.e. before networking is up).
+Specifically, system users need to be resolvable at least before
+`systemd-udevd.service` and `systemd-tmpfiles-setup.service` are started,
+as both need to resolve system users — but note that there might be more services
requiring full resolvability of system users than just these two.
Regular users do not need to be resolvable during early boot, it is sufficient
-if they become resolvable during late boot. Specifically, regular users need to
-be resolvable at the point in time the `nss-user-lookup.target` unit is
-reached. This target unit is generally used as synchronization point between
-providers of the user database and consumers of it. Services that require that
-the user database is fully available (for example, the login service
+if they become resolvable during late boot.
+Specifically, regular users need to be resolvable at the point in time the `nss-user-lookup.target` unit is reached.
+This target unit is generally used as synchronization point between
+providers of the user database and consumers of it.
+Services that require that the user database is fully available (for example, the login service
`systemd-logind.service`) are ordered *after* it, while services that provide
-parts of the user database (for example an LDAP user database client) are
-ordered *before* it. Note that `nss-user-lookup.target` is a *passive* unit: in
+parts of the user database (for example an LDAP user database client) are ordered *before* it.
+Note that `nss-user-lookup.target` is a *passive* unit: in
order to minimize synchronization points on systems that don't need it the unit
is pulled into the initial transaction only if there's at least one service
that really needs it, and that means only if there's a service providing the
-local user database somehow through IPC or suchlike. Or in other words: if you
-hack on some networked user database project, then make sure you order your
-service `Before=nss-user-lookup.target` and that you pull it in with
-`Wants=nss-user-lookup.target`. However, if you hack on some project that needs
-the user database to be up in full, then order your service
-`After=nss-user-lookup.target`, but do *not* pull it in via a `Wants=`
-dependency.
+local user database somehow through IPC or suchlike.
+Or in other words: if you hack on some networked user database project, then make sure you order your
+service `Before=nss-user-lookup.target` and that you pull it in with `Wants=nss-user-lookup.target`.
+However, if you hack on some project that needs the user database to be up in full, then order your service
+`After=nss-user-lookup.target`, but do *not* pull it in via a `Wants=` dependency.
diff --git a/docs/USERDB_AND_DESKTOPS.md b/docs/USERDB_AND_DESKTOPS.md
index 3a3da13..b9a9eac 100644
--- a/docs/USERDB_AND_DESKTOPS.md
+++ b/docs/USERDB_AND_DESKTOPS.md
@@ -9,39 +9,37 @@ SPDX-License-Identifier: LGPL-2.1-or-later
Starting with version 245, systemd supports a new subsystem
[`systemd-homed.service`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html)
-for managing regular ("human") users and their home directories. Along with it
-a new concept `userdb` got merged that brings rich, extensible JSON user/group
-records, extending the classic UNIX/glibc NSS `struct passwd`/`struct group`
-structures. Both additions are added in a fully backwards compatible way,
-accessible through `getpwnam()`/`getgrnam()`/… (i.e. libc NSS) and PAM as
+for managing regular ("human") users and their home directories.
+Along with it a new concept `userdb` got merged that brings rich, extensible JSON user/group
+records, extending the classic UNIX/glibc NSS `struct passwd`/`struct group` structures.
+Both additions are added in a fully backwards compatible way, accessible through `getpwnam()`/`getgrnam()`/… (i.e. libc NSS) and PAM as
usual, meaning that for basic support no changes in the upper layers of the
-stack (in particular desktop environments, such as GNOME or KDE) have to be
-made. However, for better support a number of changes to desktop environments
-are recommended. A few areas where that applies are discussed below.
+stack (in particular desktop environments, such as GNOME or KDE) have to be made.
+However, for better support a number of changes to desktop environments are recommended.
+A few areas where that applies are discussed below.
Before reading on, please read up on the basic concepts, specifically:
-* [Home Directories](HOME_DIRECTORY)
-* [JSON User Records](USER_RECORD)
-* [JSON Group Records](GROUP_RECORD)
-* [User/Group Record Lookup API via Varlink](USER_GROUP_API)
+* [Home Directories](/HOME_DIRECTORY)
+* [JSON User Records](/USER_RECORD)
+* [JSON Group Records](/GROUP_RECORD)
+* [User/Group Record Lookup API via Varlink](/USER_GROUP_API)
## Support for Suspending Home Directory Access during System Suspend
One key feature of `systemd-homed` managed encrypted home directories is the
ability that access to them can be suspended automatically during system sleep,
-removing any cryptographic key material from memory while doing so. This is
-important in a world where most laptop users seldom shut down their computers
-but most of the time just suspend them instead. Previously, the encryption keys
-for the home directories remained in memory during system suspend, so that
-sufficiently equipped attackers could read them from there and gain full access
-to the device. By removing the key material from memory before suspend, and
-re-requesting it on resume this attack vector can be closed down effectively.
+removing any cryptographic key material from memory while doing so.
+This is important in a world where most laptop users seldom shut down their computers
+but most of the time just suspend them instead.
+Previously, the encryption keys for the home directories remained in memory during system suspend, so that
+sufficiently equipped attackers could read them from there and gain full access to the device.
+By removing the key material from memory before suspend, and re-requesting it on resume this attack vector can be closed down effectively.
Supporting this mechanism requires support in the desktop environment, since
the encryption keys (i.e. the user's login password) need to be reacquired on
-system resume, from a lock screen or similar. This lock screen must run in
-system context, and cannot run in the user's own context, since otherwise it
+system resume, from a lock screen or similar.
+This lock screen must run in system context, and cannot run in the user's own context, since otherwise it
might end up accessing the home directory of the user even though access to it
is temporarily suspended and thus will hang if attempted.
@@ -49,91 +47,86 @@ It is suggested that desktop environments that implement lock screens run them
from system context, for example by switching back to the display manager, and
only revert back to the session after re-authentication via this system lock
screen (re-authentication in this case refers to passing the user's login
-credentials to the usual PAM authentication hooks). Or in other words, when
-going into system suspend it is recommended that GNOME Shell switches back to
+credentials to the usual PAM authentication hooks).
+Or in other words, when going into system suspend it is recommended that GNOME Shell switches back to
the GNOME Display Manager login screen which now should double as screen lock,
and only switches back to the shell's UI after the user re-authenticated there.
Note that this change in behavior is a good idea in any case, and does not
-create any dependencies on `systemd-homed` or systemd-specific APIs. It's
-simply a change of behavior regarding use of existing APIs, not a suggested
-hook-up to any new APIs.
+create any dependencies on `systemd-homed` or systemd-specific APIs.
+It's simply a change of behavior regarding use of existing APIs, not a suggested hook-up to any new APIs.
A display manager which supports this kind of out-of-context screen lock
operation needs to inform systemd-homed about this so that systemd-homed knows
-that it is safe to suspend the user's home directory on suspend. This is done
-via the `suspend=` argument to the
+that it is safe to suspend the user's home directory on suspend.
+This is done via the `suspend=` argument to the
[`pam_systemd_home`](https://www.freedesktop.org/software/systemd/man/pam_systemd_home.html)
-PAM module. A display manager should hence change its PAM stack configuration
-to set this parameter to on. `systemd-homed` will not suspend home directories
-if there's at least one active session of the user that does not support
+PAM module.
+A display manager should hence change its PAM stack configurationto set this parameter to on.
+`systemd-homed` will not suspend home directories if there's at least one active session of the user that does not support
suspending, as communicated via this parameter.
## User Management UIs
The rich user/group records `userdb` and `systemd-homed` support carry various
-fields of relevance to UIs that manage the local user database or parts
-thereof. In particular, most of the metadata `accounts-daemon` (also see below)
-supports is directly available in these JSON records. Hence it makes sense for
-any user management UI to expose them directly.
+fields of relevance to UIs that manage the local user database or parts thereof.
+In particular, most of the metadata `accounts-daemon` (also see below)
+supports is directly available in these JSON records.
+Hence it makes sense for any user management UI to expose them directly.
`systemd-homed` exposes APIs to add, remove and make changes to local users via
-D-Bus, with full [polkit](https://www.freedesktop.org/software/polkit/docs/latest/)
-hook-up. On the command line this is exposed via the
-`homectl` command. A graphical UI that exposes similar functionality would be
+D-Bus, with full [polkit](https://www.freedesktop.org/software/polkit/docs/latest/) hook-up.
+On the command line this is exposed via the `homectl` command. A graphical UI that exposes similar functionality would be
very useful, exposing the various new account settings, and in particular
providing a stream-lined UI for enrolling new-style authentication tokens such
-as PKCS#11/YubiKey-style devices. (Ideally, if the user plugs in an
-uninitialized YubiKey during operation it might be nice if the Desktop would
+as PKCS#11/YubiKey-style devices.
+(Ideally, if the user plugs in an uninitialized YubiKey during operation it might be nice if the Desktop would
automatically ask if a key pair shall be written to it and the local account be
bound to it, `systemd-homed` provides enough YubiKey/PKCS#11 support to make
this a reality today; except that it will not take care of token
initialization).
-A strong point of `systemd-homed` is per-user resource management. In
-particular disk space assignments are something that most likely should be
+A strong point of `systemd-homed` is per-user resource management.
+In particular disk space assignments are something that most likely should be
exposed in a user management UI. Various metadata fields are supplied allowing
-exposure of disk space assignment "slider" UI. Note however that the file system
-back-ends of `systemd-homed.service` have different feature sets. Specifically,
-only btrfs has online file system shrinking support, ext4 only offline file
+exposure of disk space assignment "slider" UI.
+Note however that the file system back-ends of `systemd-homed.service` have different feature sets.
+Specifically, only btrfs has online file system shrinking support, ext4 only offline file
system shrinking support, and xfs no shrinking support at all (all three file
-systems support online file system growing however). This means if the LUKS
-back-end is used, disk space assignment cannot be instant for logged in users,
-unless btrfs is used.
-
-Note that only `systemd-homed` provides an API for modifying/creating/deleting
-users. The generic `userdb` subsystem (which might have other back-ends, besides
-`systemd-homed`, for example LDAP or Windows) exclusively provides a read-only
-interface. (This is unlikely to change, as the other back-ends might have very
-different concepts of adding or modifying users, i.e. might not even have any
-local concept for that at all). This means any user management UI that intends
-to change (and not just view) user accounts should talk directly to
+systems support online file system growing however).
+This means if the LUKS back-end is used, disk space assignment cannot be instant for logged in users, unless btrfs is used.
+
+Note that only `systemd-homed` provides an API for modifying/creating/deleting users.
+The generic `userdb` subsystem (which might have other back-ends, besides
+`systemd-homed`, for example LDAP or Windows) exclusively provides a read-only interface.
+(This is unlikely to change, as the other back-ends might have very
+different concepts of adding or modifying users, i.e. might not even have any local concept for that at all).
+This means any user management UI that intends to change (and not just view) user accounts should talk directly to
`systemd-homed` to make use of its features; there's no abstraction available
to support other back-ends under the same API.
-Unfortunately there's currently no documentation for the `systemd-homed` D-Bus
-API. Consider using the `homectl` sources as guidelines for implementing a user
-management UI. The JSON user/records are well documented however, see above,
+Unfortunately there's currently no documentation for the `systemd-homed` D-Bus API.
+Consider using the `homectl` sources as guidelines for implementing a user management UI.
+The JSON user/records are well documented however, see above,
and the D-Bus API provides limited introspection.
## Relationship to `accounts-daemon`
For a long time `accounts-daemon` has been included in Linux distributions
-providing richer user accounts. The functionality of this daemon overlaps in
-many areas with the functionality of `systemd-homed` or `userdb`, but there are
+providing richer user accounts.
+The functionality of this daemon overlaps in many areas with the functionality of `systemd-homed` or `userdb`, but there are
systematic differences, which means that `systemd-homed` cannot replace
-`accounts-daemon` fully. Most importantly: `accounts-daemon` provides
-"side-car" metadata for *any* type of user account, while `systemd-homed` only
-provides additional metadata for the users it defines itself. In other words:
-`accounts-daemon` will augment foreign accounts; `systemd-homed` cannot be used
-to augment users defined elsewhere, for example in LDAP or as classic
-`/etc/passwd` records.
+`accounts-daemon` fully.
+Most importantly: `accounts-daemon` provides "side-car" metadata for *any* type of user account, while `systemd-homed` only
+provides additional metadata for the users it defines itself.
+In other words: `accounts-daemon` will augment foreign accounts; `systemd-homed` cannot be used
+to augment users defined elsewhere, for example in LDAP or as classic `/etc/passwd` records.
This probably means that for the time being, a user management UI (or other UI)
that wants to support rich user records with compatibility with the status quo
ante should probably talk to both `systemd-homed` and `accounts-daemon` at the
-same time, and ignore `accounts-daemon`'s records if `systemd-homed` defines
-them. While I (Lennart) personally believe in the long run `systemd-homed` is
+same time, and ignore `accounts-daemon`'s records if `systemd-homed` defines them.
+While I (Lennart) personally believe in the long run `systemd-homed` is
the way to go for rich user records, any UI that wants to manage and support
rich records for classic records has to support `accounts-daemon` in parallel
for the time being.
@@ -145,17 +138,16 @@ probably be removed from the general stack, hence this sounds like a temporary
solution only.
In case you wonder, there's no automatic mechanism for converting existing
-users registered in `/etc/passwd` or LDAP to users managed by
-`systemd-homed`. There's documentation for doing this manually though, see
-[Converting Existing Users to systemd-homed managed Users](CONVERTING_TO_HOMED).
+users registered in `/etc/passwd` or LDAP to users managed by `systemd-homed`.
+There's documentation for doing this manually though, see
+[Converting Existing Users to systemd-homed managed Users](/CONVERTING_TO_HOMED).
## Future Additions
-JSON user/group records are extensible, hence we can easily add any additional
-fields desktop environments require. For example, pattern-based authentication
-is likely very useful on touch-based devices, and the user records should hence
-learn them natively. Fields for other authentication mechanisms, such as
-fingerprint authentication should be provided as well, eventually.
+JSON user/group records are extensible, hence we can easily add any additional fields desktop environments require.
+For example, pattern-based authentication is likely very useful on touch-based devices,
+and the user records should hence learn them natively.
+Fields for other authentication mechanisms, such as fingerprint authentication should be provided as well, eventually.
It is planned to extend the `userdb` Varlink API to support look-ups by partial
user name and real name (GECOS) data, so that log-in screens can optionally
@@ -163,7 +155,7 @@ implement simple complete-as-you-type login screens.
It is planned to extend the `systemd-homed` D-Bus API to instantly inform clients
about hardware associated with a specific user being plugged in, to which login
-screens can listen in order to initiate authentication. Specifically, any
-YubiKey-like security token plugged in that is associated with a local user
+screens can listen in order to initiate authentication.
+Specifically, any YubiKey-like security token plugged in that is associated with a local user
record should initiate authentication for that user, making typing in of the
username unnecessary.
diff --git a/docs/USER_GROUP_API.md b/docs/USER_GROUP_API.md
index 567b817..d0016db 100644
--- a/docs/USER_GROUP_API.md
+++ b/docs/USER_GROUP_API.md
@@ -7,21 +7,22 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# User/Group Record Lookup API via Varlink
-JSON User/Group Records (as described in the [JSON User Records](USER_RECORD)
-and [JSON Group Records](GROUP_RECORD) documents) that are defined on the
-local system may be queried with a [Varlink](https://varlink.org/) API. This
-API takes both the role of what
+JSON User/Group Records (as described in the [JSON User Records](/USER_RECORD)
+and [JSON Group Records](/GROUP_RECORD) documents) that are defined on the
+local system may be queried with a [Varlink](https://varlink.org/) API.
+This API takes both the role of what
[`getpwnam(3)`](https://man7.org/linux/man-pages/man3/getpwnam.3.html) and
related calls are for `struct passwd`, as well as the interfaces modules
implementing the [glibc Name Service Switch
-(NSS)](https://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html)
-expose. Or in other words, it both allows applications to efficiently query
+(NSS)](https://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) expose.
+Or in other words, it both allows applications to efficiently query
user/group records from local services, and allows local subsystems to provide
user/group records efficiently to local applications.
-The concepts described here define an IPC interface. Alternatively, user/group
-records may be dropped in number of drop-in directories as files where they are
-picked up in addition to the users/groups defined by this IPC logic. See
+The concepts described here define an IPC interface.
+Alternatively, user/group records may be dropped in number of drop-in directories as files where they are
+picked up in addition to the users/groups defined by this IPC logic.
+See
[`nss-systemd(8)`](https://www.freedesktop.org/software/systemd/man/nss-systemd.html)
for details.
@@ -31,58 +32,55 @@ subset of the Varlink functionality.
## Why Varlink?
The API described in this document is based on a simple subset of the
-mechanisms described by [Varlink](https://varlink.org/). The choice of
-preferring Varlink over D-Bus and other IPCs in this context was made for three
-reasons:
+mechanisms described by [Varlink](https://varlink.org/).
+The choice of preferring Varlink over D-Bus and other IPCs in this context was made for three reasons:
1. User/Group record resolution should work during early boot and late shutdown
- without special handling. This is very hard to do with D-Bus, as the broker
- service for D-Bus generally runs as regular system daemon and is hence only
+ without special handling.
+ This is very hard to do with D-Bus, as the broker service for D-Bus generally runs as regular system daemon and is hence only
available at the latest boot stage.
2. The JSON user/group records are native JSON data, hence picking an IPC
system that natively operates with JSON data is natural and clean.
3. IPC systems such as D-Bus do not provide flow control and are thus unusable
- for streaming data. They are useful to pass around short control messages,
- but as soon as potentially many and large objects shall be transferred,
+ for streaming data.
+ They are useful to pass around short control messages, but as soon as potentially many and large objects shall be transferred,
D-Bus is not suitable, as any such streaming of messages would be considered
- flooding in D-Bus' logic, and thus possibly result in termination of
- communication. Since the APIs defined in this document need to support
- enumerating potentially large numbers of users and groups, D-Bus is simply
- not an appropriate option.
+ flooding in D-Bus' logic, and thus possibly result in termination of communication.
+ Since the APIs defined in this document need to support enumerating potentially large numbers of users and groups,
+ D-Bus is simply not an appropriate option.
## Concepts
Each subsystem that needs to define users and groups on the local system is
supposed to implement this API, and offer its interfaces on a Varlink
`AF_UNIX`/`SOCK_STREAM` file system socket bound into the
-`/run/systemd/userdb/` directory. When a client wants to look up a user or
-group record, it contacts all sockets bound in this directory in parallel, and
-enqueues the same query to each. The first positive reply is then returned to
-the application, or if all fail the last seen error is returned
-instead. (Alternatively a special Varlink service is available,
+`/run/systemd/userdb/` directory.
+When a client wants to look up a user or group record, it contacts all sockets bound in this directory in parallel,
+and enqueues the same query to each.
+The first positive reply is then returned to the application, or if all fail the last seen error is returned instead.
+(Alternatively a special Varlink service is available,
`io.systemd.Multiplexer` which acts as frontend and will do the parallel
-queries on behalf of the client, drastically simplifying client
-development. This service is not available during earliest boot and final
-shutdown phases.)
+queries on behalf of the client, drastically simplifying client development.
+This service is not available during earliest boot and final shutdown phases.)
Unlike with glibc NSS there's no order or programmatic expression language
-defined in which queries are issued to the various services. Instead, all
-queries are always enqueued in parallel to all defined services, in order to
+defined in which queries are issued to the various services.
+Instead, all queries are always enqueued in parallel to all defined services, in order to
make look-ups efficient, and the simple rule of "first successful lookup wins"
is unconditionally followed for user and group look-ups (though not for
membership lookups, see below).
This simple scheme only works safely as long as every service providing
-user/group records carefully makes sure not to answer with conflicting
-records. This API does not define any mechanisms for dealing with user/group
-name/ID collisions during look-up nor during record registration. It assumes
-the various subsystems that want to offer user and group records to the rest of
+user/group records carefully makes sure not to answer with conflicting records.
+This API does not define any mechanisms for dealing with user/group
+name/ID collisions during look-up nor during record registration.
+It assumes the various subsystems that want to offer user and group records to the rest of
the system have made sufficiently sure in advance that their definitions do not
-collide with those of other services. Clients are not expected to merge
-multiple definitions for the same user or group, and will also not be able to
-detect conflicts and suppress such conflicting records.
+collide with those of other services.
+Clients are not expected to merge multiple definitions for the same user or group,
+and will also not be able to detect conflicts and suppress such conflicting records.
It is recommended to name the sockets in the directory in reverse domain name
notation, but this is neither required nor enforced.
@@ -90,27 +88,25 @@ notation, but this is neither required nor enforced.
## Well-Known Services
Any subsystem that wants to provide user/group records can do so, simply by
-binding a socket in the aforementioned directory. By default two
-services are listening there, that have special relevance:
+binding a socket in the aforementioned directory.
+By default two services are listening there, that have special relevance:
1. `io.systemd.NameServiceSwitch` → This service makes the classic UNIX/glibc
- NSS user/group records available as JSON User/Group records. Any such
- records are automatically converted as needed, and possibly augmented with
+ NSS user/group records available as JSON User/Group records.
+ Any such records are automatically converted as needed, and possibly augmented with
information from the shadow databases.
-2. `io.systemd.Multiplexer` → This service multiplexes client queries to all
- other running services. It's supposed to simplify client development: in
- order to look up or enumerate user/group records it's sufficient to talk to
- one service instead of all of them in parallel. Note that it is not available
- during earliest boot and final shutdown phases, hence for programs running
- in that context it is preferable to implement the parallel lookup
- themselves.
+2. `io.systemd.Multiplexer` → This service multiplexes client queries to all other running services.
+ It's supposed to simplify client development: in order to look up or enumerate user/group records it's sufficient to talk to
+ one service instead of all of them in parallel.
+ Note that it is not available during earliest boot and final shutdown phases, hence for programs running
+ in that context it is preferable to implement the parallel lookup themselves.
Both these services are implemented by the same daemon
`systemd-userdbd.service`.
-Note that these services currently implement a subset of Varlink only. For
-example, introspection is not available, and the resolver logic is not used.
+Note that these services currently implement a subset of Varlink only.
+For example, introspection is not available, and the resolver logic is not used.
## Other Services
@@ -129,35 +125,33 @@ interface. Specifically:
`systemd-machined.service` and provides records for the users and groups used
by local containers that use user namespacing.
-Other projects are invited to implement these services too. For example, it
-would make sense for LDAP/ActiveDirectory projects to implement these
+Other projects are invited to implement these services too.
+For example, it would make sense for LDAP/ActiveDirectory projects to implement these
interfaces, which would provide them a way to do per-user resource management
enforced by systemd and defined directly in LDAP directories.
## Compatibility with NSS
-Two-way compatibility with classic UNIX/glibc NSS user/group records is
-provided. When using the Varlink API, lookups into databases provided only via
-NSS (and not natively via Varlink) are handled by the
-`io.systemd.NameServiceSwitch` service (see above). When using the NSS API
-(i.e. `getpwnam()` and friends) the `nss-systemd` module will automatically
-synthesize NSS records for users/groups natively defined via a Varlink
-API. Special care is taken to avoid recursion between these two compatibility
-mechanisms.
+Two-way compatibility with classic UNIX/glibc NSS user/group records is provided.
+When using the Varlink API, lookups into databases provided only via
+NSS (and not natively via Varlink) are handled by the `io.systemd.NameServiceSwitch` service (see above).
+When using the NSS API (i.e. `getpwnam()` and friends) the `nss-systemd` module will automatically
+synthesize NSS records for users/groups natively defined via a Varlink API.
+Special care is taken to avoid recursion between these two compatibility mechanisms.
Subsystems that shall provide user/group records to the system may choose
between offering them via an NSS module or via a this Varlink API, either way
-all records are accessible via both APIs, due to the bidirectional
-forwarding. It is also possible to provide the same records via both APIs
-directly, but in that case the compatibility logic must be turned off. There
-are mechanisms in place for this, please contact the systemd project for
+all records are accessible via both APIs, due to the bidirectional forwarding.
+It is also possible to provide the same records via both APIs
+directly, but in that case the compatibility logic must be turned off.
+There are mechanisms in place for this, please contact the systemd project for
details, as these are currently not documented.
## Caching of User Records
-This API defines no concepts for caching records. If caching is desired it
-should be implemented in the subsystems that provide the user records, not in
-the clients consuming them.
+This API defines no concepts for caching records.
+If caching is desired it should be implemented in the subsystems that provide the user records,
+not in the clients consuming them.
## Method Calls
@@ -198,16 +192,15 @@ error ConflictingRecordFound()
error EnumerationNotSupported()
```
-The `GetUserRecord` method looks up or enumerates a user record. If the `uid`
-parameter is set it specifies the numeric UNIX UID to search for. If the
-`userName` parameter is set it specifies the name of the user to search
-for. Typically, only one of the two parameters are set, depending whether a
-look-up by UID or by name is desired. However, clients may also specify both
-parameters, in which case a record matching both will be returned, and if only
-one exists that matches one of the two parameters but not the other an error of
-`ConflictingRecordFound` is returned. If neither of the two parameters are set
-the whole user database is enumerated. In this case the method call needs to be
-made with `more` set, so that multiple method call replies may be generated as
+The `GetUserRecord` method looks up or enumerates a user record.
+If the `uid` parameter is set it specifies the numeric UNIX UID to search for.
+If the `userName` parameter is set it specifies the name of the user to search for.
+Typically, only one of the two parameters are set, depending whether a
+look-up by UID or by name is desired.
+However, clients may also specify both parameters, in which case a record matching both will be returned, and if only
+one exists that matches one of the two parameters but not the other an error of `ConflictingRecordFound` is returned.
+If neither of the two parameters are set the whole user database is enumerated.
+In this case the method call needs to be made with `more` set, so that multiple method call replies may be generated as
effect, each carrying one user record.
The `service` parameter is mandatory and should be set to the service name
@@ -217,13 +210,12 @@ of multiple services on the same socket (which is used by
`systemd-userdbd.service`).
The method call returns one or more user records, depending which type of query is
-used (see above). The record is returned in the `record` field. The
-`incomplete` field indicates whether the record is complete. Services providing
-user record lookup should only pass the `privileged` section of user records to
+used (see above). The record is returned in the `record` field.
+The `incomplete` field indicates whether the record is complete.
+Services providing user record lookup should only pass the `privileged` section of user records to
clients that either match the user the record is about or to sufficiently
-privileged clients, for all others the section must be removed so that no
-sensitive data is leaked this way. The `incomplete` parameter should indicate
-whether the record has been modified like this or not (i.e. it is `true` if a
+privileged clients, for all others the section must be removed so that no sensitive data is leaked this way.
+The `incomplete` parameter should indicate whether the record has been modified like this or not (i.e. it is `true` if a
`privileged` section existed in the user record and was removed, and `false` if
no `privileged` section existed or one existed but hasn't been removed).
@@ -233,53 +225,48 @@ specified, and hence enumeration requested but the subsystem currently has no
users defined).
If a method call with an incorrectly set `service` field is received
-(i.e. either not set at all, or not to the service's own name) a `BadService`
-error is generated. Finally, `ServiceNotAvailable` should be returned when the
-backing subsystem is not operational for some reason and hence no information
-about existence or non-existence of a record can be returned nor any user
-record at all. (The `service` field is defined in order to allow implementation
-of daemons that provide multiple distinct user/group services over the same
+(i.e. either not set at all, or not to the service's own name) a `BadService` error is generated.
+Finally, `ServiceNotAvailable` should be returned when the backing subsystem is not operational for some reason and hence no information
+about existence or non-existence of a record can be returned nor any user record at all.
+(The `service` field is defined in order to allow implementation of daemons that provide multiple distinct user/group services over the same
`AF_UNIX` socket: in order to correctly determine which service a client wants
to talk to, the client needs to provide the name in each request.)
The `GetGroupRecord` method call works analogously but for groups.
-The `GetMemberships` method call may be used to inquire about group
-memberships. The `userName` and `groupName` arguments take what the name
-suggests. If one of the two is specified all matching memberships are returned,
-if neither is specified all known memberships of any user and any group are
-returned. The return value is a pair of user name and group name, where the
-user is a member of the group. If both arguments are specified the specified
-membership will be tested for, but no others, and the pair is returned if it is
+The `GetMemberships` method call may be used to inquire about group memberships.
+The `userName` and `groupName` arguments take what the name suggests.
+If one of the two is specified all matching memberships are returned,
+if neither is specified all known memberships of any user and any group are returned.
+The return value is a pair of user name and group name, where the user is a member of the group.
+If both arguments are specified the specified membership will be tested for, but no others, and the pair is returned if it is
defined. Unless both arguments are specified the method call needs to be made
with `more` set, so that multiple replies can be returned (since typically
-there are multiple members per group and also multiple groups a user is
-member of). As with `GetUserRecord` and `GetGroupRecord` the `service`
+there are multiple members per group and also multiple groups a user is member of).
+As with `GetUserRecord` and `GetGroupRecord` the `service`
parameter needs to contain the name of the service being talked to, in order to
-allow implementation of multiple services within the same IPC socket. In case no
-matching membership is known `NoRecordFound` is returned. The other two errors
-are also generated in the same cases as for `GetUserRecord` and
+allow implementation of multiple services within the same IPC socket.
+In case no matching membership is known `NoRecordFound` is returned.
+The other two errors are also generated in the same cases as for `GetUserRecord` and
`GetGroupRecord`.
Unlike with `GetUserRecord` and `GetGroupRecord` the lists of memberships
-returned by services are always combined. Thus unlike the other two calls a
-membership lookup query has to wait for the last simultaneous query to complete
+returned by services are always combined.
+Thus unlike the other two calls a membership lookup query has to wait for the last simultaneous query to complete
before the complete list is acquired.
-Note that only the `GetMemberships` call is authoritative about memberships of
-users in groups. i.e. it should not be considered sufficient to check the
+Note that only the `GetMemberships` call is authoritative about memberships of users in groups.
+i.e. it should not be considered sufficient to check the
`memberOf` field of user records and the `members` field of group records to
-acquire the full list of memberships. The full list can only be determined by
-`GetMemberships`, and as mentioned requires merging of these lists of all local
-services. Result of this is that it can be one service that defines a user A,
-and another service that defines a group B, and a third service that declares
-that A is a member of B.
+acquire the full list of memberships.
+The full list can only be determined by `GetMemberships`, and as mentioned requires merging of these lists of all local services.
+Result of this is that it can be one service that defines a user A,
+and another service that defines a group B, and a third service that declares that A is a member of B.
Looking up explicit users/groups by their name or UID/GID, or querying
-user/group memberships must be supported by all services implementing these
-interfaces. However, supporting enumeration (i.e. user/group lookups that may
-result in more than one reply, because neither UID/GID nor name is specified)
-is optional. Services which are asked for enumeration may return the
-`EnumerationNotSupported` error in this case.
+user/group memberships must be supported by all services implementing these interfaces.
+However, supporting enumeration (i.e. user/group lookups that may
+result in more than one reply, because neither UID/GID nor name is specified) is optional.
+Services which are asked for enumeration may return the `EnumerationNotSupported` error in this case.
And that's really all there is to it.
diff --git a/docs/USER_NAMES.md b/docs/USER_NAMES.md
index 74c24b5..fe0ca7f 100644
--- a/docs/USER_NAMES.md
+++ b/docs/USER_NAMES.md
@@ -7,49 +7,45 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# User/Group Name Syntax
-The precise set of allowed user and group names on Linux systems is weakly
-defined. Depending on the distribution a different set of requirements and
+The precise set of allowed user and group names on Linux systems is weakly defined.
+Depending on the distribution a different set of requirements and
restrictions on the syntax of user/group names are enforced — on some
-distributions the accepted syntax is even configurable by the administrator. In
-the interest of interoperability systemd enforces different rules when
+distributions the accepted syntax is even configurable by the administrator.
+In the interest of interoperability systemd enforces different rules when
processing users/group defined by other subsystems and when defining users/groups
-itself, following the principle of "Be conservative in what you send, be
-liberal in what you accept". Also in the interest of interoperability systemd
-will enforce the same rules everywhere and not make them configurable or
-distribution dependent. The precise rules are described below.
+itself, following the principle of "Be conservative in what you send, be liberal in what you accept".
+Also in the interest of interoperability systemd will enforce the same rules everywhere and not make them configurable or distribution dependent.
+The precise rules are described below.
Generally, the same rules apply for user as for group names.
## Other Systems
-* On POSIX the set of [valid user
- names](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437)
- is defined as [lower and upper case ASCII letters, digits, period,
- underscore, and
- hyphen](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282),
- with the restriction that hyphen is not allowed as first character of the
- user name. Interestingly no size limit is declared, i.e. in neither
+* On POSIX the set of
+ [valid user names](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_437)
+ is defined as
+ [lower and upper case ASCII letters, digits, period, underscore, and hyphen](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282),
+ with the restriction that hyphen is not allowed as first character of the user name.
+ Interestingly no size limit is declared, i.e. in neither
direction, meaning that strictly speaking, according to POSIX, both the empty
string is a valid user name as well as a string of gigabytes in length.
-* Debian/Ubuntu based systems enforce the regular expression
- `^[a-z][-a-z0-9]*$`, i.e. only lower case ASCII letters, digits and
- hyphens. As first character only lowercase ASCII letters are allowed. This
- regular expression is configurable by the administrator at runtime
- though. This rule enforces a minimum length of one character but no maximum
- length.
+* Debian/Ubuntu based systems enforce the regular expression `^[a-z][-a-z0-9]*$`, i.e.
+ only lower case ASCII letters, digits and hyphens.
+ As first character only lowercase ASCII letters are allowed.
+ This regular expression is configurable by the administrator at runtime though.
+ This rule enforces a minimum length of one character but no maximum length.
* Upstream shadow-utils enforces the regular expression
- `^[a-z_][a-z0-9_-]*[$]$`, i.e. is similar to the Debian/Ubuntu rule, but
- allows underscores and hyphens, but the latter not as first character. Also,
- an optional trailing dollar character is permitted.
+ `^[a-z_][a-z0-9_-]*[$]$`, i.e.is similar to the Debian/Ubuntu rule,
+ but allows underscores and hyphens, but the latter not as first character.
+ Also, an optional trailing dollar character is permitted.
* Fedora/Red Hat based systems enforce the regular expression of
`^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?$`, i.e. a size limit of
- 32 characters, with upper and lower case letters, digits, underscores,
- hyphens and periods. No hyphen as first character though, and the last
- character may be a dollar character. On top of that, `.` and `..` are not
- allowed as user/group names.
+ 32 characters, with upper and lower case letters, digits, underscores, hyphens and periods.
+ No hyphen as first character though, and the last character may be a dollar character.
+ On top of that, `.` and `..` are not allowed as user/group names.
* sssd is known to generate user names with embedded `@` and white-space
characters, as well as non-ASCII (i.e. UTF-8) user/group names.
@@ -58,16 +54,15 @@ Generally, the same rules apply for user as for group names.
white-space characters, as well as non-ASCII (i.e. UTF-8) user/group names.
Other operating systems enforce different rules; in this documentation we'll
-focus on Linux systems only however, hence those are out of scope. That said,
-software like Samba is frequently deployed on Linux for providing compatibility
+focus on Linux systems only however, hence those are out of scope.
+That said, software like Samba is frequently deployed on Linux for providing compatibility
with Windows systems; on such systems it might be wise to stick to user/group
names also valid according to Windows rules.
## Rules systemd enforces
-Distilled from the above, below are the rules systemd enforces on user/group
-names. An additional, common rule between both modes listed below is that empty
-strings are not valid user/group names.
+Distilled from the above, below are the rules systemd enforces on user/group names.
+An additional, common rule between both modes listed below is that empty strings are not valid user/group names.
Philosophically, the strict mode described below enforces an allow list of
what's allowed and prohibits everything else, while the relaxed mode described
@@ -83,18 +78,17 @@ or a regular user with
[`systemd-homed.service`](https://www.freedesktop.org/software/systemd/man/systemd-homed.html).
In strict mode, only uppercase and lowercase characters are allowed, as well as
-digits, underscores and hyphens. The first character may not be a digit or
-hyphen. A size limit is enforced: the minimum of `sysconf(_SC_LOGIN_NAME_MAX)`
+digits, underscores and hyphens.
+The first character may not be a digit or hyphen. A size limit is enforced: the minimum of `sysconf(_SC_LOGIN_NAME_MAX)`
(typically 256 on Linux; rationale: this is how POSIX suggests to detect the
limit), `UT_NAMESIZE-1` (typically 31 on Linux; rationale: names longer than
this cannot correctly appear in `utmp`/`wtmp` and create ambiguity with login
accounting) and `NAME_MAX` (255 on Linux; rationale: user names typically
-appear in directory names, i.e. the home directory), thus MIN(256, 31, 255) =
-31.
+appear in directory names, i.e. the home directory), thus MIN(256, 31, 255) = 31.
Note that these rules are both more strict and more relaxed than all of the
-rules enforced by other systems listed above. A user/group name conforming to
-systemd's strict rules will not necessarily pass a test by the rules enforced
+rules enforced by other systems listed above.
+A user/group name conforming to systemd's strict rules will not necessarily pass a test by the rules enforced
by these other subsystems.
Written as regular expression the above is: `^[a-zA-Z_][a-zA-Z0-9_-]{0,30}$`
@@ -107,8 +101,8 @@ components of the system, for example in
[`systemd-logind.service`](https://www.freedesktop.org/software/systemd/man/systemd-logind.html).
Relaxed syntax is also enforced by the `User=` setting in service unit files,
-i.e. for system services used for running services. Since these users may be
-registered by a variety of tools relaxed mode is used, but since the primary
+i.e. for system services used for running services.
+Since these users may be registered by a variety of tools relaxed mode is used, but since the primary
purpose of these users is to run a system service and thus a job for systemd a
warning is shown if the specified user name does not qualify by the strict
rules above.
@@ -150,16 +144,15 @@ Note that these relaxed rules are implied by the strict rules above, i.e. all
user/group names accepted by the strict rules are also accepted by the relaxed
rules, but not vice versa.
-Note that this relaxed mode does not refuse a couple of very questionable
-syntaxes. For example, it permits a leading or embedded period. A leading period
-is problematic because the matching home directory would typically be hidden
-from the user's/administrator's view. An embedded period is problematic since
-it creates ambiguity in traditional `chown` syntax (which is still accepted
+Note that this relaxed mode does not refuse a couple of very questionable syntaxes.
+For example, it permits a leading or embedded period.
+A leading period is problematic because the matching home directory would typically be hidden
+from the user's/administrator's view.
+An embedded period is problematic since it creates ambiguity in traditional `chown` syntax (which is still accepted
today) that uses it to separate user and group names in the command's
parameter: without consulting the user/group databases it is not possible to
-determine if a `chown` invocation would change just the owning user or both the
-owning user and group. It also allows embedding `@` (which is confusing to
-MTAs).
+determine if a `chown` invocation would change just the owning user or both the owning user and group.
+It also allows embedding `@` (which is confusing to MTAs).
## Common Core
diff --git a/docs/USER_RECORD.md b/docs/USER_RECORD.md
index 8cfb053..5d43de5 100644
--- a/docs/USER_RECORD.md
+++ b/docs/USER_RECORD.md
@@ -15,7 +15,7 @@ pairs, encoded as JSON. Specifically:
1. [`systemd-homed.service`](https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html)
manages `human` user home directories and embeds these JSON records
directly in the home directory images
- (see [Home Directories](HOME_DIRECTORY) for details).
+ (see [Home Directories](/HOME_DIRECTORY) for details).
2. [`pam_systemd`](https://www.freedesktop.org/software/systemd/man/pam_systemd.html)
processes these JSON records for users that log in, and applies various
@@ -72,11 +72,11 @@ the following extensions are envisioned:
4. Default parameters for backup applications and similar
Similar to JSON User Records there are also
-[JSON Group Records](GROUP_RECORD) that encapsulate UNIX groups.
+[JSON Group Records](/GROUP_RECORD) that encapsulate UNIX groups.
JSON User Records may be transferred or written to disk in various protocols
and formats. To inquire about such records defined on the local system use the
-[User/Group Lookup API via Varlink](USER_GROUP_API). User/group records may
+[User/Group Lookup API via Varlink](/USER_GROUP_API). User/group records may
also be dropped in number of drop-in directories as files. See
[`nss-systemd(8)`](https://www.freedesktop.org/software/systemd/man/nss-systemd.html)
for details.
@@ -214,7 +214,7 @@ object. The following fields are currently defined:
UNIX user name. This field is the only mandatory field, all others are
optional. Corresponds with the `pw_name` field of `struct passwd` and the
`sp_namp` field of `struct spwd` (i.e. the shadow user record stored in
-`/etc/shadow`). See [User/Group Name Syntax](USER_NAMES) for
+`/etc/shadow`). See [User/Group Name Syntax](/USER_NAMES) for
the (relaxed) rules the various systemd components enforce on user/group names.
`realm` → The "realm" a user is defined in. This concept allows distinguishing
diff --git a/docs/VIRTUALIZED_TESTING.md b/docs/VIRTUALIZED_TESTING.md
index 94a5606..f419c49 100644
--- a/docs/VIRTUALIZED_TESTING.md
+++ b/docs/VIRTUALIZED_TESTING.md
@@ -15,7 +15,7 @@ Here's a nice hack if you regularly build and test-boot systemd, are gutsy enoug
Create a shell script like this:
-```
+```sh
#!/bin/sh
sudo sync
@@ -26,16 +26,22 @@ sudo modprobe kvm-intel
exec sudo qemu-kvm -smp 2 -m 512 -snapshot /dev/sda
```
-This will boot your local host system as a throw-away VM guest. It will take your main harddisk, boot from it in the VM, allow changes to it, but these changes are all just buffered in memory and never hit the real disk. Any changes made in this VM will be lost when the VM terminates. I have called this script "q", and hence for test booting my own system all I do is type the following command in my systemd source tree and I can see if it worked.
+This will boot your local host system as a throw-away VM guest.
+It will take your main harddisk, boot from it in the VM, allow changes to it, but these changes are all just buffered in memory and never hit the real disk.
+Any changes made in this VM will be lost when the VM terminates.
+I have called this script "q", and hence for test booting my own system all I do is type the following command in my systemd source tree and I can see if it worked.
```
$ make -j10 && sudo make install && q
-
```
-The first three lines are necessary to ensure that the kernel's disk caches are all synced to disk before qemu takes the snapshot of it. Yes, invoking "umount /" will sync your file system to disk as a side effect, even though it will actually fail. When the machine boots up the file system will still be marked dirty (and hence you will get an fsck, usually), but it will work fine nonetheless in virtually all cases.
+The first three lines are necessary to ensure that the kernel's disk caches are all synced to disk before qemu takes the snapshot of it.
+Yes, invoking "umount /" will sync your file system to disk as a side effect, even though it will actually fail.
+When the machine boots up the file system will still be marked dirty (and hence you will get an fsck, usually), but it will work fine nonetheless in virtually all cases.
-Of course, if the host's hard disk changes while the VM is running this will be visible to the VM, and might confuse it. If you use this little hack you should keep changes on the host at a minimum, hence. Yeah this all is a hack, but a really useful and neat one.
+Of course, if the host's hard disk changes while the VM is running this will be visible to the VM, and might confuse it.
+If you use this little hack you should keep changes on the host at a minimum, hence.
+Yeah this all is a hack, but a really useful and neat one.
YMMV if you use LVM or btrfs.
@@ -43,13 +49,14 @@ YMMV if you use LVM or btrfs.
Test-booting systemd in a container has the benefit of being much easier to debug/instrument from the outside.
-**Important**: As preparation it is essential to turn off auditing entirely on your system. Auditing is broken with containers, and will trigger all kinds of error in containers if not turned off. Use `audit=0` on the host's kernel command line to turn it off.
+**Important**: As preparation it is essential to turn off auditing entirely on your system.
+Auditing is broken with containers, and will trigger all kinds of error in containers if not turned off.
+Use `audit=0` on the host's kernel command line to turn it off.
Then, as the first step I install Fedora into a container tree:
```
$ sudo yum -y --releasever=20 --installroot=$HOME/fedora-tree --disablerepo='*' --enablerepo=fedora install systemd passwd yum fedora-release vim-minimal
-
```
You can do something similar with debootstrap on a Debian system. Now, we need to set a root password in order to be able to log in:
@@ -65,14 +72,12 @@ As the next step we can already boot the container:
```
$ sudo systemd-nspawn -bD ~/fedora-tree/ 3
-
```
To test systemd in the container I then run this from my source tree on the host:
```
$ make -j10 && sudo DESTDIR=$HOME/fedora-tree make install && sudo systemd-nspawn -bD ~/fedora-tree/ 3
-
```
And that's already it.
diff --git a/docs/WRITING_DESKTOP_ENVIRONMENTS.md b/docs/WRITING_DESKTOP_ENVIRONMENTS.md
index b50c857..774308d 100644
--- a/docs/WRITING_DESKTOP_ENVIRONMENTS.md
+++ b/docs/WRITING_DESKTOP_ENVIRONMENTS.md
@@ -9,22 +9,41 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_Or: how to hook up your favorite desktop environment with logind_
-systemd's logind service obsoletes ConsoleKit which was previously widely used on Linux distributions. This provides a number of new features, but also requires updating of the Desktop Environment running on it, in a few ways.
+systemd's logind service obsoletes ConsoleKit which was previously widely used on Linux distributions.
+This provides a number of new features, but also requires updating of the Desktop Environment running on it, in a few ways.
-This document should be read together with [Writing Display Managers](http://www.freedesktop.org/wiki/Software/systemd/writing-display-managers) which focuses on the porting work necessary for display managers.
+This document should be read together with [Writing Display Managers](/WRITING_DISPLAY_MANAGERS) which focuses on the porting work necessary for display managers.
-If required it is possible to implement ConsoleKit and systemd-logind support in the same desktop environment code, detecting at runtime which interface is needed. The [sd_booted()](http://www.freedesktop.org/software/systemd/man/sd_booted.html) call may be used to determine at runtime whether systemd is used.
+If required it is possible to implement ConsoleKit and systemd-logind support in the same desktop environment code, detecting at runtime which interface is needed.
+The [sd_booted()](http://www.freedesktop.org/software/systemd/man/sd_booted.html) call may be used to determine at runtime whether systemd is used.
To a certain level ConsoleKit and systemd-logind may be used side-by-side, but a number of features are not available if ConsoleKit is used.
-Please have a look at the [Bus API of logind](http://www.freedesktop.org/wiki/Software/systemd/logind) and the C API as documented in [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html). (Also see below)
+Please have a look at the [Bus API of logind](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html) and the C API as documented in [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html). (Also see below)
Here are the suggested changes:
-- Your session manager should listen to "Lock" and "Unlock" messages that are emitted from the session object logind exposes for your DE session, on the system bus. If "Lock" is received the screen lock should be activated, if "Unlock" is received it should be deactivated. This can easily be tested with "loginctl lock-sessions". See the [Bus API of logind](http://www.freedesktop.org/wiki/Software/systemd/logind) for further details.
-- Whenever the session gets idle the DE should invoke the SetIdleHint(True) call on the respective session object on the session bus. This is necessary for the system to implement auto-suspend when all sessions are idle. If the session gets used again it should call SetIdleHint(False). A session should be considered idle if it didn't receive user input (mouse movements, keyboard) in a while. See the [Bus API of logind](http://www.freedesktop.org/wiki/Software/systemd/logind) for further details.
-- To reboot/power-off/suspend/hibernate the machine from the DE use logind's bus calls Reboot(), PowerOff(), Suspend(), Hibernate(), HybridSleep(). For further details see [Bus API of logind](http://www.freedesktop.org/wiki/Software/systemd/logind).
-- If your session manager handles the special power, suspend, hibernate hardware keys or the laptop lid switch on its own it is welcome to do so, but needs to disable logind's built-in handling of these events. Take one or more of the _handle-power-key_, _handle-suspend-key_, _handle-hibernate-key_, _handle-lid-switch_ inhibitor locks for that. See [Inhibitor Locks](http://www.freedesktop.org/wiki/Software/systemd/inhibit) for further details on this.
-- Before rebooting/powering-off/suspending/hibernating and when the operation is triggered by the user by clicking on some UI elements (or suchlike) it is recommended to show the list of currently active inhibitors for the operation, and ask the user to acknowledge the operation. Note that PK often allows the user to execute the operation ignoring the inhibitors. Use logind's ListInhibitors() call to get a list of these inhibitors. See [Inhibitor Locks](http://www.freedesktop.org/wiki/Software/systemd/inhibit) for further details on this.
-- If your DE contains a process viewer of some kind ("system monitor") it's a good idea to show session, service and seat information for each process. Use sd_pid_get_session(), sd_pid_get_unit(), sd_session_get_seat() to determine these. For details see [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html).
- And that's all! Thank you!
+- Your session manager should listen to "Lock" and "Unlock" messages that are emitted from the session object logind exposes for your DE session, on the system bus.
+ If "Lock" is received the screen lock should be activated, if "Unlock" is received it should be deactivated.
+ This can easily be tested with "loginctl lock-sessions".
+ See the [Bus API of logind](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html) for further details.
+- Whenever the session gets idle the DE should invoke the SetIdleHint(True) call on the respective session object on the session bus.
+ This is necessary for the system to implement auto-suspend when all sessions are idle.
+ If the session gets used again it should call SetIdleHint(False).
+ A session should be considered idle if it didn't receive user input (mouse movements, keyboard) in a while.
+ See the [Bus API of logind](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html) for further details.
+- To reboot/power-off/suspend/hibernate the machine from the DE use logind's bus calls Reboot(), PowerOff(), Suspend(), Hibernate(), HybridSleep().
+ For further details see [Bus API of logind](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html).
+- If your session manager handles the special power, suspend, hibernate hardware keys or the laptop lid switch on its own it is welcome to do so,
+ but needs to disable logind's built-in handling of these events.
+ Take one or more of the _handle-power-key_, _handle-suspend-key_, _handle-hibernate-key_, _handle-lid-switch_ inhibitor locks for that.
+ See [Inhibitor Locks](/INHIBITOR_LOCKS) for further details on this.
+- Before rebooting/powering-off/suspending/hibernating and when the operation is triggered by the user by clicking on some UI elements
+ (or suchlike) it is recommended to show the list of currently active inhibitors for the operation, and ask the user to acknowledge the operation.
+ Note that PK often allows the user to execute the operation ignoring the inhibitors.
+ Use logind's ListInhibitors() call to get a list of these inhibitors. See [Inhibitor Locks](/INHIBITOR_LOCKS) for further details on this.
+- If your DE contains a process viewer of some kind ("system monitor") it's a good idea to show session, service and seat information for each process.
+ Use sd_pid_get_session(), sd_pid_get_unit(), sd_session_get_seat() to determine these.
+ For details see [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html).
+
+And that's all! Thank you!
diff --git a/docs/WRITING_DISPLAY_MANAGERS.md b/docs/WRITING_DISPLAY_MANAGERS.md
index efdbccc..467e8a8 100644
--- a/docs/WRITING_DISPLAY_MANAGERS.md
+++ b/docs/WRITING_DISPLAY_MANAGERS.md
@@ -9,31 +9,51 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_Or: How to hook up your favorite X11 display manager with systemd_
-systemd's logind service obsoletes ConsoleKit which was previously widely used on Linux distributions. For X11 display managers the switch to logind requires a minimal amount of porting, however brings a couple of new features: true automatic multi-seat support, proper tracking of session processes, (optional) automatic killing of user processes on logout, a synchronous low-level C API and much simplification.
+systemd's logind service obsoletes ConsoleKit which was previously widely used on Linux distributions.
+For X11 display managers the switch to logind requires a minimal amount of porting, however brings a couple of new features:
+true automatic multi-seat support, proper tracking of session processes, (optional) automatic killing of user processes on logout, a synchronous low-level C API and much simplification.
-This document should be read together with [Writing Desktop Environments](http://www.freedesktop.org/wiki/Software/systemd/writing-desktop-environments) which focuses on the porting work necessary for desktop environments.
+This document should be read together with [Writing Desktop Environments](/WRITING_DESKTOP_ENVIRONMENTS) which focuses on the porting work necessary for desktop environments.
-If required it is possible to implement ConsoleKit and systemd-logind support in the same display manager, detecting at runtime which interface is needed. The [sd_booted()](http://www.freedesktop.org/software/systemd/man/sd_booted.html) call may be used to determine at runtime whether systemd is used.
+If required it is possible to implement ConsoleKit and systemd-logind support in the same display manager, detecting at runtime which interface is needed.
+The [sd_booted()](http://www.freedesktop.org/software/systemd/man/sd_booted.html) call may be used to determine at runtime whether systemd is used.
To a certain level ConsoleKit and systemd-logind may be used side-by-side, but a number of features are not available if ConsoleKit is used, for example automatic multi-seat support.
-Please have a look at the [Bus API of logind](http://www.freedesktop.org/wiki/Software/systemd/logind) and the C API as documented in [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html). (Also see below)
+Please have a look at the [Bus API of logind](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html) and the C API as documented in [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html).
+(Also see below)
Minimal porting (without multi-seat) requires the following:
1. Remove/disable all code responsible for registering your service with ConsoleKit.
-2. Make sure to register your greeter session via the PAM session stack, and make sure the PAM session modules include pam_systemd. Also, make sure to set the session class to "greeter." This may be done by setting the environment variable XDG_SESSION_CLASS to "greeter" with pam_misc_setenv() or setting the "class=greeter" option in the pam_systemd module, in order to allow applications to filter out greeter sessions from normal login sessions.
+2. Make sure to register your greeter session via the PAM session stack, and make sure the PAM session modules include pam_systemd.
+ Also, make sure to set the session class to "greeter." This may be done by setting the environment variable XDG_SESSION_CLASS to "greeter" with pam_misc_setenv() or setting the "class=greeter" option in the pam_systemd module, in order to allow applications to filter out greeter sessions from normal login sessions.
3. Make sure to register your logged in session via the PAM session stack as well, also including pam_systemd in it.
-4. Optionally, use pam_misc_setenv() to set the environment variables XDG_SEAT and XDG_VTNR. The former should contain "seat0", the latter the VT number your session runs on. pam_systemd can determine these values automatically but it's nice to pass these variables anyway.
- In summary: porting a display manager from ConsoleKit to systemd primarily means removing code, not necessarily adding any new code. Here, a cheers to simplicity!
-
-Complete porting (with multi-seat) requires the following (Before you continue, make sure to read up on [Multi-Seat on Linux](http://www.freedesktop.org/wiki/Software/systemd/multiseat) first.):
-
-1. Subscribe to seats showing up and going away, via the systemd-logind D-Bus interface's SeatAdded and SeatRemoved signals. Take possession of each seat by spawning your greeter on it. However, do so exclusively for seats where the boolean CanGraphical property is true. Note that there are seats that cannot do graphical, and there are seats that are text-only first, and gain graphical support later on. Most prominently this is actually seat0 which comes up in text mode, and where the graphics driver is then loaded and probed during boot. This means display managers must watch PropertyChanged events on all seats, to see if they gain (or lose) the CanGraphical field.
+4. Optionally, use pam_misc_setenv() to set the environment variables XDG_SEAT and XDG_VTNR.
+ The former should contain "seat0", the latter the VT number your session runs on. pam_systemd can determine these values automatically but it's nice to pass these variables anyway.
+In summary: porting a display manager from ConsoleKit to systemd primarily means removing code, not necessarily adding any new code. Here, a cheers to simplicity!
+
+Complete porting (with multi-seat) requires the following (Before you continue, make sure to read up on [Multi-Seat on Linux](https://www.freedesktop.org/wiki/Software/systemd/multiseat) first.):
+
+1. Subscribe to seats showing up and going away, via the systemd-logind D-Bus interface's SeatAdded and SeatRemoved signals.
+ Take possession of each seat by spawning your greeter on it.
+ However, do so exclusively for seats where the boolean CanGraphical property is true.
+ Note that there are seats that cannot do graphical, and there are seats that are text-only first, and gain graphical support later on.
+ Most prominently this is actually seat0 which comes up in text mode, and where the graphics driver is then loaded and probed during boot.
+ This means display managers must watch PropertyChanged events on all seats, to see if they gain (or lose) the CanGraphical field.
2. Use ListSeats() on the D-Bus interface to acquire a list of already available seats and also take possession of them.
-3. For each seat you spawn a greeter/user session on use the XDG_SEAT and XDG_VTNR PAM environment variables to inform pam_systemd about the seat name, resp. VT number you start them on. Note that only the special seat "seat0" actually knows kernel VTs, so you shouldn't pass the VT number on any but the main seat, since it doesn't make any sense there.
+3. For each seat you spawn a greeter/user session on use the XDG_SEAT and XDG_VTNR PAM environment variables to inform pam_systemd about the seat name, resp.
+ VT number you start them on. Note that only the special seat "seat0" actually knows kernel VTs, so you shouldn't pass the VT number on any but the main seat, since it doesn't make any sense there.
4. Pass the seat name to the X server you start via the -seat parameter.
-5. At this time X interprets the -seat parameter natively only for input devices, not for graphics devices. To work around this limitation we provide a tiny wrapper /lib/systemd/systemd-multi-seat-x which emulates the enumeration for graphics devices too. This wrapper will eventually go away, as soon as X learns udev-based graphics device enumeration natively, instead of the current PCI based one. Hence it is a good idea to fall back to the real X when this wrapper is not found. You may use this wrapper exactly like the real X server, and internally it will just exec() it after putting together a minimal multi-seat configuration.
+5. At this time X interprets the -seat parameter natively only for input devices, not for graphics devices.
+ To work around this limitation we provide a tiny wrapper /lib/systemd/systemd-multi-seat-x which emulates the enumeration for graphics devices too.
+ This wrapper will eventually go away, as soon as X learns udev-based graphics device enumeration natively, instead of the current PCI based one.
+ Hence it is a good idea to fall back to the real X when this wrapper is not found.
+ You may use this wrapper exactly like the real X server, and internally it will just exec() it after putting together a minimal multi-seat configuration.
And that's already it.
-While most information about seats, sessions and users is available on systemd-logind's D-Bus interface, this is not the only API. The synchronous [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html) C interface is often easier to use and much faster too. In fact it is possible to implement the scheme above entirely without D-Bus relying only on this API. Note however, that this C API is purely passive, and if you want to execute an actually state changing operation you need to use the bus interface (for example, to switch sessions, or to kill sessions and suchlike). Also have a look at the [logind Bus API](http://www.freedesktop.org/wiki/Software/systemd/logind).
+While most information about seats, sessions and users is available on systemd-logind's D-Bus interface, this is not the only API.
+The synchronous [sd-login(7)](http://www.freedesktop.org/software/systemd/man/sd-login.html) C interface is often easier to use and much faster too.
+In fact it is possible to implement the scheme above entirely without D-Bus relying only on this API.
+Note however, that this C API is purely passive, and if you want to execute an actually state changing operation you need to use the bus interface (for example, to switch sessions, or to kill sessions and suchlike).
+Also have a look at the [logind Bus API](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html).
diff --git a/docs/WRITING_NETWORK_CONFIGURATION_MANAGERS.md b/docs/WRITING_NETWORK_CONFIGURATION_MANAGERS.md
index 3a02c3a..7220765 100644
--- a/docs/WRITING_NETWORK_CONFIGURATION_MANAGERS.md
+++ b/docs/WRITING_NETWORK_CONFIGURATION_MANAGERS.md
@@ -9,12 +9,20 @@ SPDX-License-Identifier: LGPL-2.1-or-later
_Or: How to hook up your favourite network configuration manager's DNS logic with `systemd-resolved`_
-_(This is a longer explanation how to use some parts of `systemd-resolved` bus API. If you are just looking for an API reference, consult the [bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/) instead.)_
-
-Since systemd 229 `systemd-resolved` offers a powerful bus API that may be used by network configuration managers (e.g. NetworkManager, connman, …, but also lower level DHCP, VPN or PPP daemons managing specific interfaces) to pass DNS server and DNSSEC configuration directly to `systemd-resolved`. Note that `systemd-resolved` also reads the DNS configuration data in `/etc/resolv.conf`, for compatibility. However, by passing the DNS configuration directly to `systemd-resolved` via the bus a couple of benefits are available:
-
-1. `systemd-resolved` maintains DNS configuration per-interface, instead of simply system-wide, and is capable of sending DNS requests to servers on multiple different network interfaces simultaneously, returning the first positive response (or if all fail, the last negative one). This allows effective "merging" of DNS views on different interfaces, which makes private DNS zones on multi-homed hosts a lot nicer to use. For example, if you are connected to a LAN and a VPN, and both have private DNS zones, then you will be able to resolve both, as long as they don't clash in names. By using the bus API to configure DNS settings, the per-interface configuration is opened up.
-2. Per-link configuration of DNSSEC is available. This is particularly interesting for network configuration managers that implement captive portal detection: as long as a verified connection to the Internet is not found DNSSEC should be turned off (as some captive portal systems alter the DNS in order to redirect clients to their internal pages).
+_(This is a longer explanation how to use some parts of `systemd-resolved` bus API. If you are just looking for an API reference, consult the [bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html) instead.)_
+
+Since systemd 229 `systemd-resolved` offers a powerful bus API that may be used by network configuration managers (e.g. NetworkManager, connman, …, but also lower level DHCP, VPN or PPP daemons managing specific interfaces) to pass DNS server and DNSSEC configuration directly to `systemd-resolved`.
+Note that `systemd-resolved` also reads the DNS configuration data in `/etc/resolv.conf`, for compatibility. However, by passing the DNS configuration directly to `systemd-resolved` via the bus a couple of benefits are available:
+
+1. `systemd-resolved` maintains DNS configuration per-interface, instead of simply system-wide,
+ and is capable of sending DNS requests to servers on multiple different network interfaces simultaneously, returning the first positive response
+ (or if all fail, the last negative one).
+ This allows effective "merging" of DNS views on different interfaces, which makes private DNS zones on multi-homed hosts a lot nicer to use.
+ For example, if you are connected to a LAN and a VPN, and both have private DNS zones, then you will be able to resolve both, as long as they don't clash in names.
+ By using the bus API to configure DNS settings, the per-interface configuration is opened up.
+2. Per-link configuration of DNSSEC is available. This is particularly interesting for network configuration managers that implement captive portal detection:
+ as long as a verified connection to the Internet is not found DNSSEC should be turned off
+ (as some captive portal systems alter the DNS in order to redirect clients to their internal pages).
3. Per-link configuration of LLMNR and MulticastDNS is available.
4. In contrast to changes to `/etc/resolv.conf` all changes made via the bus take effect immediately for all future lookups.
5. Statistical data about executed DNS transactions is available, as well as information about whether DNSSEC is supported on the chosen DNS server.
@@ -23,7 +31,11 @@ Note that `systemd-networkd` is already hooked up with `systemd-resolved`, expos
## Suggested Mode of Operation
-Whenever a network configuration manager sets up an interface for operation, it should pass the DNS configuration information for the interface to `systemd-resolved`. It's recommended to do that after the Linux network interface index ("ifindex") has been allocated, but before the interface has been upped (i.e. `IFF_UP` turned on). That way, `systemd-resolved` will be able to use the configuration the moment the network interface is available. (Note that `systemd-resolved` watches the kernel interfaces come and go, and will make use of them as soon as they are suitable to be used, which among other factors requires `IFF_UP` to be set). That said it is OK to change DNS configuration dynamically any time: simply pass the new data to resolved, and it is happy to use it.
+Whenever a network configuration manager sets up an interface for operation, it should pass the DNS configuration information for the interface to `systemd-resolved`.
+It's recommended to do that after the Linux network interface index ("ifindex") has been allocated, but before the interface has been upped (i.e. `IFF_UP` turned on).
+That way, `systemd-resolved` will be able to use the configuration the moment the network interface is available.
+(Note that `systemd-resolved` watches the kernel interfaces come and go, and will make use of them as soon as they are suitable to be used, which among other factors requires `IFF_UP` to be set).
+That said it is OK to change DNS configuration dynamically any time: simply pass the new data to resolved, and it is happy to use it.
In order to pass the DNS configuration information to resolved, use the following methods of the `org.freedesktop.resolve1.Manager` interface of the `/org/freedesktop/resolve1` object, on the `org.freedesktop.resolve1` service:
@@ -33,19 +45,31 @@ In order to pass the DNS configuration information to resolved, use the followin
4. To configure DNSSEC Negative Trust Anchors (NTAs, i.e. domains for which not to do DNSSEC validation), use `SetLinkDNSSECNegativeTrustAnchors()`
5. To configure the LLMNR and MulticastDNS mode, use `SetLinkLLMNR()` and `SetLinkMulticastDNS()`
-For details about these calls see the [full resolved bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/).
+For details about these calls see the [full resolved bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html).
-The calls should be pretty obvious to use: they simply take an interface index and the parameters to set. IP addresses are encoded as an address family specifier (an integer, that takes the usual `AF_INET` and `AF_INET6` constants), followed by a 4 or 16 byte array with the address in network byte order.
+The calls should be pretty obvious to use: they simply take an interface index and the parameters to set.
+IP addresses are encoded as an address family specifier (an integer, that takes the usual `AF_INET` and `AF_INET6` constants), followed by a 4 or 16 byte array with the address in network byte order.
-`systemd-resolved` distinguishes between "search" and "routing" domains. Routing domains are used to route DNS requests of specific domains to particular interfaces. i.e. requests for a hostname `foo.bar.com` will be routed to any interface that has `bar.com` as routing domain. The same routing domain may be defined on multiple interfaces, in which case the request is routed to all of them in parallel. Resolver requests for hostnames that do not end in any defined routing domain of any interface will be routed to all suitable interfaces. Search domains work like routing domain, but are also used to qualify single-label domain names. They hence are identical to the traditional search domain logic on UNIX. The `SetLinkDomains()` call may used to define both search and routing domains.
+`systemd-resolved` distinguishes between "search" and "routing" domains.
+Routing domains are used to route DNS requests of specific domains to particular interfaces.
+i.e. requests for a hostname `foo.bar.com` will be routed to any interface that has `bar.com` as routing domain.
+The same routing domain may be defined on multiple interfaces, in which case the request is routed to all of them in parallel.
+Resolver requests for hostnames that do not end in any defined routing domain of any interface will be routed to all suitable interfaces.
+Search domains work like routing domain, but are also used to qualify single-label domain names.
+They hence are identical to the traditional search domain logic on UNIX.
+The `SetLinkDomains()` call may used to define both search and routing domains.
-The most basic support of `systemd-resolved` in a network configuration manager would be to simply invoke `SetLinkDNS()` and `SetLinkDomains()` for the specific interface index with the data traditionally written to `/etc/resolv.conf`. More advanced integration could mean the network configuration manager also makes the DNSSEC mode, the DNSSEC NTAs and the LLMNR/MulticastDNS modes available for configuration.
+The most basic support of `systemd-resolved` in a network configuration manager would be to simply invoke `SetLinkDNS()` and `SetLinkDomains()` for the specific interface index with the data traditionally written to `/etc/resolv.conf`.
+More advanced integration could mean the network configuration manager also makes the DNSSEC mode, the DNSSEC NTAs and the LLMNR/MulticastDNS modes available for configuration.
It is strongly recommended for network configuration managers that implement captive portal detection to turn off DNSSEC validation during the detection phase, so that captive portals that modify DNS do not result in all DNSSEC look-ups to fail.
-If a network configuration manager wants to reset specific settings to the defaults (such as the DNSSEC, LLMNR or MulticastDNS mode), it may simply call the function with an empty argument. To reset all per-link changes it made it may call `RevertLink()`.
+If a network configuration manager wants to reset specific settings to the defaults (such as the DNSSEC, LLMNR or MulticastDNS mode), it may simply call the function with an empty argument.
+To reset all per-link changes it made it may call `RevertLink()`.
-To read back the various settings made, use `GetLink()` to get a `org.freedesktop.resolve1.Link` object for a specific network interface. It exposes the current settings in its bus properties. See the [full bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/) for details on this.
+To read back the various settings made, use `GetLink()` to get a `org.freedesktop.resolve1.Link` object for a specific network interface.
+It exposes the current settings in its bus properties.
+See the [full bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html) for details on this.
In order to translate a network interface name to an interface index, use the usual glibc `if_nametoindex()` call.
@@ -55,10 +79,16 @@ Note that it is fully OK if multiple different daemons push DNS configuration da
## Handling of `/etc/resolv.conf`
-`systemd-resolved` receives DNS configuration from a number of sources, via the bus, as well as directly from `systemd-networkd` or user configuration. It uses this data to write a file that is compatible with the traditional Linux `/etc/resolv.conf` file. This file is stored in `/run/systemd/resolve/resolv.conf`. It is recommended to symlink `/etc/resolv.conf` to this file, in order to provide compatibility with programs reading the file directly and not going via the NSS and thus `systemd-resolved`.
+`systemd-resolved` receives DNS configuration from a number of sources, via the bus, as well as directly from `systemd-networkd` or user configuration.
+It uses this data to write a file that is compatible with the traditional Linux `/etc/resolv.conf` file.
+This file is stored in `/run/systemd/resolve/resolv.conf`. It is recommended to symlink `/etc/resolv.conf` to this file, in order to provide compatibility with programs reading the file directly and not going via the NSS and thus `systemd-resolved`.
-For network configuration managers it is recommended to rely on this resolved-provided mechanism to update `resolv.conf`. Specifically, the network configuration manager should stop modifying `/etc/resolv.conf` directly if it notices it being a symlink to `/run/systemd/resolve/resolv.conf`.
+For network configuration managers it is recommended to rely on this resolved-provided mechanism to update `resolv.conf`.
+Specifically, the network configuration manager should stop modifying `/etc/resolv.conf` directly if it notices it being a symlink to `/run/systemd/resolve/resolv.conf`.
-If a system configuration manager desires to be compatible both with systems that use `systemd-resolved` and those which do not, it is recommended to first push any discovered DNS configuration into `systemd-resolved`, and deal gracefully with `systemd-resolved` not being available on the bus. If `/etc/resolv.conf` is a not a symlink to `/run/systemd/resolve/resolv.conf` the manager may then proceed and also update `/etc/resolv.conf`. With this mode of operation optimal compatibility is provided, as `systemd-resolved` is used for `/etc/resolv.conf` management when this is configured, but transparent compatibility with non-`systemd-resolved` systems is maintained. Note that `systemd-resolved` is part of systemd, and hence likely to be pretty universally available on Linux systems soon.
+If a system configuration manager desires to be compatible both with systems that use `systemd-resolved` and those which do not, it is recommended to first push any discovered DNS configuration into `systemd-resolved`, and deal gracefully with `systemd-resolved` not being available on the bus.
+If `/etc/resolv.conf` is a not a symlink to `/run/systemd/resolve/resolv.conf` the manager may then proceed and also update `/etc/resolv.conf`.
+With this mode of operation optimal compatibility is provided, as `systemd-resolved` is used for `/etc/resolv.conf` management when this is configured, but transparent compatibility with non-`systemd-resolved` systems is maintained.
+Note that `systemd-resolved` is part of systemd, and hence likely to be pretty universally available on Linux systems soon.
By allowing `systemd-resolved` to manage `/etc/resolv.conf` ownership issues regarding different programs overwriting each other's DNS configuration are effectively removed.
diff --git a/docs/WRITING_RESOLVER_CLIENTS.md b/docs/WRITING_RESOLVER_CLIENTS.md
index 88a873a..93c51c5 100644
--- a/docs/WRITING_RESOLVER_CLIENTS.md
+++ b/docs/WRITING_RESOLVER_CLIENTS.md
@@ -7,41 +7,53 @@ SPDX-License-Identifier: LGPL-2.1-or-later
# Writing Resolver Clients
-_Or: How to look up hostnames and arbitrary DNS Resource Records via \_systemd-resolved_'s bus APIs\_
+_Or: How to look up hostnames and arbitrary DNS Resource Records via_ `systemd-resolved` _'s bus APIs_
-_(This is a longer explanation how to use some parts of \_systemd-resolved_ bus API. If you are just looking for an API reference, consult the [bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/) instead.)\_
+_(This is a longer explanation how to use some parts of_ `systemd-resolved` _bus API. If you are just looking for an API reference, consult the [bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html) instead.)_
-_systemd-resolved_ provides a set of APIs on the bus for resolving DNS resource records. These are:
+_`systemd-resolved`_ provides a set of APIs on the bus for resolving DNS resource records. These are:
1. _ResolveHostname()_ for resolving hostnames to acquire their IP addresses
2. _ResolveAddress()_ for the reverse operation: acquire the hostname for an IP address
3. _ResolveService()_ for resolving a DNS-SD or SRV service
4. _ResolveRecord()_ for resolving arbitrary resource records.
-Below you'll find examples for two of these calls, to show how to use them. Note that glibc offers similar (and more portable) calls in _getaddrinfo()_, _getnameinfo()_ and _res_query()_. Of these _getaddrinfo()_ and _getnameinfo()_ are directed to the calls above via the _nss-resolve_ NSS module, but _req_query()_ is not. There are a number of reasons why it might be preferable to invoke _systemd-resolved_'s bus calls rather than the glibc APIs:
+Below you'll find examples for two of these calls, to show how to use them.
+Note that glibc offers similar (and more portable) calls in _getaddrinfo()_, _getnameinfo()_ and _res\_query()_.
+Of these _getaddrinfo()_ and _getnameinfo()_ are directed to the calls above via the _nss-resolve_ NSS module, but _req\_query()_ is not.
+There are a number of reasons why it might be preferable to invoke `systemd-resolved`'s bus calls rather than the glibc APIs:
1. Bus APIs are naturally asynchronous, which the glibc APIs generally are not.
-2. The bus calls above pass back substantially more information about the resolved data, including where and how the data was found (i.e. which protocol was used: DNS, LLMNR, MulticastDNS, and on which network interface), and most importantly, whether the data could be authenticated via DNSSEC. This in particular makes these APIs useful for retrieving certificate data from the DNS, in order to implement DANE, SSHFP, OPENGPGKEY and IPSECKEY clients.
+2. The bus calls above pass back substantially more information about the resolved data, including where and how the data was found
+ (i.e. which protocol was used: DNS, LLMNR, MulticastDNS, and on which network interface), and most importantly, whether the data could be authenticated via DNSSEC.
+ This in particular makes these APIs useful for retrieving certificate data from the DNS, in order to implement DANE, SSHFP, OPENGPGKEY and IPSECKEY clients.
3. _ResolveService()_ knows no counterpart in glibc, and has the benefit of being a single call that collects all data necessary to connect to a DNS-SD or pure SRV service in one step.
-4. _ResolveRecord()_ in contrast to _res_query()_ supports LLMNR and MulticastDNS as protocols on top of DNS, and makes use of _systemd-resolved_'s local DNS record cache. The processing of the request is done in the sandboxed _systemd-resolved_ process rather than in the local process, and all packets are pre-validated. Because this relies on _systemd-resolved_ the per-interface DNS zone handling is supported.
+4. _ResolveRecord()_ in contrast to _res\_query()_ supports LLMNR and MulticastDNS as protocols on top of DNS, and makes use of `systemd-resolved`'s local DNS record cache.
+ The processing of the request is done in the sandboxed `systemd-resolved` process rather than in the local process, and all packets are pre-validated.
+ Because this relies on `systemd-resolved` the per-interface DNS zone handling is supported.
-Of course, by using _systemd-resolved_ you lose some portability, but this could be handled via an automatic fallback to the glibc counterparts.
+Of course, by using `systemd-resolved` you lose some portability, but this could be handled via an automatic fallback to the glibc counterparts.
-Note that the various resolver calls provided by _systemd-resolved_ will consult _/etc/hosts_ and synthesize resource records for these entries in order to ensure that this file is honoured fully.
+Note that the various resolver calls provided by `systemd-resolved` will consult `/etc/hosts` and synthesize resource records for these entries in order to ensure that this file is honoured fully.
-The examples below use the _sd-bus_ D-Bus client implementation, which is part of _libsystemd_. Any other D-Bus library, including the original _libdbus_ or _GDBus_ may be used too.
+The examples below use the _sd-bus_ D-Bus client implementation, which is part of _libsystemd_.
+Any other D-Bus library, including the original _libdbus_ or _GDBus_ may be used too.
## Resolving a Hostname
-To resolve a hostname use the _ResolveHostname()_ call. For details on the function parameters see the [bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/).
+To resolve a hostname use the _ResolveHostname()_ call. For details on the function parameters see the [bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html).
-This example specifies _AF_UNSPEC_ as address family for the requested address. This means both an _AF_INET_ (A) and an _AF_INET6_ (AAAA) record is looked for, depending on whether the local system has configured IPv4 and/or IPv6 connectivity. It is generally recommended to request _AF_UNSPEC_ addresses for best compatibility with both protocols, in particular on dual-stack systems.
+This example specifies `AF_UNSPEC` as address family for the requested address.
+This means both an _AF\_INET_ (A) and an _AF\_INET6_ (AAAA) record is looked for, depending on whether the local system has configured IPv4 and/or IPv6 connectivity.
+It is generally recommended to request `AF_UNSPEC` addresses for best compatibility with both protocols, in particular on dual-stack systems.
-The example specifies a network interface index of "0", i.e. does not specify any at all, so that the request may be done on any. Note that the interface index is primarily relevant for LLMNR and MulticastDNS lookups, which distinguish different scopes for each network interface index.
+The example specifies a network interface index of "0", i.e. does not specify any at all, so that the request may be done on any.
+Note that the interface index is primarily relevant for LLMNR and MulticastDNS lookups, which distinguish different scopes for each network interface index.
-This examples makes no use of either the input flags parameter, nor the output flags parameter. See the _ResolveRecord()_ example below for information how to make use of the _SD_RESOLVED_AUTHENTICATED_ bit in the returned flags parameter.
+This examples makes no use of either the input flags parameter, nor the output flags parameter.
+See the _ResolveRecord()_ example below for information how to make use of the _SD\_RESOLVED\_AUTHENTICATED_ bit in the returned flags parameter.
-```
+```c
#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
@@ -137,16 +149,20 @@ gcc addrtest.c -o addrtest -Wall `pkg-config --cflags --libs libsystemd`
## Resolving an Arbitrary DNS Resource Record
-Use `ResolveRecord()` in order to resolve arbitrary resource records. The call will return the binary RRset data. This calls is useful to acquire resource records for which no high-level calls such as ResolveHostname(), ResolveAddress() and ResolveService() exist. In particular RRs such as MX, SSHFP, TLSA, CERT, OPENPGPKEY or IPSECKEY may be requested via this API.
+Use `ResolveRecord()` in order to resolve arbitrary resource records. The call will return the binary RRset data.
+This calls is useful to acquire resource records for which no high-level calls such as ResolveHostname(), ResolveAddress() and ResolveService() exist.
+In particular RRs such as MX, SSHFP, TLSA, CERT, OPENPGPKEY or IPSECKEY may be requested via this API.
This example also shows how to determine whether the acquired data has been authenticated via DNSSEC (or another means) by checking the `SD_RESOLVED_AUTHENTICATED` bit in the
returned `flags` parameter.
-This example contains a simple MX record parser. Note that the data comes pre-validated from `systemd-resolved`, hence we allow the example to parse the record slightly sloppily, to keep the example brief. For details on the MX RR binary format, see [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.txt).
+This example contains a simple MX record parser.
+Note that the data comes pre-validated from `systemd-resolved`, hence we allow the example to parse the record slightly sloppily, to keep the example brief.
+For details on the MX RR binary format, see [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.txt).
-For details on the function parameters see the [bus API documentation](https://wiki.freedesktop.org/www/Software/systemd/resolved/).
+For details on the function parameters see the [bus API documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html).
-```
+```c
#include <assert.h>
#include <endian.h>
#include <stdbool.h>
diff --git a/docs/WRITING_VM_AND_CONTAINER_MANAGERS.md b/docs/WRITING_VM_AND_CONTAINER_MANAGERS.md
index 4d1b649..e3cc280 100644
--- a/docs/WRITING_VM_AND_CONTAINER_MANAGERS.md
+++ b/docs/WRITING_VM_AND_CONTAINER_MANAGERS.md
@@ -5,25 +5,58 @@ layout: default
SPDX-License-Identifier: LGPL-2.1-or-later
---
-
# Writing VM and Container Managers
_Or: How to hook up your favorite VM or container manager with systemd_
-Nomenclature: a _Virtual Machine_ shall refer to a system running on virtualized hardware consisting of a full OS with its own kernel. A _Container_ shall refer to a system running on the same shared kernel of the host, but running a mostly complete OS with its own init system. Both kinds of virtualized systems shall collectively be called "machines".
+Nomenclature: a _Virtual Machine_ shall refer to a system running on
+virtualized hardware consisting of a full OS with its own kernel. A _Container_
+shall refer to a system running on the same shared kernel of the host, but
+running a mostly complete OS with its own init system. Both kinds of
+virtualized systems shall collectively be called "machines".
-systemd provides a number of integration points with virtual machine and container managers, such as libvirt, LXC or systemd-nspawn. On one hand there are integration points of the VM/container manager towards the host OS it is running on, and on the other there integration points for container managers towards the guest OS it is managing.
+systemd provides a number of integration points with virtual machine and
+container managers, such as libvirt, LXC or systemd-nspawn. On one hand there
+are integration points of the VM/container manager towards the host OS it is
+running on, and on the other there integration points for container managers
+towards the guest OS it is managing.
-Note that this document does not cover lightweight containers for the purpose of application sandboxes, i.e. containers that do _not_ run a init system of their own.
+Note that this document does not cover lightweight containers for the purpose
+of application sandboxes, i.e. containers that do _not_ run a init system of
+their own.
## Host OS Integration
-All virtual machines and containers should be registered with the [machined](http://www.freedesktop.org/wiki/Software/systemd/machined) mini service that is part of systemd. This provides integration into the core OS at various points. For example, tools like ps, cgls, gnome-system-manager use this registration information to show machine information for running processes, as each of the VM's/container's processes can reliably attributed to a registered machine. The various systemd tools (like systemctl, journalctl, loginctl, systemd-run, ...) all support a -M switch that operates on machines registered with machined. "machinectl" may be used to execute operations on any such machine. When a machine is registered via machined its processes will automatically be placed in a systemd scope unit (that is located in the machines.slice slice) and thus appear in "systemctl" and similar commands. The scope unit name is based on the machine meta information passed to machined at registration.
-
-For more details on the APIs provided by machine consult [the bus API interface documentation](http://www.freedesktop.org/wiki/Software/systemd/machined).
+All virtual machines and containers should be registered with the
+[systemd-machined(8)](https://www.freedesktop.org/software/systemd/man/latest/systemd-machined.service.html)
+mini service that is part of systemd. This provides integration into the core
+OS at various points. For example, tools like ps, cgls, gnome-system-manager
+use this registration information to show machine information for running
+processes, as each of the VM's/container's processes can reliably attributed to
+a registered machine. The various systemd tools (like systemctl, journalctl,
+loginctl, systemd-run, ...) all support a -M switch that operates on machines
+registered with machined. "machinectl" may be used to execute operations on any
+such machine. When a machine is registered via machined its processes will
+automatically be placed in a systemd scope unit (that is located in the
+machines.slice slice) and thus appear in "systemctl" and similar commands. The
+scope unit name is based on the machine meta information passed to machined at
+registration.
+
+For more details on the APIs provided by machine consult [the bus API interface
+documentation](https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.machine1.html).
## Guest OS Integration
-As container virtualization is much less comprehensive, and the guest is less isolated from the host, there are a number of interfaces defined how the container manager can set up the environment for systemd running inside a container. These Interfaces are documented in [Container Interface of systemd](http://www.freedesktop.org/wiki/Software/systemd/ContainerInterface).
-
-VM virtualization is more comprehensive and fewer integration APIs are available. In fact there's only one: a VM manager may initialize the SMBIOS DMI field "Product UUUID" to a UUID uniquely identifying this virtual machine instance. This is read in the guest via /sys/class/dmi/id/product_uuid, and used as configuration source for /etc/machine-id if in the guest, if that file is not initialized yet. Note that this is currently only supported for kvm hosts, but may be extended to other managers as well.
+As container virtualization is much less comprehensive, and the guest is less
+isolated from the host, there are a number of interfaces defined how the
+container manager can set up the environment for systemd running inside a
+container. These Interfaces are documented in [Container Interface of
+systemd](https://systemd.io/CONTAINER_INTERFACE).
+
+VM virtualization is more comprehensive and fewer integration APIs are
+available. In fact there's only one: a VM manager may initialize the SMBIOS DMI
+field "Product UUUID" to a UUID uniquely identifying this virtual machine
+instance. This is read in the guest via /sys/class/dmi/id/product_uuid, and
+used as configuration source for /etc/machine-id if in the guest, if that file
+is not initialized yet. Note that this is currently only supported for kvm
+hosts, but may be extended to other managers as well.
diff --git a/docs/assets/f17boot.png b/docs/assets/f17boot.png
new file mode 100644
index 0000000..8415b81
--- /dev/null
+++ b/docs/assets/f17boot.png
Binary files differ