bugGNU GRUB - Bugs: bug #45709, Grub git master makes bad grub.cfg...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #45709: Grub git master makes bad grub.cfg with btrfs raid of lvm volumes

Submitted by:  James Harvey <jamespharvey20>
Submitted on:  Thu 06 Aug 2015 09:41:05 PM UTC  
 
Category: NoneSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: James Harvey
Open/Closed: ClosedRelease: 
Release: Git masterReproducibility: Every Time
Planned Release: None

(Jump to the original submission Jump to the original submission)

Mon 01 Feb 2016 05:18:21 PM UTC, comment #7:

Should be fixed in 7290bb5623cd8d9b50b756d0ea40eb6a269985e7. Reopen if needed. Thank you!

Andrei Borzenkov <arvidjaar>
Project Member
Fri 07 Aug 2015 11:55:21 PM UTC, comment #6:

util/grub-probe.c:268 is:
device_names = grub_guess_root_devices (grub_path);
that function exists at grub-core/osdep/unix/getroot.c:492 which is around where I'm thinking needs to get updated.

I'll stop here for now, rather than start trying to put together a patch.

Let me know if running anything for you helps.

Here are the commands I used to set everything up as I did:

pvcreate /dev/sda2
pvcreate /dev/sdb2
pvcreate /dev/sdc2
vgcreate disk1 /dev/sda2
vgcreate disk2 /dev/sdb2
vgcreate disk3 /dev/sdc2
lvcreate disk1 -L 100G -n terra1
lvcreate disk2 -L 100G -n terra2
lvcreate disk3 -L 100G -n terra3
mkfs.btrfs -m raid1 -d raid1 /dev/disk1/terra1 /dev/disk2/terra2 /dev/disk3/terra3

Then, with the way btrfs raid works, you just mount /dev/disk1/terra1 like it's a standalone non-raid device, and the btrfs internals pick up the other devices.

James Harvey <jamespharvey20>
Fri 07 Aug 2015 11:38:51 PM UTC, comment #5:

In short, it's all grub-probe's fault for outputting 3 /dev/mapper results on a btrfs raid, when all you need is one of them.

James Harvey <jamespharvey20>
Fri 07 Aug 2015 11:37:33 PM UTC, comment #4:

Not a distribution specific bug. Made a pure upstream git master build.

After grub-mkconfig -o /boot/grub/grub.cfg still includes:
=====
### BEGIN /etc/grub.d/10_linux ###
...
insmod part_gpt
insmod part_gpt
insmod part_gpt
insmod lvm
insmod lvm
insmod lvm
set root='lvmid/VSnSKT-mFjn-H3fD-xC1o-eyCG-3a5S-rgNQy3/thnod1-e6Gy-O5Gl-8t6h-6zGv-zPjV-jG1
lvmid/4fRRgD-yA28-KKou-f2Uj-RhFP-nFBd-K7ysCV/DoXOeq-5RM2-OdZI-5Tt3-C41n-ROYj-eAT0bp
lvmid/uwsOsc-fegJ-RM3r-qASe-Ix0w-MiVx-BNqmeS/xie7dX-aAXH-Iet7-O8Bl-2sxU-82Am-hifghT'
...
echo 'Loading Linux linux ...'
linux /original/boot/vmlinuz-linux root=/dev/mapper/disk1-terra1
/dev/mapper/disk2-terra2
/dev/mapper/disk3-terra3 ro rootflags=subvol=original
echo 'Loading initial ramdisk ...'
...
=====

/usr/bin/grub-mkconfig:261 executes /etc/grub.d/10_linux
/etc/grub.d/10_linux:125 executes: prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
/usr/bin/grub-mkconfig:139 set: GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
and # grub-prove --target=device /boot
/dev/mapper/disk1-terra1
/dev/mapper/disk2-terra2
/dev/mapper/disk3-terra3
{{{ where all it needs is the first one due to the way btrfs raids work - you just specify one of the devices }}}
/usr/share/grub/grub-mkconfig_lib:132 then causes the triplicate insmod part_gpt via "grub-probe --device /dev/mapper/disk1-terra1 /dev/mapper/disk2-terra2 /dev/mapper/disk3-terra3 --target=partmap"
:139 then causes the triplicate insmod lvm via "grub-probe --device /dev/mapper/disk1-terra1 /dev/mapper/disk2-terra2 /dev/mapper/disk3-terra3 --target=abstraction"
:144 only makes a single insmod btrfs via "grub-probe --device /dev/mapper/disk1-terra1 /dev/mapper/disk2-terra2 /dev/mapper/disk3-terra3 --target=fs"
{{{ grub-probe knows to output one unique line here, where the two before it outputs three triplicate lines }}}
:157 then causes the set root='lvmid/VSnSKT-mFjn-H3fD-xC1o-eyCG-3a5S-rgNQy3/thnod1-e6Gy-O5Gl-8t6h-6zGv-zPjV-jG1kUK
lvmid/4fRRgD-yA28-KKou-f2Uj-RhFP-nFBd-K7ysCV/DoXOeq-5RM2-OdZI-5Tt3-C41n-ROYj-eAT0bp
lvmid/uwsOsc-fegJ-RM3r-qASe-Ix0w-MiVx-BNqmeS/xie7dX-aAXH-Iet7-O8Bl-2sxU-82Am-hifghT'
... via "grub-probe --device /dev/mapper/disk1-terra1 /dev/mapper/disk2-terra2 /dev/mapper/disk3-terra3 --target=compatibility_hint"
/etc/grub.d/10_linux:134 executes: linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
... with :189 setting linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
... with :49 setting: LINUX_ROOT_DEVICE=${GRUB_DEVICE}
which is set by /usr/bin/grub-mkconfig:135 as `${grub_probe} --target=device /`"
... which outputs 3 lines just as it did with /boot
causing newlines in the kernel parameter line, preventing boot

