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.
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.
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".
Booting succeeds. /sbin/init on the initrd file detects and premounts all LVM2 partitions before udev starts.
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.
this one is suited for upstream
lvm2create_initrd is no longer shipped.