Bug#1134708: grub-common: 30_uefi-firmware runs on BIOS/MBR systems producing unbootable configuration
Pascal Hambourg
pascal at plouf.fr.eu.org
Thu Apr 23 16:05:43 BST 2026
On 23/04/2026 at 15:21, Donald Teed wrote:
>
> The root cause is that /etc/grub.d/30_uefi-firmware is installed executable
> by grub-common and is unconditionally executed by grub-mkconfig regardless
> of whether the running system has UEFI firmware. On this BIOS/MBR system,
> the script generated a "UEFI Firmware Settings" entry in grub.cfg which
> caused the boot process to stall after the GRUB banner, leaving the system
> unbootable.
What do you mean exactly by "stall" ? Is anything displayed after the
GRUB banner (error message, grub> prompt...) ?
Can you post the generated grub.cfg ?
> I expect this is reproducible on any BIOS/MBR system where grub-common is
> installed,
> including legacy-mode virtual machines and older physical hardware, whenever
> update-grub is run.
No, it doe not happen on any of my physical or virtual
(virt-manager/QEMU) BIOS systems. The menu entry is skipped as expected.
> The script /etc/grub.d/30_uefi-firmware contains a check for $grub_platform
> being "efi",
This check should be false on non-EFI systems, so the 30_uefi-firmware
stanza should not have any effect.
> however this is a GRUB environment variable evaluated at boot
> time, not at config-generation time.
As intended.
> The fix is straightforward — add an OS-level guard as the first line of
> /etc/grub.d/30_uefi-firmware:
>
> [ -d /sys/firmware/efi ] || exit 0
>
> This check is evaluated when grub-mkconfig runs, which is the correct
> moment.
Many systems can boot either in EFI or legacy mode depending on
UEFI/BIOS settings or boot source selection. A portable system may be
configured to be able to boot in both modes. Or the normal system may
boot in one mode but the user may boot a rescue system from removable
media in another mode by mistake and regenerate grub.cfg from there. So
it is better to generate the same grub.cfg which behaves differently at
boot time depending on the boot mode. memtest86+ does the same.
More information about the Pkg-grub-devel
mailing list