James Harvey <jamespharvey20>
Fri 07 Aug 2015 12:27:44 PM UTC, comment #3:

Sorry, I did not notice that bug was closed. Not sure why, I reopen this; multidevice btrfs definitely is not fixed.

Regarding "set root" - correct, I do not see where we emit this line.

Andrei Borzenkov <arvidjaar>
Project Member
Fri 07 Aug 2015 04:00:05 AM UTC, comment #2:

If I understand your comment correctly, you're just saying upstream grub doesn't cause the "set root" part of my bug report, and that issue needed to be reported to my distro.

I don't read your comment to mean the other part of my bug report, the first part, doesn't happen in upstream -- that grub-mkconfig gets and uses 3 separate lines from /usr/bin/grub-probe.

Am I reading your comment wrong?

The whole bug report is closed as invalid/duplicate.

I'd love clarification, and hopefully tomorrow I can double check this by making a purely upstream build.

James Harvey <jamespharvey20>
Fri 07 Aug 2015 03:34:48 AM UTC, comment #1:

http://savannah.gnu.org/bugs/?39591

For "set root" part upstream grub does not emit this, so this needs to be reported to your distro.

Andrei Borzenkov <arvidjaar>
Project Member
Thu 06 Aug 2015 09:41:05 PM UTC, original submission:

grub 2.02.beta2 (-5 Arch, using git tag grub-2.02-beta2" works fine. git master produces this bug. git master, even with patch 45163.patch which I hoped would fix this (at http://savannah.gnu.org/bugs/?45163) still causes this bug.

grub-mkconfig runs "/usr/bin/grub-probe --target=device /boot", which outputs:

=====
/dev/mapper/disk1-terra1
/dev/mapper/disk2-terra2
/dev/mapper/disk3-terra3
=====

On my system with a btrfs raid1 made up of 3 logical volumes from LVM. This causes /boot/grub/grub.cfg to contain:

=====
...
echo 'Loading Linux linux ...'
linux /original/boot/vmlinuz-linux root=/dev/mapper/disk1-terra1
/dev/mapper/disk2-terra2
/dev/mapper/disk3-terra3 rw rootflags=subvol=original consoleblank=0 init=/usr/lib/systemd/systemd fbcon=scrollback:128k
echo 'Loading initial ramdisk ...'
...
=====

Which causes a boot failure, as it the kernel line is spread out across 3 separate lines, and contains two mapper volumes it doesn't need due to the way btrfs raid works.

/boot/grub/grub.cfg also has:

=====
set root='lvmid/VSnSKT-mFjn-H3fD-xC1o-eyCG-3a5S-rgNQy3/thnod1-e6Gy-O5Gl-8t6h-6zGv-zPjV-jG1kUK
lvmid/4fRRgD-yA28-KKou-f2Uj-RhFP-nFBd-K7ysCV/DoXOeq-5RM2-OdZI-5Tt3-C41n-ROYj-eAT0bp
lvmid/uwsOsc-fegJ-RM3r-qASe-Ix0w-MiVx-BNqmeS/xie7dX-aAXH-Iet7-O8Bl-2sxU-82Am-hifghT'
=====

/boot/grub/grub.cfg also includes 3 "insmod part_gpt" and 3 "insmod lvm" which probably doesn't matter that it's duplicated, but would be nice to be fixed.

James Harvey <jamespharvey20>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arvidjaar (Posted a comment)
  • -unavailable- added by jamespharvey20 (Submitted the item)
  • -unavailable- added by jamespharvey20
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 01 Feb 2016 05:18:21 PM UTCarvidjaarStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 07 Aug 2015 12:27:44 PM UTCarvidjaarStatusDuplicate=>None
      Open/ClosedClosed=>Open
    Fri 07 Aug 2015 03:34:48 AM UTCarvidjaarStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Thu 06 Aug 2015 09:41:05 PM UTCjamespharvey20Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1