LVM initrd fails to activate btrfs multidevice root

Bug #1848180 reported by Gabriele Tozzi
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have two lvm volumes (/dev/mapper/raid-btrfs and /dev/mapper/fast-btrfs) in two different volume groups. I have created a btrfs (raid1) filesystem on top of them and that's my root filesystem.

If i define it by UUID in the root= kernel argument, i just hit bug #1574333. Forcing my root to "/dev/mapper/fast-btrfs" by defining GRUB_DEVICE in /etc/default/grub works around that bug.

The problem now is that initrd is only activating the device given as root= argument, leaving the other inactive; consequently the btrfs mount fails to find its second device and the system fails to boot giving up at initramfs prompt.

Manually adding a line to activate also 2nd device at the bottom of /usr/share/initramfs-tools/scripts/local-top/lvm2 and rebuilding the initramfs works around this issue too, but i suppose my mods will be washed away by next package upgrade.

Here is the result:
> activate "$ROOT"
> activate "$resume"
> activate "/dev/mapper/raid-btrfs"

Proposed solution:
I understand this is an uncommon setup and correctly handling multidevice LVM roots is complicated, please just add a configuration option to manually define/append the list of volume groups to be activated at initrd time.

description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lvm2 (Ubuntu):
status: New → Confirmed
Revision history for this message
rivode (bugs-launchpad-net-rivode) wrote :

I have a similar setup, but LVM is wrapped in LUKS as well. When I was dropped to the initramfs shell during boot (after entering the LUKS passphrase), I think this was how I got the system to start:

 /sbin/lvm vgchange -a y
 mount -o subvol=root /dev/mapper/(one-of-the-root-volumes) /root
 exit

I can confirm next time I restart.

Revision history for this message
Steve Dodd (anarchetic) wrote :

I'm seeing this on focal as well. Running vgchange when the initramfs crashes to shell no longer seems to work - it just hangs. I have to add break=mount to kernel command line and do it there. Now working on hacking something into /etc/initramfs-tools/scripts/local-top/ - @Gabriele, that should allow you to make your changes permanent.

Revision history for this message
Steve Dodd (anarchetic) wrote :

OK, attached are some initramfs scripts:

local-top.hook -> /etc/initramfs-tools/hooks/btrfs-lvm
local-top.script -> /etc/initramfs-tools/scripts/local-top/btrfs-lvm

I've tried to make them reasonably generic, the root fs is examined on initramfs creation, component btrfs devices extracted and tested to see if they are LVM LVs, and if so added to a config file inside them initramfs. Then on boot all those LVs are activated before attempting to mount root.

Revision history for this message
Steve Dodd (anarchetic) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.