Edit the default boot in linux grub

The boot of almost all Linux systems is now managed by GRUB, this is a Multiboot boot loader that can be highly customized.

To edit the GRUB we have to edit the file menu.lst that can be reached at the path:

/boot/grub/menu.lst

An example of the menu.lst file is the following:

timeout 10
color black/cyan yellow/cyan
shade 1
viewport 3 2 77 22
splashimage (hd0,4)/boot/grub/mdv-grub_splash.xpm.gz
default 0

title linux
kernel (hd0,4)/boot/vmlinuz root=/dev/hda5  resume=/dev/hda6 splash=silent vga=788
initrd (hd0,4)/boot/initrd.img

title linux-nonfb
kernel (hd0,4)/boot/vmlinuz root=/dev/hda5  resume=/dev/hda6
initrd (hd0,4)/boot/initrd.img

title failsafe
kernel (hd0,4)/boot/vmlinuz root=/dev/hda5  failsafe resume=/dev/hda6
initrd (hd0,4)/boot/initrd.img

title windows
root (hd0,0)
chainloader +1

By analyzing the structure of this file, we note that:

  • the first line, timeout 10, tell us the time in seconds to make the choice of the system to be started before the automatic default system

  • the sixth line, default 0, tells us what is the default system to boot; in the previous example being set the value to 0, the default system is linux

therefore in order to choose which system to automatically start you will have to edit the line default 0 considering the order that the other systems have in the file. In this example, the systems are:

linux, linux-nonfb, failsafe and windows

and considering that in unix systems we begin to count from 0, the order is as follows:

linux = 0

linux - nonfb = 1

failsafe = 2

windows = 3

In conclusion if we want to set the automatic launch of Windows we should change the sixth line of the file menu.lst by:

default 0

in

default 3