# [solved]LVM in busybox not detecting logical volumes at boot

## wobblytickle

Hi all, don't know how I've got into the following situation but I'm at a loss to explain what I've done to busybox/genkernel to get the following behaviour. The problem sounds similar to this but may not be the same.

Short story:

Building a new kernel with genkernel (using a previous .config that works) to boot off LVM on top of software raid now can't find the root device. Dropping into busybox and the builtin lvm can't find any logical volumes. lvm.static copied from the filesystem to boot can see the volumes and can activate them, then exiting the shell and re-entering the root path and voila.

Long story:

Just upgraded my system after being on holiday for a couple of weeks trying to go from gentoo-sources.2.6.30-r1 to r4, as well as a bunch of other upgrades (ones of which I guess could be genkernel or lvm or busybox etc). On the reboot the thing couldn't find the root device. Dropping into busybox and poking around the lvm there couldn't find anything: pvscan finds no devices, vgscan finds no volume groups, nada, nothing. So I reboot into a previous working 2.6.28-gentoo-r1 and userspace is all fine. I copy over my lvm.static onto /boot (straight ext3 on a raid-1 metadevice) and reboot. The system now boots if I do the following in busybox. For the full output including boot stuff see the picture here but the relevant busybox bits are:

```

mkdir /boot

mount /dev/md1 /boot

rm /bin/lvm

ln -s /boot/lvm.static /bin/lvm

mkdir /lvm              # this needs to be done otherwise the static lvm complains about the directory not existing

lvm vgscan             # finds my two volume groups

lvm vgchange -ay 1000g_pair          # activates the pair where my rootv is

umount /boot

exit

```

And the system will now boot.

LVM/software RAID support is in the new kernel otherwise it wouldn't work like this. There's nothing wrong with the userspace either as the previous kernel works, so I must have done something to genkernel/busybox. So I re-emerged lvm, busybox and genkernel but to no avail.

I build the kernels like this:

```

genkernel --menuconfig --no-clean --oldconfig --splash=verbose,theme=Linux --install --symlink --lvm --mdadm --dmraid all

```

My genkernel looks like this (without comments):

```

OLDCONFIG="yes"

MENUCONFIG="yes"

CLEAN="yes"

MRPROPER="yes"

MOUNTBOOT="yes"

SAVE_CONFIG="yes"

USECOLOR="yes"

DMRAID="yes"

BUSYBOX="yes"

GK_SHARE="/usr/share/genkernel"

CACHE_DIR="/var/cache/genkernel"

DISTDIR="${CACHE_DIR}/src"

LOGFILE="/var/log/genkernel.log"

LOGLEVEL=1

DEFAULT_KERNEL_SOURCE="/usr/src/linux"

BUSYBOX_VER="1.7.4"

BUSYBOX_SRCTAR="${DISTDIR}/busybox-${BUSYBOX_VER}.tar.bz2"

BUSYBOX_DIR="busybox-${BUSYBOX_VER}"

BUSYBOX_BINCACHE="%%CACHE%%/busybox-${BUSYBOX_VER}-%%ARCH%%.tar.bz2"

DEVICE_MAPPER_VER="1.02.22"

DEVICE_MAPPER_DIR="device-mapper.${DEVICE_MAPPER_VER}"

DEVICE_MAPPER_SRCTAR="${DISTDIR}/device-mapper.${DEVICE_MAPPER_VER}.tgz"

DEVICE_MAPPER_BINCACHE="%%CACHE%%/device-mapper-${DEVICE_MAPPER_VER}-%%ARCH%%.tar.bz2"

LVM_VER="2.02.28"

LVM_DIR="LVM2.${LVM_VER}"

LVM_SRCTAR="${DISTDIR}/LVM2.${LVM_VER}.tgz"

LVM_BINCACHE="%%CACHE%%/LVM2.${LVM_VER}-%%ARCH%%.tar.bz2"

DMRAID_VER="1.0.0.rc14"

DMRAID_DIR="dmraid/${DMRAID_VER}"

DMRAID_SRCTAR="${DISTDIR}/dmraid-${DMRAID_VER}.tar.bz2"

DMRAID_BINCACHE="%%CACHE%%/dmraid-${DMRAID_VER}-%%ARCH%%.tar.bz2"

E2FSPROGS_VER="1.40.9"

E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"

E2FSPROGS_SRCTAR="${DISTDIR}/e2fsprogs-${E2FSPROGS_VER}.tar.gz"

BLKID_BINCACHE="%%CACHE%%/blkid-${E2FSPROGS_VER}-%%ARCH%%.bz2"

FUSE_VER="2.7.4"

FUSE_DIR="fuse-${FUSE_VER}"

FUSE_SRCTAR="${DISTDIR}/fuse-${FUSE_VER}.tar.gz"

FUSE_BINCACHE="%%CACHE%%/fuse-${FUSE_VER}-%%ARCH%%.tar.bz2"

UNIONFS_FUSE_VER="0.22"

UNIONFS_FUSE_DIR="unionfs-fuse-${UNIONFS_FUSE_VER}"

UNIONFS_FUSE_SRCTAR="${DISTDIR}/unionfs-fuse-${UNIONFS_FUSE_VER}.tar.bz2"

UNIONFS_FUSE_BINCACHE="%%CACHE%%/unionfs-fuse-${UNIONFS_FUSE_VER}-%%ARCH%%.bz2"

```

The relevant grub.conf entries look like:

```

title=2.6.30-gentoo-r4

root (hd0,1)

kernel /kernel-genkernel-x86_64-2.6.30-gentoo-r4 root=/dev/ram0 real_root=/dev/1000g_pair/rootv domdadm dolvm vga=791 splash=silent,theme:Linux console=tty1

initrd /initramfs-genkernel-x86_64-2.6.30-gentoo-r4

title=2.6.28-gentoo-r1

root (hd0,1)

kernel /kernel-genkernel-x86_64-2.6.28-gentoo-r1 root=/dev/ram0 real_root=/dev/1000g_pair/rootv domdadm dolvm vga=791 splash=silent,theme:Linux console=tty1

initrd /initramfs-genkernel-x86_64-2.6.28-gentoo-r1

```

Any idea why the busybox lvm can't see the volume groups on the PVs? even explicitly telling the thing where they are returns an error about it not being able to find them. It's all very odd...

[edit]

With the release of genkernel-3.4.10.906 the problem went away; emerged that, rebuilt the kernel and lo it boots again.

----------

