summaryrefslogtreecommitdiff
path: root/src/machine-id-setup
diff options
context:
space:
mode:
authorHarald Seiler <hws@denx.de>2020-09-06 21:23:36 +0200
committerHarald Seiler <hws@denx.de>2020-10-19 16:28:22 +0200
commit3023f2fead7df9f219acf3c8595d974e31ad23cc (patch)
tree5990d3fd4a265082dd71544eb06b6b355f987ccc /src/machine-id-setup
parentab763cb2be08410d45dafed9c2801406a427a4d3 (diff)
downloadsystemd-3023f2fead7df9f219acf3c8595d974e31ad23cc.tar.gz
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.c2
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;
}