# kernel not booting, grub2 masking error?

## mathfeel

It only started doing this as I got up this morning. At boot, after picking the kernel to boot from grub2's boot menu I get a screen print out

```
Loading Linux 3.1.2-gentoo

Loading initial ramdisk
```

then no activity except for blinking light, which suggests a kernel panic. But no information is printed to console.

I am using a initramfs to boot because my have an LVM2 root. and the init script is very simple:

```
#!/bin/sh

NEWROOT=/newroot

mount -t proc proc /proc

mount -t sysfs sysfs /sys

CMDLINE=`cat /proc/cmdline`

sleep3

vgchange --sysinit -a y

mount -r /dev/VG/ROOT ${NEWROOT}

umount /sys

umount /proc

exec /bin/busybox switch root ${NEWROOT} /sbin/init ${CMDLINE}

```

and it was working last night. I did ran an emerge --update world in the last successful boot, but I remember only very few packages got updated and nothing vital.

So it seems my kernel failed to boot, but grub2 is not letting me see any message from it and why it tailed. Help.

EDIT: using kvm i finally manage to see the kernel panic in console. Turns out vgchange spits out three lines of "volume group not found" and did not activate the logical volume. This is strange because using an ubuntu liveCD i can activate the volumes and chroot into gentoo...

----------

## NeddySeagoon

mathfeel, 

Get dropped into a busybox shell when the initrd breaks.  Pick some pieces from the following:-

```
#!/bin/sh

rescue_shell() {

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

    busybox --install -s

    exec /bin/sh

}

mount -t proc none /proc

CMDLINE=`cat /proc/cmdline`

mount -t sysfs none /sys

#wait a little to avoid trailing kernel output

sleep 3

#If you don't have a qwerty keyboard, uncomment the next line 

#loadkmap < /etc/kmap-fr

# raid - we dont really need to assemble boot but we are no longer using autodetect

/bin/mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 || rescue_shell

# must assemble md1 as root is on lvm there and its ver 1.2 metadata

/bin/mdadm --assemble /dev/md1 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2 /dev/sde2 || rescue_shell

# virtual machine space

/bin/mdadm --assemble /dev/md2 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3 /dev/sde3 || rescue_shell

#If you have a msg, show it: 

#cat /etc/msg

#dm-crypt

# /bin/cryptsetup luksOpen /dev/md2 vault

#lvm

#/bin/vgscan

# start the hosts lvm

/bin/vgchange -ay host || rescue_shell

# start the VM lvm too

/bin/vgchange -ay vm || rescue_shell

#root filesystem

mount -r /dev/mapper/host-root /newroot || rescue_shell

#unmount pseudo FS

umount /sys

umount /proc

#root switch

exec /bin/busybox switch_root /newroot /sbin/init ${CMDLINE}
```

Its not my work, I've collected bit and pieces fro several places on the internet.  If something goes wrong in the initrd, can at least find out what, fix it and continue the boot.

----------

## mathfeel

Found out what happen. Took me a while to figure out that commenting out the

```
load_video

set gfxpayload=keep
```

lines in grub2 commands list allow kernel's verbose output to console be shown.

Once I got that shown, turned out, it's just that vgchang -ay, for some reason, does not make the /dev/vg/root symbolic link any more, but only /dev/mapper/vg-root. So the mount line failed. And I did have it fall to a rescue_shell, but thanks to grub2's gfx mode, the prompt was hidden from me.

Simple fixes.

I noticed that both our init scripts have a line for sleeping for 3 second. Why is that there to add an extra 3 second boot time? The comment seems to just to avoid the init script's output be drown out by floor from the kernel.

----------

## NeddySeagoon

mathfeel,

Thats all the 3 sec delay is for.  I don't know why I bother.  The box that uses that init script is up 24/7 and headless.

----------

