How to Boot second kernel if first fails

Reference :  http://www.linux-noob.com/forums/index.php?/topic/2928-grub-single-boot-and-kernel-panic-reboot/

If for example your grub.conf looks like the one i have below. This boots into the 2.6.20-1.2944 by default.

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.20-1.2944.fc6)
        root (hd0,0)
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off
        initrd /initrd-2.6.20-1.2944.fc6.img
title Fedora Core
        root (hd0,0)
        kernel /vmlinuz-2.6.20 ro root=LABEL=/ acpi=off
        initrd /initrd-2.6.20.img

If you want to have it so that 2.6.20 boots on next boot, run the following command from the console before rebooting.
echo “savedefault –default=1 –once” | grub –batch
then
reboot

Now, if you have a kernel that panics and need it to reboot if it panics. change your config and add the panic=# (# being seconds before auto reboot) to the kernel line. Example file below

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.20-1.2944.fc6)
        root (hd0,0)
        kernel /vmlinuz-2.6.20-1.2944.fc6 ro root=LABEL=/ acpi=off panic=5
        initrd /initrd-2.6.20-1.2944.fc6.img
title Fedora Core (2.6.20)
        root (hd0,0)
        kernel /vmlinuz-2.6.20 ro root=LABEL=/ acpi=off panic=5
        initrd /initrd-2.6.20.img

so the order of operations on this are as follows.

1.) Add new kernel to grub.conf
2.) set default=# in grub.conf to the failsafe kernel (the one you want it to try if the other fails)
3.) run the following:
echo “savedefault –default=1 –once” | grub –batch
4.) reboot

Copied from :  http://www.linux-noob.com/forums/index.php?/topic/2928-grub-single-boot-and-kernel-panic-reboot/

About these ads
About

anees

Posted in Issues, linux, Server Setup
2 comments on “How to Boot second kernel if first fails
  1. FluKex says:

    Hahaha, How did my instructions get on this blog :P

    Like

  2. Prashant.. says:

    great.. FluKex let me know your blog..

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats
  • 119,488 hits
Follow

Get every new post delivered to your Inbox.

Join 209 other followers

%d bloggers like this: