Systemd/src/core/machine-id-setup.h
Harald Seiler 3023f2fead core: keep machine-id transient until first boot completes
Currently, a loss of power after the machine-id was written but before
all units with ConditionFirstBoot=yes ran would lead to the next boot
finding a valid machine-id, thus not being marked first boot and not
re-running these units.

To make the first boot mechanism more robust, instead of writing
/etc/machine-id very early, fill it with a marker value "uninitialized"
and overmount it with a transiently provisioned machine-id.  Then, after
the first boots completes (when systemd-machine-id-commit.service runs),
write the real machine-id to disk.

This mechanism is of course only invoked on first boot.  If a first boot
is not detected, the machine-id is handled as previously.

Fixes: #4511
2020-10-19 16:28:22 +02:00

8 lines
219 B
C

/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <stdbool.h>
int machine_id_commit(const char *root);
int machine_id_setup(const char *root, bool force_transient, sd_id128_t requested, sd_id128_t *ret);