Bug#1020777: grub-pc: Package upgrade fails grub-install when boot disk is not /dev/sda
Jeremy Maes
jeremy.maes at sentia.com
Mon Sep 26 15:44:37 BST 2022
Package: grub-pc
Version: 2.06-3~deb11u2
Severity: important
Dear Maintainer,
As a system does not always boot with the same disk order for its /dev/sdX naming scheme,
sometimes the disk containing the boot partition is not /dev/sda but /dev/sdb (or other
if there are more than 2 disks).
We notice that the upgrade from e.g. grub-pc 2.04-20 to 2.06-3~deb11u1
or 2.06-3~deb11u2 fails when the system boots with e.g. /dev/sdb containing
the boot partition. For some reason it tries to run grub-install on /dev/sda
instead of /dev/sdb, which obviously fails as /dev/sda is the wrong disk.
Errors seen at that point:
* In interactive whiptail window:
"GRUB failed to install to the following devices: /dev/sda."
You get an option to "Continue, Yes or No". When choosing "No" you
can select the correct disk to install to and it continues.
* Text output on the commandline:
Setting up grub-pc (2.06-3~deb11u1) ...
Installing for i386-pc platform.
grub-install: error: unable to identify a filesystem in hostdisk//dev/sda; safety check can't be performed.
While one can manually work around the issue by doing a manual update
and telling grub which disk to use, we expect it to find this correctly
during the package post-install phase. But as we manage hundreds of
Debian 11 servers this would be a very tedious process.
Missing a failed grub-pc package upgrade could render systems unbootable.
Running a command like "grub-probe -t drive /boot/grub" before the
upgrade do show the correct disk.
If the system was booted with /dev/sda as the main disk containing the
boot partition, the upgrade runs smoothly.
So in short:
* Upgrading grub-pc to 2.06-3~deb11u1 or 2.06-3~deb11u2 triggers the issue
when system is booted with boot partition not on /dev/sda
* A manual workaround is possible, but automatic upgrades fail or
hang due to this issue
* grub-pc upgrade hangs and waits for manual intervention. Without
manual intervention this leads to an unbootable system.
* I expect the grub-pc post-install script to correctly detect and
use the correct disk for grub-install, regardless of the disk
naming order after boot.
To reproduce:
* Run Debian 11 with an older grub version (e.g. 2.04-20) and at
least 2 disks.
* Reboot the VM until /dev/sdb is the disk containing the boot
partition
* Upgrade to grub-pc 2.06-3
Kind regards,
Jeremy
-- Package-specific info:
*********************** BEGIN /proc/mounts
/dev/mapper/vg00-root / ext4 rw,relatime,errors=remount-ro 0 0
/dev/sdb1 /boot ext4 rw,relatime 0 0
*********************** END /proc/mounts
*********************** 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 lvm
insmod ext2
set root='lvmid/B2f0tR-92oR-LhtW-kVRS-65Fe-gbxB-2biwmu/N2r3qh-zlaE-EQe9-WcBr-c6k8-tcJQ-1SHXEa'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='lvmid/B2f0tR-92oR-LhtW-kVRS-65Fe-gbxB-2biwmu/N2r3qh-zlaE-EQe9-WcBr-c6k8-tcJQ-1SHXEa' d0a31752-2777-48f4-ac55-f583d6274b88
else
search --no-floppy --fs-uuid --set=root d0a31752-2777-48f4-ac55-f583d6274b88
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
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 ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-16-amd64 ...'
linux /vmlinuz-5.10.0-16-amd64 root=/dev/mapper/vg00-root ro debian-installer=en_US.UTF-8 quiet quiet
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-16-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-d0a31752-2777-48f4-ac55-f583d6274b88' {
menuentry 'Debian GNU/Linux, with Linux 5.10.0-16-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-16-amd64-advanced-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-16-amd64 ...'
linux /vmlinuz-5.10.0-16-amd64 root=/dev/mapper/vg00-root ro debian-installer=en_US.UTF-8 quiet quiet
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-16-amd64
}
menuentry 'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-16-amd64-recovery-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-16-amd64 ...'
linux /vmlinuz-5.10.0-16-amd64 root=/dev/mapper/vg00-root ro single debian-installer=en_US.UTF-8
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-16-amd64
}
menuentry 'Debian GNU/Linux, with Linux 5.10.0-9-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-9-amd64-advanced-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-9-amd64 ...'
linux /vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg00-root ro debian-installer=en_US.UTF-8 quiet quiet
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-9-amd64
}
menuentry 'Debian GNU/Linux, with Linux 5.10.0-9-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-9-amd64-recovery-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-9-amd64 ...'
linux /vmlinuz-5.10.0-9-amd64 root=/dev/mapper/vg00-root ro single debian-installer=en_US.UTF-8
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-9-amd64
}
menuentry 'Debian GNU/Linux, with Linux 5.10.0-8-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-8-amd64-advanced-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-8-amd64 ...'
linux /vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg00-root ro debian-installer=en_US.UTF-8 quiet quiet
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-8-amd64
}
menuentry 'Debian GNU/Linux, with Linux 5.10.0-8-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-8-amd64-recovery-d0a31752-2777-48f4-ac55-f583d6274b88' {
load_video
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 038538c7-e68a-409a-99fc-23064ef7c437
else
search --no-floppy --fs-uuid --set=root 038538c7-e68a-409a-99fc-23064ef7c437
fi
echo 'Loading Linux 5.10.0-8-amd64 ...'
linux /vmlinuz-5.10.0-8-amd64 root=/dev/mapper/vg00-root ro single debian-installer=en_US.UTF-8
echo 'Loading initial ramdisk ...'
initrd /initrd.img-5.10.0-8-amd64
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### 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/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.
### 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 LVM
--- Volume group ---
VG Name vg00
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <9.76 GiB
PE Size 4.00 MiB
Total PE 2498
Alloc PE / Size 2498 / <9.76 GiB
Free PE / Size 0 / 0
VG UUID B2f0tR-92oR-LhtW-kVRS-65Fe-gbxB-2biwmu
--- Physical volume ---
PV Name /dev/sdb2
VG Name vg00
PV Size 9.76 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2498
Free PE 0
Allocated PE 2498
PV UUID RTWvR7-Q33o-tIVn-pzqS-EOj6-EwHF-mY4m3T
--- Logical volume ---
LV Path /dev/vg00/swap_1
LV Name swap_1
VG Name vg00
LV UUID VqpgYS-8zn1-ilGy-tzwU-c4UX-Jthx-wgKT2T
LV Write Access read/write
LV Creation host, time debian, 2021-11-01 05:39:43 +0100
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:0
--- Logical volume ---
LV Path /dev/vg00/root
LV Name root
VG Name vg00
LV UUID N2r3qh-zlaE-EQe9-WcBr-c6k8-tcJQ-1SHXEa
LV Write Access read/write
LV Creation host, time debian, 2021-11-01 05:39:43 +0100
LV Status available
# open 1
LV Size <7.76 GiB
Current LE 1986
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:1
*********************** END LVM
*********************** BEGIN /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 10 Sep 26 14:33 dm-name-vg00-root -> ../../dm-1
lrwxrwxrwx 1 root root 10 Sep 26 14:33 dm-name-vg00-swap_1 -> ../../dm-0
lrwxrwxrwx 1 root root 10 Sep 26 14:33 dm-uuid-LVM-B2f0tR92oRLhtWkVRS65FegbxB2biwmuN2r3qhzlaEEQe9WcBrc6k8tcJQ1SHXEa -> ../../dm-1
lrwxrwxrwx 1 root root 10 Sep 26 14:33 dm-uuid-LVM-B2f0tR92oRLhtWkVRS65FegbxB2biwmuVqpgYS8zn1ilGytzwUc4UXJthxwgKT2T -> ../../dm-0
lrwxrwxrwx 1 root root 10 Sep 26 14:33 lvm-pv-uuid-RTWvR7-Q33o-tIVn-pzqS-EOj6-EwHF-mY4m3T -> ../../sdb2
*********************** END /dev/disk/by-id
*********************** BEGIN /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 Sep 26 14:33 038538c7-e68a-409a-99fc-23064ef7c437 -> ../../sdb1
lrwxrwxrwx 1 root root 10 Sep 26 14:33 c8ad1c9c-7aaa-4c17-8ec9-a6c7ce81a185 -> ../../dm-0
lrwxrwxrwx 1 root root 10 Sep 26 14:33 d0a31752-2777-48f4-ac55-f583d6274b88 -> ../../dm-1
*********************** END /dev/disk/by-uuid
-- System Information:
Debian Release: 11.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-16-amd64 (SMP w/2 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
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.77
ii grub-common 2.04-20
ii grub-pc-bin 2.04-20
ii grub2-common 2.04-20
ii ucf 3.0043
grub-pc recommends no packages.
grub-pc suggests no packages.
-- debconf information:
grub-pc/install_devices_disks_changed:
grub-pc/mixed_legacy_and_grub2: true
* grub2/linux_cmdline: debian-installer=en_US.UTF-8
grub2/update_nvram: true
grub-pc/kopt_extracted: false
grub-pc/disk_description:
grub-pc/partition_description:
grub2/kfreebsd_cmdline_default: quiet
grub-pc/hidden_timeout: false
grub-pc/install_devices_failed_upgrade: true
grub2/kfreebsd_cmdline:
grub-pc/install_devices_empty: false
grub-pc/timeout: 5
grub-pc/postrm_purge_boot_grub: false
grub2/force_efi_extra_removable: false
* grub-pc/install_devices: /dev/sda
* grub2/linux_cmdline_default: quiet quiet
grub-pc/install_devices_failed: false
grub-pc/chainload_from_menu.lst: true
More information about the Pkg-grub-devel
mailing list