diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install index 3edefdefb4..046771169c 100644 --- a/src/kernel-install/90-loaderentry.install +++ b/src/kernel-install/90-loaderentry.install @@ -68,7 +68,11 @@ elif [ -r /usr/lib/kernel/cmdline ]; then else BOOT_OPTIONS="$(tr -s "$IFS" '\n' >/etc/machine-info -[ -z "$MACHINE_ID" ] && NEW_MACHINE_ID="$(systemd-id128 new)" && echo "KERNEL_INSTALL_MACHINE_ID=$NEW_MACHINE_ID" >>/etc/machine-info -[ -z "$MACHINE_ID" ] && [ -r /etc/machine-info ] && . /etc/machine-info && MACHINE_ID="$KERNEL_INSTALL_MACHINE_ID" -[ -z "$MACHINE_ID" ] && MACHINE_ID="Default" +# If /etc/machine-id is initialized we'll use it, otherwise we'll use a freshly +# generated one. If the user configured an explicit machine ID to use in +# /etc/machine-info to use for our purpose, we'll use that instead (for +# compatibility). +[ -z "$MACHINE_ID" ] && [ -r /etc/machine-info ] && . /etc/machine-info && MACHINE_ID="$KERNEL_INSTALL_MACHINE_ID" +[ -z "$MACHINE_ID" ] && [ -r /etc/machine-id ] && read -r MACHINE_ID