diff options
author | Harald Seiler <hws@denx.de> | 2020-09-06 21:23:36 +0200 |
---|---|---|
committer | Harald Seiler <hws@denx.de> | 2020-10-19 16:28:22 +0200 |
commit | 3023f2fead7df9f219acf3c8595d974e31ad23cc (patch) | |
tree | 5990d3fd4a265082dd71544eb06b6b355f987ccc /src/machine-id-setup | |
parent | dissect-image: support "uninitialized" machine-id (diff) | |
download | systemd-3023f2fead7df9f219acf3c8595d974e31ad23cc.tar.xz systemd-3023f2fead7df9f219acf3c8595d974e31ad23cc.zip |
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
Diffstat (limited to 'src/machine-id-setup')
-rw-r--r-- | src/machine-id-setup/machine-id-setup-main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c index 872b00c158..2bcd99109e 100644 --- a/src/machine-id-setup/machine-id-setup-main.c +++ b/src/machine-id-setup/machine-id-setup-main.c @@ -128,7 +128,7 @@ static int run(int argc, char *argv[]) { if (r < 0) return log_error_errno(r, "Failed to read machine ID back: %m"); } else { - r = machine_id_setup(arg_root, SD_ID128_NULL, &id); + r = machine_id_setup(arg_root, false, SD_ID128_NULL, &id); if (r < 0) return r; } |