Bug#854326: For Linux OS in btrfs subvolume, boot failure from menu entry made by /etc/grub.d/os-prober script

dg1727 dg1727 at protonmail.com
Mon Feb 6 01:34:52 UTC 2017


Package: grub-common
Version: 2.02~beta2-22+deb8u1

Steps to reproduce:
-------------

1. Hard drive (EFI mode) has Btrfs "/" partitions of two Debian-derived Linux OSes:
/dev/sda2 Xubuntu 13.04 with GRUB package version 2.00-13ubuntu3
- Hereinafter, "Ubuntu" refers to this _specific_ install and *NOT* to Ubuntu OSes generally.
/dev/sda3 Linux Mint Debian Edition 2 "Betsy" with GRUB package version as noted in "Version" pseudo-header of this bug report (from Debian Jessie)
- Hereinafter known as "LMDE".
The Ubuntu install is in subvolume "@" of the Btrfs filesystem. I believe this partition was installed by a vendor who sells a lot of Linux PCs, and/or using subvolume "@" was recommended at one time as a best practice (although I wasn't able to find it on the Web recently), so a high percentage of Btrfs users is likely to be using subvolume "@" like this.

2. Run "update-grub" in LMDE.

3. Reboot the PC and select Ubuntu option from GRUB menu.

4. GRUB is unable to boot Linux, and halts with an error message that's something like the following:

Unable to find /boot/vmlinuz-3.blah.blah
alloc magic is broken at 0xXXXXXXXX (0xXXXXXXXX).
Aborted. Press any key

If I alter the folders in the EFI system partition so that Ubuntu's .efi file (instead of LMDE's) is the one that boots, then the Ubuntu-generated GRUB menu can successfully boot either Ubuntu or LMDE.

Comments on possible fix:
-------------
In /boot/grub/grub.cfg in the 2 OS installs, I compared the section that boots Ubuntu. The Ubuntu grub.cfg (section made by the /etc/grub.d/linux script) contains 3 things that are missing from the LMDE grub.cfg (section made by the /etc/grub.d/os-prober script):

* The filename parameter to the "linux" and "initrd" commands has a /@ prefix (i.e., it looks like /@/boot/vmlinuz...)
* After the "root=" partition spec, there is "rootflags=subvol=@"
* Finally, there are kernel command-line parameters (e.g., "quiet splash") - not relevant to the boot failure, but probably should still be fixed.

Manually updating LMDE's grub.cfg with these differences causes Ubuntu to boot successfully when the LMDE-generated "Ubuntu" GRUB menu option is chosen. I know that grub.cfg isn't normally supposed to be updated manually; I did this for troubleshooting only.

I stated the Ubuntu GRUB package version only to document that the /etc/grub.d/linux script in that GRUB version seems to have correct logic that maybe can be ported to /etc/grub.d/os-prober in the current GRUB version. Specifically, there appears to be a function called "make_system_path_relative_to_its_root" which seems to detect that /boot/vmlinuz is really at /@/boot/vmlinuz.

Thanks in advance for reviewing this.

-dg1727
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20170205/68c86d14/attachment.html>


More information about the Pkg-grub-devel mailing list