summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Seiler <hws@denx.de>2020-10-15 21:25:06 +0200
committerHarald Seiler <hws@denx.de>2020-10-19 16:28:21 +0200
commit448b782cb2629f303f0c979f67e97411073e19cc (patch)
tree4779b10548c02055b7b13daa3bcc373a862ae820
parentc5fbeedb0c9e154ddde7ad47b48b469dfc835d02 (diff)
downloadsystemd-448b782cb2629f303f0c979f67e97411073e19cc.tar.gz
repart: correctly handle "uninitialized" machine-id
When systemd-repart runs from initramfs, it reads out /etc/machine-id from the rootfs as a seed for partition UUIDs. However, the machine-id could be in an "uninitialized" state from a previous failed first boot. In this situation the -ENOMEDIUM code-path (no machine-id set) should be taken.
-rw-r--r--src/partition/repart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index d406c9dbe3..4cf6a5fe3a 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -3245,7 +3245,7 @@ static int context_read_seed(Context *context, const char *root) {
else if (fd < 0)
return log_error_errno(fd, "Failed to determine machine ID of image: %m");
else {
- r = id128_read_fd(fd, ID128_PLAIN, &context->seed);
+ r = id128_read_fd(fd, ID128_PLAIN_OR_UNINIT, &context->seed);
if (r == -ENOMEDIUM)
log_info("No machine ID set, using randomized partition UUIDs.");
else if (r < 0)