From d99baf29c5bccf94b4cabed88c57d62ca954126f Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Sat, 26 Nov 2022 01:45:49 +0000 Subject: [PATCH] Backport the UUID grub fix to bullseye too --- tools/boot/bullseye/boot-arm64 | 2 ++ tools/boot/bullseye/boot-armhf | 2 ++ tools/boot/bullseye/boot-hurd-common | 2 ++ tools/boot/bullseye/boot-ia64 | 2 ++ tools/boot/bullseye/boot-x86 | 2 ++ tools/boot/bullseye/common.sh | 14 ++++++++++++++ 6 files changed, 24 insertions(+) diff --git a/tools/boot/bullseye/boot-arm64 b/tools/boot/bullseye/boot-arm64 index d954dff3..b7551494 100755 --- a/tools/boot/bullseye/boot-arm64 +++ b/tools/boot/bullseye/boot-arm64 @@ -91,6 +91,8 @@ if [ -d boot$N/grub ] ; then mv boot$N/grub/* $CDDIR/boot/grub/ rmdir boot$N/grub + change_grub_cfg_uuid $CDDIR + # Stuff the EFI boot files into a FAT filesystem, making it as # small as possible. We end up re-packing like this in case we're # making a multi-arch image diff --git a/tools/boot/bullseye/boot-armhf b/tools/boot/bullseye/boot-armhf index 8ff8fdcc..abe0ce3f 100755 --- a/tools/boot/bullseye/boot-armhf +++ b/tools/boot/bullseye/boot-armhf @@ -90,6 +90,8 @@ if [ -d boot$N/grub ] ; then mv boot$N/grub/* $CDDIR/boot/grub/ rmdir boot$N/grub + change_grub_cfg_uuid $CDDIR + # Stuff the EFI boot files into a FAT filesystem, making it as # small as possible. We end up re-packing like this in case we're # making a multi-arch image diff --git a/tools/boot/bullseye/boot-hurd-common b/tools/boot/bullseye/boot-hurd-common index daf9903b..8e7f1f30 100644 --- a/tools/boot/bullseye/boot-hurd-common +++ b/tools/boot/bullseye/boot-hurd-common @@ -134,6 +134,8 @@ if [ $BOOT_EFI -ne 0 ] ; then mv boot$N/grub/* $CDDIR/boot/grub/ rmdir boot$N/grub + change_grub_cfg_uuid $CDDIR + # Stuff the EFI boot files into a FAT filesystem, making it as # small as possible. We end up re-packing like this in case we're # making a multi-arch image diff --git a/tools/boot/bullseye/boot-ia64 b/tools/boot/bullseye/boot-ia64 index d8c42ae3..488b8486 100755 --- a/tools/boot/bullseye/boot-ia64 +++ b/tools/boot/bullseye/boot-ia64 @@ -91,6 +91,8 @@ if [ -d boot$N/grub ] ; then # small as possible. We end up re-packing like this in case we're # making a multi-arch image + change_grub_cfg_uuid $CDDIR + # First, work out how many blocks we need blocks=$(calculate_efi_image_size $CDDIR) diff --git a/tools/boot/bullseye/boot-x86 b/tools/boot/bullseye/boot-x86 index 0e12ed73..610202f9 100644 --- a/tools/boot/bullseye/boot-x86 +++ b/tools/boot/bullseye/boot-x86 @@ -453,6 +453,8 @@ if [ -d boot$N/isolinux/grub ] && [ $BOOT_EFI -ne 0 ] ; then # small as possible. We end up re-packing like this in case we're # making a multi-arch image + change_grub_cfg_uuid $CDDIR + # First, work out how many blocks we need blocks=$(calculate_efi_image_size $CDDIR) diff --git a/tools/boot/bullseye/common.sh b/tools/boot/bullseye/common.sh index c31453a2..33556b89 100644 --- a/tools/boot/bullseye/common.sh +++ b/tools/boot/bullseye/common.sh @@ -222,3 +222,17 @@ extra_image () { fi done } + +change_grub_cfg_uuid () { + CDDIR=$1 + + # We (used to) look for /.disk/info in grub.cfg to find this + # Debian media once we've booted via EFI. This is not 100% + # reliable - see #1024346 and #1024720 for examples where this + # fails. Instead, let's generate a UUID here and use that as a + # flag file. + UUID=$(uuidgen) + mkdir -p $CDDIR/.disk/id + touch $CDDIR/.disk/id/$UUID + sed -i "/search --file --set=root/s,.disk/info,.disk/id/$UUID," $CDDIR/EFI/debian/grub.cfg +}