Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sudden LVM problem in initrd ("not found") [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Loibisch
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2006
Posts: 89

PostPosted: Sun Nov 08, 2009 3:01 pm    Post subject: Sudden LVM problem in initrd ("not found") [SOLVED Reply with quote

I have been running an lvm2 setup from my initrd for quite a while now. Recently I decided to update the initrd using the script I made to originally create it and voila, the Laptop refused to boot.

The error I#m receiving is plain and simple:
Code:
/init: line 21: vgchange: not found


If I drop to a rescue shell and try to execute vgchange (which is a symlink to the lvm binary, statically compiled of course) I get the same error message "not found". If I try to execute any busybox command or even mdadm/cryptsetup it works just fine. It's just lvm2 that's broken. I'm using the latest version available in portage. (2.02.51-r2).

Here is my init script:
Code:
#!/bin/sh

#mount pseudo filesystems
mount -t proc proc /proc
mount -t sysfs sysfs /sys

CMDLINE=`cat /proc/cmdline`

#sleep 3

#load keyboard map
loadkmap < /etc/kmap-de

#raid
#mdadm --assemble /dev/md2 /dev/sda2 /dev/sdb2

#dm-crypt
#cryptsetup luksOpen /dev/md2 vault

#lvm
vgchange -ay vertex

#try to resume (uswsusp)
resume

#root filesystem
mount -r /dev/mapper/vertex-root /newroot

#restore sanity
umount /proc
umount /sys

#root switch
exec /bin/busybox switch_root /newroot /sbin/init ${CMDLINE}


My mkinitrd script:
Code:
#!/bin/sh

cd /usr/src/initrd
rm -rf image

#create image directory
mkdir -v image
cd image

#create a few directories
mkdir -v bin dev dev/mapper dev/vc etc newroot proc sbin sys
cp -v /bin/busybox /sbin/cryptsetup /sbin/lvm /sbin/mdadm /usr/lib64/suspend/resume bin

#devices
cp -a /dev/console /dev/sda2 /dev/null /dev/urandom /dev/snapshot dev
#cp -a /dev/tty1 /dev/fb0 /dev/dri/card0 dev
cp /etc/suspend.conf etc

#create symlinks
ln -vs busybox bin/cat
ln -vs busybox bin/loadkmap
ln -vs busybox bin/mount
ln -vs busybox bin/sh
ln -vs busybox bin/switch_root
ln -vs busybox bin/umount
ln -vs lvm bin/vgchange
ln -vs ../console dev/vc/0

busybox dumpkmap > etc/kmap-de

cp -v ../init .

echo -n "Generating initrd..."
find . | cpio -o -H newc | gzip -9 > /boot/initramfs.gz


Does anybody have any idea where this is coming from? Using the same scripts I used to boot just fine on this machine. Thanks for any help.


Last edited by Loibisch on Wed Nov 11, 2009 4:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
Loibisch
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2006
Posts: 89

PostPosted: Tue Nov 10, 2009 10:08 am    Post subject: Reply with quote

anyone? :(
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Tue Nov 10, 2009 2:56 pm    Post subject: Reply with quote

there's been recent changes to udev, device-mapper and lvm2.

perhaps you need to re-emerge udev, or rebuild your initrd image with the latest lvm2 binarys?
Back to top
View user's profile Send private message
Loibisch
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2006
Posts: 89

PostPosted: Wed Nov 11, 2009 4:49 pm    Post subject: Reply with quote

Ok, I found the problem. I must have missed this post-upgrade lvm2 message:

Code:
 * Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with
 * their static versions. If you need the static binaries,         
 * you must append .static the filename!                           
[...]


So basically, previously lvm2 compiled with the "static" useflag would put a static binary at "/sbin/lvm".
Newer versions put a dynamic version at "/sbin/lvm" and the static version at "/sbin/lvm.static".

Slight adaptation of the mkinitrd script to use the ".static" versions instead fixed the problem.

Took me a while to figure out that "small change"...
Back to top
View user's profile Send private message
stolar
n00b
n00b


Joined: 15 Sep 2007
Posts: 49
Location: Zgierz, Poland

PostPosted: Thu Dec 03, 2009 12:51 pm    Post subject: Reply with quote

Hello,

Loibisch, could You please describe this 'slight adaptation'?:)

Cheers!
Back to top
View user's profile Send private message
Loibisch
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2006
Posts: 89

PostPosted: Wed Dec 09, 2009 11:44 am    Post subject: Reply with quote

Sorry, didn't check this topic in a while. Here is the adapted mkinitrd script with the changed lines highlighted. Essentially all you need to do is copy the ".static" version of lvm instead:

New mkinitrd:
Quote:
#!/bin/sh

cd /usr/src/initrd
rm -rf image

#create image directory
mkdir -v image
cd image

#create a few directories
mkdir -v bin dev dev/mapper dev/vc etc newroot proc sbin sys
cp -v /bin/busybox /sbin/cryptsetup /sbin/lvm.static /sbin/mdadm /usr/lib64/suspend/resume bin

#devices
cp -a /dev/console /dev/sda2 /dev/null /dev/urandom /dev/snapshot dev
#cp -a /dev/tty1 /dev/fb0 /dev/dri/card0 dev
cp /etc/suspend.conf etc

#create symlinks
ln -vs busybox bin/cat
ln -vs busybox bin/loadkmap
ln -vs busybox bin/mount
ln -vs busybox bin/sh
ln -vs busybox bin/switch_root
ln -vs busybox bin/umount
ln -vs lvm.static bin/vgchange
ln -vs ../console dev/vc/0

busybox dumpkmap > etc/kmap-de

cp -v ../init .

echo -n "Generating initrd..."
find . | cpio -o -H newc | gzip -9 > /boot/initramfs.gz
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum