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

Mate Kukri mate.kukri at canonical.com
Wed Aug 14 08:16:42 BST 2024


Finding external USB disks does not in fact require "nativedisk".

GRUB can boot off USB disks if the firmware supports booting off USB
disks, which I suspect isn't the case on your machine.

GRUB's nativedisk driver is designed for use cases such as "GRUB as a
coreboot payload" where firmware disk drivers are simply not
available.

It shouldn't be used with traditional firmware as it was never widely
deployed in such a manner and may have compatibility issues, and such
definitely not be the default in Debian.

You are always able to enable them as a workaround on your incompatible machine.

On Tue, Aug 13, 2024 at 9:06 PM Martin-Éric Racine
<martin-eric.racine at iki.fi> wrote:
>
> Package: grub-pc
> Version: 2.06-13+deb12u1
> Severity: normal
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> 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', 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). Further investigating this suggests that if Debian used 'grub-install --disk-module=native /dev/sdX' to install GRUB, this would work as expected.
>
> Alternately, if there's any /etc/default/grub variable I can set to accomplish this, it would suit me just as well.
>
> Thanks!
> Martin-Éric
>
> - -- Package-specific info:
>
> *********************** BEGIN /proc/mounts
> /dev/sda1 / ext4 rw,relatime,errors=remount-ro 0 0
> *********************** END /proc/mounts
>
> *********************** BEGIN /boot/grub/device.map
> (hd0)   /dev/disk/by-id/ata-ST320011A_3HT48T7R
> *********************** END /boot/grub/device.map
>
> *********************** BEGIN /boot/grub/grub.cfg
> #
> # DO NOT EDIT THIS FILE
> #
> # It is automatically generated by grub-mkconfig using templates
> # from /etc/grub.d and settings from /etc/default/grub
> #
>
> ### BEGIN /etc/grub.d/00_header ###
> if [ -s $prefix/grubenv ]; then
>   set have_grubenv=true
>   load_env
> fi
> if [ "${next_entry}" ] ; then
>    set default="${next_entry}"
>    set next_entry=
>    save_env next_entry
>    set boot_once=true
> else
>    set default="0"
> fi
>
> if [ x"${feature_menuentry_id}" = xy ]; then
>   menuentry_id_option="--id"
> else
>   menuentry_id_option=""
> fi
>
> export menuentry_id_option
>
> if [ "${prev_saved_entry}" ]; then
>   set saved_entry="${prev_saved_entry}"
>   save_env saved_entry
>   set prev_saved_entry=
>   save_env prev_saved_entry
>   set boot_once=true
> fi
>
> function savedefault {
>   if [ -z "${boot_once}" ]; then
>     saved_entry="${chosen}"
>     save_env saved_entry
>   fi
> }
> function load_video {
>   if [ x$feature_all_video_module = xy ]; then
>     insmod all_video
>   else
>     insmod efi_gop
>     insmod efi_uga
>     insmod ieee1275_fb
>     insmod vbe
>     insmod vga
>     insmod video_bochs
>     insmod video_cirrus
>   fi
> }
>
> if [ x$feature_default_font_path = xy ] ; then
>    font=unicode
> else
> insmod part_msdos
> insmod ext2
> set root='hd0,msdos1'
> if [ x$feature_platform_search_hint = xy ]; then
>   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
> else
>   search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
> fi
>     font="/usr/share/grub/unicode.pf2"
> fi
>
> if loadfont $font ; then
>   set gfxmode=640x480
>   load_video
>   insmod gfxterm
>   set locale_dir=$prefix/locale
>   set lang=fi_FI
>   insmod gettext
> fi
> terminal_output gfxterm
> if [ "${recordfail}" = 1 ] ; then
>   set timeout=30
> else
>   if [ x$feature_timeout_style = xy ] ; then
>     set timeout_style=menu
>     set timeout=5
>   # Fallback normal timeout code in case the timeout_style feature is
>   # unavailable.
>   else
>     set timeout=5
>   fi
> fi
> ### END /etc/grub.d/00_header ###
>
> ### BEGIN /etc/grub.d/05_debian_theme ###
> insmod part_msdos
> insmod ext2
> set root='hd0,msdos1'
> if [ x$feature_platform_search_hint = xy ]; then
>   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
> else
>   search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
> fi
> insmod png
> if background_image /usr/share/desktop-base/emerald-theme/grub/grub-4x3.png; then
>   set color_normal=white/black
>   set color_highlight=black/white
> else
>   set menu_color_normal=white/black
>   set menu_color_highlight=black/light-gray
> fi
> ### END /etc/grub.d/05_debian_theme ###
>
> ### BEGIN /etc/grub.d/10_linux ###
> function gfxmode {
>         set gfxpayload="${1}"
> }
> set linux_gfx_mode=keep
> export linux_gfx_mode
> menuentry 'Debian GNU/Linux, with Linux 6.1.0-23-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-23-686-pae-advanced-cc540c15-0f8a-4933-88de-5516da7b3414' {
>         load_video
>         gfxmode $linux_gfx_mode
>         insmod gzio
>         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         echo    'Loading Linux 6.1.0-23-686-pae ...'
>         linux   /boot/vmlinuz-6.1.0-23-686-pae root=UUID=cc540c15-0f8a-4933-88de-5516da7b3414 ro panic=15 noquiet loglevel=4 nosplash
>         echo    'Loading initial ramdisk ...'
>         initrd  /boot/initrd.img-6.1.0-23-686-pae
> }
> menuentry 'Debian GNU/Linux, with Linux 6.1.0-23-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-23-686-pae-recovery-cc540c15-0f8a-4933-88de-5516da7b3414' {
>         load_video
>         gfxmode $linux_gfx_mode
>         insmod gzio
>         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         echo    'Loading Linux 6.1.0-23-686-pae ...'
>         linux   /boot/vmlinuz-6.1.0-23-686-pae root=UUID=cc540c15-0f8a-4933-88de-5516da7b3414 ro single panic=15
>         echo    'Loading initial ramdisk ...'
>         initrd  /boot/initrd.img-6.1.0-23-686-pae
> }
> menuentry 'Debian GNU/Linux, with Linux 6.1.0-22-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-22-686-pae-advanced-cc540c15-0f8a-4933-88de-5516da7b3414' {
>         load_video
>         gfxmode $linux_gfx_mode
>         insmod gzio
>         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         echo    'Loading Linux 6.1.0-22-686-pae ...'
>         linux   /boot/vmlinuz-6.1.0-22-686-pae root=UUID=cc540c15-0f8a-4933-88de-5516da7b3414 ro panic=15 noquiet loglevel=4 nosplash
>         echo    'Loading initial ramdisk ...'
>         initrd  /boot/initrd.img-6.1.0-22-686-pae
> }
> menuentry 'Debian GNU/Linux, with Linux 6.1.0-22-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-22-686-pae-recovery-cc540c15-0f8a-4933-88de-5516da7b3414' {
>         load_video
>         gfxmode $linux_gfx_mode
>         insmod gzio
>         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         echo    'Loading Linux 6.1.0-22-686-pae ...'
>         linux   /boot/vmlinuz-6.1.0-22-686-pae root=UUID=cc540c15-0f8a-4933-88de-5516da7b3414 ro single panic=15
>         echo    'Loading initial ramdisk ...'
>         initrd  /boot/initrd.img-6.1.0-22-686-pae
> }
>
> ### END /etc/grub.d/10_linux ###
>
> ### BEGIN /etc/grub.d/20_ipxe ###
> menuentry "Network boot (iPXE)" --users "" --class network {
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         linux16 /boot/ipxe.lkrn
> }
> ### END /etc/grub.d/20_ipxe ###
>
> ### BEGIN /etc/grub.d/20_linux_xen ###
> ### END /etc/grub.d/20_linux_xen ###
>
> ### BEGIN /etc/grub.d/20_memtest86+ ###
> menuentry "Memory test (memtest86+ia32.bin)" {
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         linux   /boot/memtest86+ia32.bin
> }
> menuentry 'Memory test (memtest86+ia32.bin, serial console)' {
>         insmod part_msdos
>         insmod ext2
>         set root='hd0,msdos1'
>         if [ x$feature_platform_search_hint = xy ]; then
>           search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  cc540c15-0f8a-4933-88de-5516da7b3414
>         else
>           search --no-floppy --fs-uuid --set=root cc540c15-0f8a-4933-88de-5516da7b3414
>         fi
>         linux   /boot/memtest86+ia32.bin console=ttyS0,115200
> }
> ### END /etc/grub.d/20_memtest86+ ###
>
> ### BEGIN /etc/grub.d/30_os-prober ###
> ### END /etc/grub.d/30_os-prober ###
>
> ### BEGIN /etc/grub.d/30_uefi-firmware ###
> ### END /etc/grub.d/30_uefi-firmware ###
>
> ### BEGIN /etc/grub.d/35_fwupd ###
> ### END /etc/grub.d/35_fwupd ###
>
> ### BEGIN /etc/grub.d/40_custom ###
> # This file provides an easy way to add custom menu entries.  Simply type the
> # menu entries you want to add after this comment.  Be careful not to change
> # the 'exec tail' line above.
> # to boot from a USB device
> menuentry "USB chainloader" {
>         insmod part_msdos
>         insmod ext2
>         insmod fat
>         insmod iso9660
>         nativedisk
>         set root='ata0,msdos1'
>         chainloader (usb0)+1
> }
> ### END /etc/grub.d/40_custom ###
>
> ### BEGIN /etc/grub.d/41_custom ###
> if [ -f  ${config_directory}/custom.cfg ]; then
>   source ${config_directory}/custom.cfg
> elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
>   source $prefix/custom.cfg
> fi
> ### END /etc/grub.d/41_custom ###
> *********************** END /boot/grub/grub.cfg
>
> *********************** BEGIN /proc/mdstat
> cat: /proc/mdstat: No such file or directory
> *********************** END /proc/mdstat
>
> *********************** BEGIN /dev/disk/by-id
> total 0
> lrwxrwxrwx 1 root root  9 Aug 13 22:43 ata-Compaq_CRD-8481B -> ../../sr0
> lrwxrwxrwx 1 root root  9 Aug 13 22:47 ata-ST320011A_3HT48T7R -> ../../sda
> lrwxrwxrwx 1 root root 10 Aug 13 22:47 ata-ST320011A_3HT48T7R-part1 -> ../../sda1
> lrwxrwxrwx 1 root root 10 Aug 13 22:47 ata-ST320011A_3HT48T7R-part2 -> ../../sda2
> lrwxrwxrwx 1 root root 10 Aug 13 22:47 ata-ST320011A_3HT48T7R-part5 -> ../../sda5
> lrwxrwxrwx 1 root root  9 Aug 13 22:43 usb-SAMSUNG_SP2514N_10000E000CE66B56-0:0 -> ../../sdb
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 usb-SAMSUNG_SP2514N_10000E000CE66B56-0:0-part1 -> ../../sdb1
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 usb-SAMSUNG_SP2514N_10000E000CE66B56-0:0-part2 -> ../../sdb2
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 usb-SAMSUNG_SP2514N_10000E000CE66B56-0:0-part3 -> ../../sdb3
> *********************** END /dev/disk/by-id
>
> *********************** BEGIN /dev/disk/by-uuid
> total 0
> lrwxrwxrwx 1 root root 10 Aug 13 22:47 0cffc75f-9b88-4375-b6fd-f624db6b5d19 -> ../../sda5
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 561c5eff-f74f-456c-ac71-4259021c1571 -> ../../sdb1
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 863ba051-7b2b-44b3-aa45-88c2bfbe5688 -> ../../sdb3
> lrwxrwxrwx 1 root root 10 Aug 13 22:43 86c9b551-1c6e-4b96-9441-65ff476d25e4 -> ../../sdb2
> lrwxrwxrwx 1 root root 10 Aug 13 22:47 cc540c15-0f8a-4933-88de-5516da7b3414 -> ../../sda1
> *********************** END /dev/disk/by-uuid
>
> - -- System Information:
> Debian Release: 12.6
>   APT prefers stable-updates
>   APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'stable')
> Architecture: i386 (i686)
>
> Kernel: Linux 6.1.0-23-686-pae (SMP w/1 CPU thread; PREEMPT)
> Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8), LANGUAGE=fi:en
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> Versions of packages grub-pc depends on:
> ii  debconf [debconf-2.0]  1.5.82
> ii  grub-common            2.06-13+deb12u1
> ii  grub-pc-bin            2.06-13+deb12u1
> ii  grub2-common           2.06-13+deb12u1
> ii  ucf                    3.0043+nmu1
>
> grub-pc recommends no packages.
>
> grub-pc suggests no packages.
>
> - -- debconf information:
> * grub2/enable_os_prober: false
> * grub2/linux_cmdline: panic=15
>   grub-pc/install_devices_empty: false
> * grub-pc/install_devices: /dev/disk/by-id/ata-ST320011A_3HT48T7R
>   grub2/update_nvram: true
>   grub2/kfreebsd_cmdline_default: quiet
>   grub-pc/mixed_legacy_and_grub2: true
> * grub2/linux_cmdline_default: noquiet loglevel=4 nosplash
>   grub-pc/disk_description:
>   grub-pc/install_devices_failed_upgrade: true
>   grub2/force_efi_extra_removable: false
>   grub2/kfreebsd_cmdline:
>   grub-pc/partition_description:
>   grub-pc/install_devices_disks_changed:
>   grub-pc/kopt_extracted: true
>   grub-pc/hidden_timeout: true
>   grub-pc/install_devices_failed: false
> * grub-pc/chainload_from_menu.lst: true
>   grub2/device_map_regenerated:
>   grub-pc/timeout: 5
>   grub-pc/postrm_purge_boot_grub: false
>
> -----BEGIN PGP SIGNATURE-----
>
> iQIzBAEBCAAdFiEEyJACx3qL7GpObXOQrh+Cd8S017YFAma7u80ACgkQrh+Cd8S0
> 17YHLw//Vfkg9Se04sQbHQf6BuD0uyjmhrtEGG41U2JbyEJjNrPZkjWgMROKGhBD
> n5D429muwzR84ad7Vwsjw6SLSlj8Ok0+NQuqjzhovRL7+o5mtoJ1P+OEsJENV22z
> n+SPXH3dPCicDCmu4ImuvLlGFYhxmchQ7x8KkXITp5N8keoTaFWFqzt+Q6dsanBH
> FFjGFwvelIiFt5ZWngm7TGJoEjt29rm1lKPVyJPckplD4mbSFUWvjSsrlTEu5ilC
> pY5gVgw7Dbtx7u01BB3DW5kMEgf9ZZmC7VSM2GKZXPQLHd2tqTHPtnBjcrln0Ehk
> 1Cg7/ApHrzJfuUyx7PMunFKTZ3LkOKWSFj/vmXiHOsZwF9SXx0hjBykkiaKBuPHc
> 1nW5KkWD2aa8sLyoaPjooMtVHpIpKQhn3IdlD+GtFmvcsXK8R1AejrEkNj4EPzV9
> YKBjhL5wCAcqOiMYvaw+gL7/1S0hjltun6cHTAXRUrl6XriAGiQ6OsrSAQlQfU+8
> aoFpOKZ95S/iBq2b7PpMzOrLkCW0rjkg/SET2ueHH9/pffqQ4OLFm79UckTn3JCi
> kzvLIr3EAf/cRtm/4UoZrqlbALg0uIpFDTmb0svw/Tl8gNcI/eEGACI0Dj8JRqgR
> 4QPGkEiga1XKFF1GEeDX5YTI3vboRBkvZScmE3Vv4n9eRNq/st8=
> =1Q91
> -----END PGP SIGNATURE-----
> _______________________________________________
> Pkg-grub-devel mailing list
> Pkg-grub-devel at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-grub-devel



More information about the Pkg-grub-devel mailing list