# boot fails "can't open /dev/md0" with initramfs -- SOLVED

## Moriah

I am upgrading my web/email server.  It is an old box.  It was a used machine in 2005 when I bought it.  It runs a Duron at about 1.6 GHz with 1 GB of ram and a pair of 500 GB ide drives in a raid-1.  It boots from either raid drive.  There are 2 raids on it: a small /dev/md0 as a /boot, and a large /dev/md1 with lvm for the rest of the system.  the lvm has a swap and a root filesystem logical device on it.  It has run this way for years.

Now I am trying to get gentoo-sources 2.6.31-r6 working on it.  I am using the initramfs built into the kernel approach.  When I boot it, I get:

```

raidautorun: can't open '/dev/md0' : No such device or address

raidautorun: can't open '/dev/md1' : No such device or address

```

This is followed by an attempt to start lvm, then a kernel panic.

Here is my init file from the initramfs:

```

#!/bin/busybox sh

rescue_shell() {

    echo "Something went wrong. Dropping you to a shell."

    busybox --install -s

    exec /bin/sh

}

# Mounting /proc 

mount -t proc none /proc

echo starting raid arrays

raidautorun /dev/md0

raidautorun /dev/md1

#mdadm -A /dev/md0 /dev/hda1 /dev/hde1

#mdadm -A /dev/md1 /dev/hda2 /dev/hde2

echo mounting /sys

mount -t sysfs none /sys

#echo doing luksOpen

#cryptsetup luksOpen /dev/sda cryptoroot

echo creating devices

echo /sbin/mdev > /proc/sys/kernel/hotplug

mdev -s

echo doing vgscan

lvm vgscan --mknodes

echo doing vgchange

lvm vgchange -a y

echo mounting root

mount /dev/mirror/rootfs /mnt/root

#echo "starting emergency rescue shell..."

#rescue_shell

echo unmounting /proc and /sys

umount /proc

umount /sys

echo doing the pivot root

exec switch_root /mnt/root /sbin/init

# if we get here, it means trouble!  :-(

echo "starting emergency rescue shell..."

rescue_shell

```

I have /dev/md0 and /dev/md1 in the initramfs dev directory, and they have the same major and minor numbers as they do in the real /dev directory.

I am tired of trying every possible permutation and combination of things trying to get this to work.  Does anybody have a clue what I am doing wrong?

PS  The old kernel was 2.6.15-r1 and it used the separate initrd file running redhat nash.  Here is the old linuxrc file:

```

#!/bin/nash

echo Mounting /proc filesystem

mount -t proc /proc /proc

raidautorun /dev/md0

raidautorun /dev/md1

echo Creating block devices

mkdevices /dev

echo Creating root device

mkrootdev /dev/root

echo 0x0100 > /proc/sys/kernel/real-root-dev

echo "Making Device Mapper Nodes."

devmap_mknod.sh

echo "Scanning for volume groups."

lvm vgscan

lvm vgchange -ay 

echo Mounting root filesystem

mount -o noatime --rw -t reiserfs /dev/mapper/mirror-rootfs /sysroot

mkdir -p /sysroot/initrd

pivot_root /sysroot /sysroot/initrd

exec chroot . bin/bash -c 'umount initrd/proc ; umount initrd ; blockdev --flushbufs /dev/ram0 ; sleep 10 ; exec /sbin/init' < dev/console > dev/console 2>&1

```

Here is the grub.conf file:

```

default 0

timeout 10

splashimage=(hd0,0)/grub/splash.xpm.gz

# 0

title=Gentoo Linux 2.6.15-gentoo-r1_raid1_lvm

root (hd0,0)

kernel /kernel-2.6.15-gentoo-r1_raid1_lvm ramdisk=8192 root=/dev/mirror/rootfs udev

initrd /initrd_lvm-2.6.15-gentoo-r1_raid1_lvm

# 1

title 2.6.31-gentoo-r6

root (hd0,0)

kernel /kernel-2.6.31-gentoo-r6

```

I have been manually selecting configuration # 1, but I really should change the grub.conf to do this automatically, as after the recent udev updates, the old kernel will no longer work.

Thanks for any help!    :Very Happy: 

----------

## Moriah

 :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed: 

Oops!  This is what happens when you try to do this stuff at 2:00 AM.    :Evil or Very Mad: 

I somehow had forgotten to enable RAID in my kernel config.    :Embarassed:   :Embarassed:   :Embarassed: 

Then after the RAID would come up, I had an lvm image in sbin from another architecture, and it ws being found before the correct lvm image in bin.  Both were static, but the wrong one was not executable on this Duron.

So after fixing both of those foopah's the box boots!    :Very Happy: 

----------

