From 260883d96f33e7aced3d00c85d0ebffcec1385a1 Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Mon, 20 Mar 2023 14:10:35 +0100 Subject: [PATCH] fix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uninitialized Handle the case where the user tries to debug the shutdown after explicitly resetting the /etc/machine-id file. --- dracut-initramfs-restore.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh index 01d114b98b..412c3a8279 100755 --- a/dracut-initramfs-restore.sh +++ b/dracut-initramfs-restore.sh @@ -19,8 +19,9 @@ SKIP="$dracutbasedir/skipcpio" if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then MACHINE_ID="Default" -elif [[ -f /etc/machine-id ]]; then +elif [[ -s /etc/machine-id ]]; then read -r MACHINE_ID < /etc/machine-id + [[ $MACHINE_ID == "uninitialized" ]] && MACHINE_ID="Default" else MACHINE_ID="Default" fi