Gentoo emerge world's new udev, lvm2 and rootvol

So one day, I was doing an

  • emerge -Datuv world

and I noticed that udev and lvm2 where being blocked by device-mapper. This is due to libdevice-mapper.so being included in the new version of lvm2.

Well, this causes a problem on reboot if you're using lvm2 on your root volume (/). This outlines what I did to fix it.

  • Resolve your blocked packages by emerge -C package
  • Edit your initrd-lvm2.img.gz

If you don't have this, Try this: http://www.redhat.com/archives/linux-lvm/2004-February/msg00230.html - or you can search on (lvm2 gentoo root) on Google.

  • Copy your new version of lvm2 to your initrd.

I used the dynamically linked binary. You could use the static one. To use the dynamic linked binary, just "ldd" on lvm2 and then copy every library that it references to your initrd. To test: "chroot" into your initrd when it's mounted, and do a "/lib/ld-linux --list binary" where binary is the file you want to test. If you don't get a "not found" in the listing, then you're all good.

  • Add sysfs (/sys) support to your initrd

In your init script, right under /proc commands, you have to add support for sysfs mounted on /sys. Make sure you umount /sys, before your initrd hands off control to pivot_root. This is probably due to the new lvm2. You didn't have to used to do this.

  • Edit your fstab

Edit your fstab and change all /dev/VGNAME/LV names to /dev/mapper/VGNAME-LV - example: /dev/vg0/root -> /dev/mapper/vg0-root.

The reason for this, is that the device symlinks of /dev/VGNAME/* are created by udev now. So once you boot past the initrd, those symlinks aren't created yet as udev hasn't been loaded yet. So, you have to use the real /dev/mapper/VGNAME-* nodes.

  • Edit grub.conf

Don't forget to edit your realroot= entry in grub.conf! It has to be in the same format as above: /dev/mapper/VGNAME-LV

Also, if your initrd is anything like mine, you can use it as a rescue disk as well (small one) - just remember to add USBHID support TO the KERNEL, as the newer kernels disable compatibility USB input mode. It maybe PAE mode on my work machine, but it completely caught me by surprise.

Recent comments