Bug#1078656: grub-pc: please use 'grub-install --disk-module=native /dev/sdX'

Pascal Hambourg pascal at plouf.fr.eu.org
Tue Aug 13 23:08:28 BST 2024


On 13/08/2024 at 22:02, Martin-Éric Racine wrote:
> 
> I've been trying to implement a chainloader (see below at
> /etc/grub.d/40_custom) to boot off external USB disks as needed.
> Finding external disks requires using GRUB's 'nativedisk'

Only with flawed BIOS which cannot boot from USB or do not expose all 
drives. I observed that some BIOS expose only a USB drive when booting 
from it, but others expose all USB drives regardless of the boot device.

> but once that has been executed, the rest of the script cannot be
> completed because Debian's grub-install enforces BIOS device names
> (hd0,msdos1) instead of bus names (ata0,msdos1).

I doubt this is the reason why your custom menu entry fails. See my 
comments below.

> Further investigating this suggests that if Debian used 'grub-install
> --disk-module=native /dev/sdX' to install GRUB, this would work as
> expected.

Native disk drivers do not work properly on all machines, so they cannot 
be enabled by default for a rare use case.

> menuentry "USB chainloader" {
> 	insmod part_msdos
> 	insmod ext2
> 	insmod fat
> 	insmod iso9660

Why do you load these modules ? Chainloading a disk boot sector does not 
require to read any partition table nor filesystem.
Instead you should load the "chain" module which provides the 
"chainloader" command.

> 	nativedisk
>	set root='ata0,msdos1'
> 	chainloader (usb0)+1
> }

Why do you set $root to an internal disk partition if you intend to 
chainload a USB drive ? Did you mean to set $prefix so that GRUB can 
find its directory and modules after switching to native disk drivers ?



More information about the Pkg-grub-devel mailing list