Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 413979

Summary: =sys-fs/lvm2-2.02.95-r1[lvm2create_initrd] fails to setup $LVM variable properly in initrd
Product: Gentoo Linux Reporter: roltel <roland.schnabel>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED OBSOLETE    
Severity: normal CC: agk, cardoe, mgorny, robbat2, walter
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Screenshot of issue

Description roltel 2012-04-29 11:48:44 UTC
lvm2create_initrd is setting up an initrd file, which initializes LVM partitions This has become mandatory starting from udev-182 if your / or /usr parition is located a LVM partition. 

In exactly that case, if you try to create an initrd file with lvm2create_initrd, your boot process will hang during initrd initialization of LVM2 partitions. Problem is that /sbin/init on the initrd has not been properly created by lvm2create_initrd. /sbin/init uses shell variable $LVM which has not been initialized.

/sbin/init, line 84:
# run a shell if we're passed lvm2rescue on commandline
grep lvm2rescue /proc/cmdline 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
    $LVM vgchange --ignorelockingfailure -P -a y
    do_shell
else
    $LVM vgchange --ignorelockingfailure -a y
fi

$LVM is not initialised anywhere, so the command executed is "vgchange --ignorelockingfailure ...". If you are using lvm.static, vgchange cannot be found and the commands fail. Using a statically linked lvm command (lvm.static), $LVM should be set to:
LVM="/sbin/lvm.static"

The commands executed will then be "/sbin/lvm.static vgchange ...", which will work fine.


Reproducible: Always

Steps to Reproduce:
1. Setup LVM2 with your /usr filesystem on a separate LVM partition (use flags +static +static-libs +udev).
2. Upgrade to udev-182 and notice the portage warning after installation ("... Your system has /usr on a separate partition. This means you will need to use an initramfs to pre-mount /usr before udev runs ...").
3. Create and install initrd file by using lvm2create_initrd (s. section lvm2create_initrd on http://www.gentoo-wiki.info/HOWTO_Install_Gentoo_on_an_LVM2_root_partition)
4. Reboot your machine.
 
Actual Results:  
The boot process will stop within the initrd boot process and drop to a busybox prompt, telling you that it cannot find the command "vgchange".

Expected Results:  
Booting succeeds. /sbin/init on the initrd file detects and premounts all LVM2 partitions before udev starts.
Comment 1 Walter 2012-08-29 21:01:12 UTC
Created attachment 322521 [details]
Screenshot of issue

I seem to have hit the same issue while attempting to set up root on LVM. Screenshot attached.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-17 23:44:45 UTC
agk:
this one is suited for upstream
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2022-10-27 18:13:44 UTC
lvm2create_initrd is no longer shipped.