View previous topic :: View next topic |
Author |
Message |
SaintGreg n00b
Joined: 13 Mar 2007 Posts: 4
|
Posted: Tue Mar 13, 2007 5:27 am Post subject: lvm2 on root, kernel panic [SOLVED] |
|
|
After following this guide: http://gentoo-wiki.com/HOWTO_Install_Gentoo_on_an_LVM2_root_partition#The_Second_Easiest_Way
I have everything setup, built the kernel, and then the initrd with the lvm2create_initrd script, but the following error occurs when I boot the kernel:
Code: | ...
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 340k freed
/bin/bash: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
|
Any suggestions on what is causing this? I am inclined to believe that it has something to do with the initrd image, since thats the only part of the installation I've never had to do before, but I don't know how to proceed. I am on x86_64 compiling 2.6.19-gentoo-r5 if it helps.
Last edited by SaintGreg on Wed Mar 14, 2007 10:26 pm; edited 1 time in total |
|
Back to top |
|
|
mojo n00b
Joined: 21 Nov 2002 Posts: 47 Location: Heidelberg, Germany
|
Posted: Tue Mar 13, 2007 6:36 pm Post subject: |
|
|
It seems to me that your initrd image is missing /lib/libncurses.so.5.
Copy this file from your /lib directory into your intrd /lib directory.
To make sure you have every library any program in your initrd /bin directory is linked to, run
Code: |
ldd /bin/name_of_program_in_intrd
|
You can ignore the linux-gate.so.1 but put any other library in the initrd /lib directory when it isn't already there. |
|
Back to top |
|
|
SaintGreg n00b
Joined: 13 Mar 2007 Posts: 4
|
Posted: Tue Mar 13, 2007 7:27 pm Post subject: |
|
|
Thanks for the reply.
I have mounted the initrd like so:
Code: | # gunzip /boot/initrd.gz
# mount -o loop /boot/initrd /mnt/mnt0 |
I have verified that libncurses.so.5 is in the initrd like so:
Code: | # ls /mnt/mnt0/lib
libc.so.6 libcrypt.so.1 libdl.so.2 libm.so.6 libncurses.so.5 |
so it is in the /lib directory of the initrd. Following your suggestion i did:
Code: | # ldd /mnt/mnt0/bin/* | grep -B 1 libncurses
/mnt/mnt0/bin/bash:
libncurses.so.5 => /lib/libncurses.so.5 (0x00002b1447273000) |
so only bash depends on libncurses, but since I have the object in my initrd's /lib shouldn't it be getting loaded?
One last thing I tried was to open up the initrd's init script:
Code: | # vi /mnt/mnt0/sbin/init |
One line that confused me was:
Code: | PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin" |
Thinking that maybe PATH needed to include /lib I tried changing that to:
Code: | PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin:/initrd/lib:/lib" |
but still no luck booting, I keep getting the same error as before. |
|
Back to top |
|
|
mojo n00b
Joined: 21 Nov 2002 Posts: 47 Location: Heidelberg, Germany
|
Posted: Tue Mar 13, 2007 7:47 pm Post subject: |
|
|
The /lib directories should be placed in
Code: |
LDPATH=/usr/lib:/lib:/lib/lvm-200
|
not in PATH= |
|
Back to top |
|
|
SaintGreg n00b
Joined: 13 Mar 2007 Posts: 4
|
Posted: Tue Mar 13, 2007 9:39 pm Post subject: |
|
|
I tried adding the LDPATH to the init script but it still shows the same error message. Here is the full init if you can spot anything wrong with it:
Code: | #!/bin/bash
# include in the path some dirs from the real root filesystem
# for chroot, blockdev
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin"
LDPATH="/lib:/initrd/lib:/usr/lib:/lib/lvm-200"
PRE="initrd:"
do_shell(){
/bin/echo
/bin/echo "*** Entering LVM2 rescue shell. Exit shell to continue booting. ***"
/bin/echo
/bin/bash
}
echo "$PRE Remounting / read/write"
mount -t ext2 -o remount,rw /dev/ram0 /
# We need /proc for device mapper
echo "$PRE Mounting /proc"
mount -t proc none /proc
# plug in modules listed in /etc/modules
if [ -f /etc/modules ]; then
echo -n "$PRE plugging in kernel modules:"
cat /etc/modules |
while read module; do
echo -n " $module"
modprobe $module
done
echo '.'
fi
# start raid devices if raid_autostart file exists
if [ -f /etc/raid_autostart ]; then
if [ ! -f /etc/mdadm/mdadm.conf ]; then
mdoptions='--super-minor=dev'
fi
cat /etc/raid_autostart|
while read dev; do
echo "Starting RAID device $dev"
/sbin/mdadm --assemble $dev $mdoptions
done
fi
# Create the /dev/mapper/control device for the ioctl
# interface using the major and minor numbers that have been allocated
# dynamically.
echo -n "$PRE Finding device mapper major and minor numbers "
MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
MINOR=$(sed -n 's/^ *\([0-9]\+\) \+device-mapper$/\1/p' /proc/misc)
if test -n "$MAJOR" -a -n "$MINOR" ; then
mkdir -p -m 755 /dev/mapper
mknod -m 600 /dev/mapper/control c $MAJOR $MINOR
fi
echo "($MAJOR,$MINOR)"
# Device-Mapper dynamically allocates all device numbers. This means it is possible
# that the root volume specified to LILO or Grub may have a different number when the
# initrd runs than when the system was last running. In order to make sure the
# correct volume is mounted as root, the init script must determine what the
# desired root volume name is by getting the LVM2 root volume name from the kernel command line. In order for
# this to work correctly, "lvm2root=/dev/Volume_Group_Name/Root_Volume_Name" needs to be passed
# to the kernel command line (where Root_Volume_Name is replaced by your actual
# root volume's name.
for arg in `cat /proc/cmdline`; do
echo $arg | grep '^lvm2root=' > /dev/null
if [ $? -eq 0 ]; then
rootvol=${arg#lvm2root=}
break
fi
done
echo "$PRE Activating LVM2 volumes"
# 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
echo "$PRE Mounting root filesystem $rootvol ro"
mkdir /rootvol
if ! mount -t auto -o ro $rootvol /rootvol; then
echo "\t*FAILED*";
do_shell
fi
echo "$PRE Umounting /proc"
umount /proc
echo "$PRE Changing roots"
cd /rootvol
if ! pivot_root . initrd ; then
echo "\t*FAILED*"
do_shell
fi
echo "$PRE Proceeding with boot..."
exec chroot . /bin/sh -c "umount /initrd; blockdev --flushbufs /dev/ram0 ; exec /sbin/init $*" < dev/console > dev/console 2>&1
|
|
|
Back to top |
|
|
mojo n00b
Joined: 21 Nov 2002 Posts: 47 Location: Heidelberg, Germany
|
Posted: Tue Mar 13, 2007 10:56 pm Post subject: |
|
|
The only idea I can come up with, is that /lib/libncurses.so.5 is only a symbolic link?
But if I read the script you used correctly it is not likely possible.
Oh and when bash doesn't find libncurses.so.5 the script doesn't get executed |
|
Back to top |
|
|
marcoy n00b
Joined: 25 Dec 2003 Posts: 2 Location: Victoria, Canada
|
Posted: Wed Mar 14, 2007 6:36 pm Post subject: |
|
|
I have exactly the same problem. I tried to loopback mount the initrd image, and libncurses.so.5 was, indeed, a shared library not a symlink.
If anyone has any ideas how to resolve this problem, please let me know. |
|
Back to top |
|
|
SaintGreg n00b
Joined: 13 Mar 2007 Posts: 4
|
Posted: Wed Mar 14, 2007 7:56 pm Post subject: |
|
|
I bit the bullet and created a new initrd from scratch, this time compiling bash, busybox, and lvm statically (described here). It boots and loads sbin/init this time at least. lvm fails to find the physical volumes though.... Inching closer to victory one step at a time. At least I can get into a shell on the initrd and poke around...
marcoy - try doing what they say and creating a new root directory for static emerges, and then compile bash statically and put that in the initrd image instead of the dynamically linked version. Verify that the executable is statically linked by using ldd on it.
EDIT: success!
-lvm issue i *think* was due to emerging with CC="gcc -static". Little did I know, emerge lvm creates a static executable anyways.
-ran into another issue that was solved by editing the init script - for some reason it was mounting the root filesystem readonly, not readwrite.
Next step: do the same thing with a xen dom0 kernel!
Last edited by SaintGreg on Thu Mar 15, 2007 3:15 am; edited 2 times in total |
|
Back to top |
|
|
marcoy n00b
Joined: 25 Dec 2003 Posts: 2 Location: Victoria, Canada
|
Posted: Wed Mar 14, 2007 10:20 pm Post subject: |
|
|
SaintGreg wrote: | marcoy - try doing what they say and creating a new root directory for static emerges, and then compile bash statically and put that in the initrd image instead of the dynamically linked version. Verify that the executable is statically linked by using ldd on it. |
Thanks for the tip, SaintGreg. I ended up compiling bash, busybox, and util-linux (pivot_root) statically then running the lvm2create_initrd script to make the disk image. Everything seems to be working great now |
|
Back to top |
|
|
|