--- LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd.orig	2006-11-21 22:41:56.000000000 +0000
+++ LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd	2009-12-26 01:47:08.025224602 +0000
@@ -54,7 +54,9 @@
 DEVRAM=/tmp/initrd.$$
 
 # set defaults
-BINFILES=${BINFILES:-"`which lvm` `which bash` `which busybox` `which pivot_root`"}
+LVM=`which lvm.static`
+LVM=${LVM:-"`which lvm`"}
+BINFILES=${BINFILES:-"${LVM} `which bash` `which busybox` `which pivot_root`"}
 BASICDEVICES=${BASICDEVICES:-"std consoleonly fd"}
 BLOCKDEVICES=${BLOCKDEVICES:-"md hda hdb hdc hdd sda sdb sdc sdd"}
 MAKEDEV=${MAKEDEV:-"debian"}
@@ -119,6 +121,10 @@
 echo "$PRE Mounting /proc"
 mount -t proc none /proc
 
+# We need /sys for lvm
+echo "$PRE Mounting /sys"
+mount -t sysfs sysfs /sys
+
 # plug in modules listed in /etc/modules
 if [ -f /etc/modules ]; then
     echo -n "$PRE plugging in kernel modules:"
@@ -179,26 +185,29 @@
 # 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 -P -a y
     do_shell
 else
-    lvm vgchange --ignorelockingfailure -a y
+    $LVM vgchange --ignorelockingfailure -a y
 fi
 
 echo "$PRE Mounting root filesystem $rootvol ro"
 mkdir /rootvol
 if ! mount -t auto -o ro $rootvol /rootvol; then
-	echo "\t*FAILED*";
+	echo "\t*FAILED TRYING TO MOUNT ROOTVOL*";
 	do_shell
 fi
 
 echo "$PRE Umounting /proc"
 umount /proc
 
+echo "$PRE Umounting /sys"
+umount /sys
+
 echo "$PRE Changing roots"
 cd /rootvol
 if ! pivot_root . initrd ; then
-	echo "\t*FAILED*"
+	echo "\t*FAILED PIVOT TO NEW ROOT*"
 	do_shell
 fi
 
@@ -356,7 +365,7 @@
 fi
 
 verbose "creating basic set of directories in $TMPMNT"
-(cd $TMPMNT; mkdir bin dev etc lib proc sbin var)
+(cd $TMPMNT; mkdir bin dev etc lib proc sbin sys var)
 if [ $? -ne 0 ]; then
    echo "$cmd -- ERROR creating directories in $TMPMNT"
    cleanup 1
@@ -499,4 +508,3 @@
 FINALTXT
 
 cleanup 0
-
