Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 413979 - =sys-fs/lvm2-2.02.95-r1[lvm2create_initrd] fails to setup $LVM variable properly in initrd
Summary: =sys-fs/lvm2-2.02.95-r1[lvm2create_initrd] fails to setup $LVM variable prope...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2012-04-29 11:48 UTC by roltel
Modified: 2022-10-27 18:13 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---

Screenshot of issue (Screen shot 2012-08-30 at 6.58.43 AM.png,21.14 KB, image/png)
2012-08-29 21:01 UTC, Walter

Note You need to log in before you can comment on or make changes to this bug.
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
    $LVM vgchange --ignorelockingfailure -a y

$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:

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
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
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.