]> git.ipfire.org Git - thirdparty/systemd.git/commit
manager: optionally, do a full preset on first boot 15205/head
authorJonathan Lebon <jonathan@jlebon.com>
Mon, 23 Mar 2020 16:25:19 +0000 (12:25 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 May 2022 07:10:54 +0000 (09:10 +0200)
commit93651582aef1ee626dc6f8d032195acd73bc9372
tree9802513a1baf7f556650516a7ced91e40b2a955d
parentc1e0dc9c882dfae7ba4bf49c50fd253ea199e7d9
manager: optionally, do a full preset on first boot

A compile time option is added to select behaviour: by default
UNIT_FILE_PRESET_ENABLE_ONLY is still used, but the intent is to change to
UNIT_FILE_PRESET_FULL at some point in the future. Distros that want to
opt-in can use the config option to change the behaviour.

(The option is just a boolean: it would be possible to make it multi-valued,
and allow full, enable-only, disable-only, none. But so far nobody has asked
for this, and it's better not to complicate things needlessly.)

With the configuration option flipped, instead of only doing enablements,
perform a full preset on first boot. The reason is that although
`/etc/machine-id` might be missing, there may be other files provisioned in
`/etc` (in fact, this use case is mentioned in `log_execution_mode`). Some of
those possible files include enablement symlinks even if presets dictate it
should be disabled.

Such a seemingly contradictory situation occurs in {RHEL,Fedora} CoreOS,
where we ship `/etc` as if `preset-all` were called. However, we want to
allow users to disable default-enabled services via Ignition, which does
this by creating preset dropins before switchroot. (For why we do
`preset-all` at compose time, see:
https://github.com/coreos/fedora-coreos-config/pull/77).

For example, the composed FCOS image has a `enable zincati.service`
preset and an enablement for that in `/etc`, while at boot time when we
switch root, there may be a `disable zincati.service` preset with higher
precedence. In that case, we want systemd to disable the service.

This is essentially a revert of 304b3079a203. It seems like systemd
*used* to do this, but it was changed to try to make the container
workflow a bit faster.

Resolves: https://github.com/coreos/fedora-coreos-tracker/issues/392

Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
meson.build
meson_options.txt
src/core/manager.c