#1061168 grub-common: update-grub2 breaks root= directive when / is a BTRFS raid1 on LVM with other LVs using raidintegrity

Package:
grub-common
Source:
grub-common
Description:
GRand Unified Bootloader (common files)
Submitter:
Patrick Plenefisch
Date:
2025-04-03 18:51:02 UTC
Severity:
normal
Tags:
#1061168#5
Date:
2024-01-20 05:43:52 UTC
From:
To:
If you have an LVM setup with a VG that contains a raidintegrity=y volume, and
two other volumes that form a BTRFS raid1 filesystem, and the BTRFS filesystem
is the root filesystem, then update-grub2 will generate grub.cfg with:

linux [...] root=/dev/lvm/btrfs1
/dev/lvm/btrfs2 [..]

instead of:
linux [...] root=/dev/lvm/btrfs1 [..]

or
linux [...] root=UUID=[...] [..]

Note: that is a newline in the configuration file, so the config file is broken

When doing this, update-grub2 will spit out several errors about unknown nodes
(listing the raidintegrity volumes) and disks (the id's for the first LV in the
VG)

To create a LVM system that fails in this way, first assemble a VG called
myGrubBreakingVG with two PVs in it. Then run:
lvcreate -L 128MiB -n theRaidVol --mirrors 1 --type raid1 --raidintegrity y
myGrubBreakingVG
lvcreate -L 5GiB -n btrfsSideA myGrubBreakingVG
lvcreate -L 5GiB -n btrfsSideB myGrubBreakingVG
mkfs.btrfs -m raid1 -d raid1 /dev/myGrubBreakingVG/btrfsSideA
/dev/myGrubBreakingVG/btrfsSideB

Then you can mount the btrfs volumes, and debootstrap a system into it, chroot,
and inside that chroot update grub will fail as described

#1061168#10
Date:
2024-01-20 05:49:44 UTC
From:
To:
I should also mention that the grub configuration isn't really the system I
tested this on, though it is mounted in /srv/chroot/mebsuta

That system is Debian 12

#1061168#15
Date:
2024-08-14 00:53:50 UTC
From:
To:
An update that I have created a patch at
https://github.com/byteit101/grub2/tree/grub-lvmintegrity

#1061168#20
Date:
2025-04-03 18:43:25 UTC
From:
To:
tag 1061168 fixed-upstream

As of 2025-03-05 and git revision
ff7f5530713c203c90a7dea2b7c56d403673548b this bug is fixed in the
upstream grub git repository.
Patrick