Mar 052007

Sponsored Link

Problem domain:

I have started to use LVM(2) and converted my system on lvm2 devices. I have noticed that I need to use initrd in order to boot up because all of my partitions were using lvm except /boot. I had 2 versions of debian-netsint on CD. I could boot up with them and with some debian kernel (2.6.8-2)installed from deb, but not the kernel I have complied (2.6.20). I got a kernel panic: missing root device and init: dev/console was missing.

Path to solve:

I realized that I have to try to use udev. I tried to create my initrd with mkinitrd. It was quite flexible with transfering files to my initrd, but it turns to be a dead end.

I have realized that one of the cause was devfs have been removed from the kernel around version 2.6.13-17. Thanks Linus it was a great idea to drop it this point from the 2.6 tree. I have thought that the stable tree is not a playground.

I have switched to mkinitramfs. It looks a bit complicated for the first look. It took some time to hook on. My first advice is use the break option, so it will stop after init-premount level and execute a shell.

Needed things to boot from an LVM root:

  1. Having required kernel features loaded from modules.
  2. Having those disk devices created holding the lvm volumes to boot on
  3. Having and running vgchange -ay

My way:




This is my hook script:


#!/bin/sh -e


prereqs() { echo "$PREREQS"; }

case "$1″ in
exit 0

. /usr/share/initramfs-tools/hook-functions

copy_exec /lib/lvm-default/lvm /sbin/


case $1 in
# get pre-requisites
exit 0

# Do the work here.

mkdir /dev/mapper
/bin/mknod /dev/hda1 b 3 1
/bin/mknod /dev/hda2 b 3 2
/sbin/lvm vgchange -ay

# Handle an error:
Well, my hook script transfers the actual running lvm to initrd and the script: my_lvm makes the rest of the work.

Have fun! I hope I could save some headaches with this cookbook.

Sponsored Link

  • undefined

    don’t know why the manual customization is necessary as i recently switched from yaird to mkinitramfs on a “root on lvm2 over software raid” 2.6.15 and 2.6.18 etch setup, but without any problems.

    (i switched to mkinitramfs as it appears to be the most mature, the ubuntu/debian default, and the long(er)-term solution.)

    the default works but i later customized the configuration to deactivate unnecessary scripts and modules that were being ran/loaded at boot, but that didn’t require anything more than editing config files and removing/renaming scripts.

    i definitely didn’t have to create nor edit any scripts.

  • phoenixlpr

    I have updated my sid before. It was not working. I’ve put a 2.6.18-4-686 kernel up from deb(debian-testing-i386-netinst.iso) and it still was not working.

    After all I have started to digg into the initrds. I prefer initramfs-tools, its more flexible.

    I’ve installed from the same netinst disk(2.6.18-4-686) to my HP laptop. It was not booting again. :(.