]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine-id-setup: update comment 33011/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 May 2024 16:47:23 +0000 (01:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 May 2024 17:13:22 +0000 (02:13 +0900)
If an initrd has an empty or uninitialized /etc/machine-id file,
then PID1 write a valid machine ID. So, the logic is important only on
soft-reboot. Let's mention that explicitly.

Follow-up for 16718dcf78a90faf8c5f53d7bf63e3575bc78be7.

src/shared/machine-id-setup.c

index 66d2f300dff70b22b40015554e783d52ffe73c26..1a637947564052cb763333d2ac44f5b75f300cc1 100644 (file)
@@ -55,8 +55,8 @@ static int acquire_machine_id(const char *root, sd_id128_t *ret) {
         assert(ret);
 
         /* First, try reading the machine ID from /run/machine-id, which may not be mounted on
-         * /etc/machine-id yet. This is important on switching root, Otherwise, machine ID may be changed
-         * after the transition. */
+         * /etc/machine-id yet. This is important on switching root especially on soft-reboot, Otherwise,
+         * machine ID may be changed after the transition. */
         if (isempty(root) && running_in_chroot() <= 0 &&
             id128_read("/run/machine-id", ID128_FORMAT_PLAIN, ret) >= 0) {
                 log_info("Reusing machine ID stored in /run/machine-id.");