Bug#1103709: grub-pc: Failure to boot missing Windows disk may corrupt MBR
Pascal Hambourg
pascal at plouf.fr.eu.org
Mon Apr 21 09:01:05 BST 2025
On 20/04/2025 at 23:03, Richard Allen wrote:
>
> What led up to the situation? I've setup two operating system disks. Windows 10
> is on the primary boot disk with its own bootloader(HD0 below).
> Debian12+Grub2.06 is on another disk which I select from the BIOS(HD1 below).
> Once a baremetal OS is booted, I boot the other disk under VirtualBox.
>
> What exactly did you do (or not do) that was effective (or ineffective)? I
> attempted to boot my Grub2.06+Debian/12 disk inside of VirtualBox on Windows
> 10. However, I looked away and grub timed out and chose Windows10(whose disk is
> not visible in the VM)
>
> What was the outcome of this action? Grub reported:
> error: no such device: ${Win10_DISK_ID}
UUID search fails as expected, $root remains hd0,msdos1 (Debian partition).
> setting partition type to 0x83
parttool ($root) hidden- sets the partition type to 0x83 (Linux
filesystem, same as previously, so no change).
It is the only command which writes to the MBR. I acknowledge that GRUB
should be smart and not rewrite the MBR if there is no change.
> error:disk `hd0,msdos1’ not found
GRUB does not see the partition any more.
> I have attached the MBRs of both disks, before and after this point.
It appears that the contents of hd1_debian.after was shifted by one
byte, which makes it totally unrecogizable by the BIOS, fdisk or any
other tool. This is really surprising. I could not reproduce it in a
QEMU+SeaBIOS virtual machine. Could it be a bug with VirtualBox ?
A possible workaround is to remove the parttool command in
/etc/grub.d/30_os-prober and rebuild grub.cfg with update-grub. This
command is not needed here, use cases which require it are very rare
nowadays.
> *********************** BEGIN /boot/grub/grub.cfg
(...)
> menuentry 'Windows 10 (on /dev/sdc1)' --class windows --class os $menuentry_id_option 'osprober-chain-7460727360723BC4' {
> insmod part_msdos
> insmod ntfs
> set root='hd0,msdos1'
> if [ x$feature_platform_search_hint = xy ]; then
> search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1 --hint='hd0,msdos1' 7460727360723BC4
> else
> search --no-floppy --fs-uuid --set=root 7460727360723BC4
> fi
> parttool ${root} hidden-
> drivemap -s (hd0) ${root}
> chainloader +1
> }
More information about the Pkg-grub-devel
mailing list