[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1035085: Bookworm RC2 grub-installer/os-prober quirks

On 29/04/2023 at 11:22, I wrote:
1) In expert install (or low priority), the new os-prober dialog displayed by grub-installer lists only unsupported OS but not supported OS.
(Patch attached)

2) "efi" os-prober type is considered unsupported.
In EFI mode, os-prober detects EFI boot loaders such as Windows Boot Manager with type "efi". GRUB can add menu entries for these boot loaders so this type should be in the supported list instead of the unsupported list. (AFAICS it does not matter much because the supported OS list is used only when installing GRUB for legacy boot and not EFI boot.)
(Patch attached)

Another one:

If the installer was booted in EFI mode but detected existing operating systems already installed using "BIOS compatibility mode" and the user chose to not force UEFI installation, update-grub executed in the target chroot still behaves in EFI mode: it detects and adds entries for EFI boot loaders and UEFI firmware settings to the GRUB menu and ignores legacy boot loaders. It should do the opposite, even though running update-grub again after booting the installed system will fix the GRUB menu.
(Patch attached)

I tested the 3 patches together with BIOS boot, EFI boot + installation, EFI boot + BIOS installation.
From 5adc3dd8bf3118f40018bc3447a9f60684f1343e Mon Sep 17 00:00:00 2001
From: Pascal Hambourg <pascal@plouf.fr.eu.org>
Date: Sun, 30 Apr 2023 09:06:52 +0200
Subject: [PATCH 3/3] Do no run EFI probes in target chroot if ignore_uefi is

If partman-efi set /var/lib/partman/ignore_uefi, we do not want
os-prober to skip legacy probes and perform EFI probes, so create
ignore_uefi in /target. We also do not want grub 30_uefi-firmware
to probe UEFI firmware settings, so do not mount efivarfs (only
needed when installing grub-efi).
 debian/postinst | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/debian/postinst b/debian/postinst
index 85714195..1ff3f851 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -43,6 +43,16 @@ mountvirtfs () {
 # target. Maybe /proc too?
 mountvirtfs proc /target/proc
 mountvirtfs sysfs /target/sys
-mountvirtfs efivarfs /target/sys/firmware/efi/efivars
+if [ -e /var/lib/partman/ignore_uefi ]; then
+	# prevent os-prober EFI probes in target chroot
+	mkdir -p /target/var/lib/partman
+	touch /target/var/lib/partman/ignore_uefi
+	mountvirtfs efivarfs /target/sys/firmware/efi/efivars
 grub-installer /target
+rm -f /target/var/lib/partman/ignore_uefi
+rmdir /target/var/lib/partman 2>/dev/null || true

Reply to: