]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: correctly handle "uninitialized" machine-id
authorHarald Seiler <hws@denx.de>
Thu, 15 Oct 2020 19:25:06 +0000 (21:25 +0200)
committerHarald Seiler <hws@denx.de>
Mon, 19 Oct 2020 14:28:21 +0000 (16:28 +0200)
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.

src/partition/repart.c

index d406c9dbe3ed0d5a15955c8c9f8f4798e5f235cf..4cf6a5fe3a69e447557b028c7f2fcf57c48d9fda 100644 (file)
@@ -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)