Suppose you have multiple kernels installed on your Linux system and your GRUB menu looks something like this:

Debian GNU/Linux, kernel 2.6.26-deb-ws - Kernel 0
Debian GNU/Linux, kernel 2.6.26-deb-ws (single-user mode) - Kernel 1
Debian GNU/Linux, kernel 2.6.26-1-amd64 - Kernel 2
Debian GNU/Linux, kernel 2.6.26-1-amd64 (single-user mode) - Kernel 3
Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-686 - Kernel 4
Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-686 (single-user mode) - Kernel 5

Now whenever you restart your machine, by default the first kernel (Kernel 0) – Debian GNU/Linux, kernel 2.6.26-deb-ws – will boot after the default 5 seconds timeout.

Now what if you would like to boot from the third kernel (Kernel 2) instead – Debian GNU/Linux, kernel 2.6.26-1-amd64 – every time you restart your machine without manually selecting this kernel? To do this simply edit the file:

# nano /boot/grub/menu.lst
and set the parameter “default” like this in the beginning of the file where the following text is :

# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        2

Note that the GRUB counts the kernel listed from “zero” and not “one” and therefore we specify “2” to boot from the third listed kernel.

Similarly you can set:

default        5

to boot from the last kernel (Kenrel 5) – Debian GNU/Linux, kernel 2.6.24-etchnhalf.1-686 (single-user mode)

Happy Grub’ing

Be Sociable, Share!