How to change the default Operating System to be loaded in the Grub

Posted: April 29, 2011 in Ubuntu
Tags: , ,

Hello everybody. Sometimes we need to change the default operational system to be loaded in the Grub.
However Ubuntu 10.10 uses Grub2 and it does not use anymore the files menu.lst and grub.conf. In my case, the file /boot/grub/grub.cfg has the following menu entries:

Ubuntu, with Linux 2.6.38.3
Ubuntu, with Linux 2.6.38.3 (recovery mode)
Memory test (memtest86+)
Memory test (memtest86+, serial console 115200)
Windows 7

However, the menu above can be seen when the Grub is started.
To make the change, open the file /etc/default/grub as root privileges. You will see something like that:

# If you change this file, run ‘update-grub’ afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
GRUB_CMDLINE_LINUX=””

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD …)
#GRUB_BADRAM=”0x01234567,0xfefefefe,0x89abcdef,0xefefefef”

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo’
#GRUB_GFXMODE=640×480

# Uncomment if you don’t want GRUB to pass “root=UUID=xxx” parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY=”true”

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE=”480 440 1″

Go to the line GRUB_DEFAULT=0. This value indicate as default “Ubuntu, with Linux 2.6.38.3”. Just for example, let’s leave Windows 7 as default. Change the GRUB_DEFAULT to 4. After that, open a shell and type:

sudo update-grub

Note that, GRUB_DEFAULT follow the sequence of menu entries. In my case is:

[0] Ubuntu, with Linux 2.6.38.3
[1] Ubuntu, with Linux 2.6.38.3 (recovery mode)
[2] Memory test (memtest86+)
[3] Memory test (memtest86+, serial console 115200)
[4] Windows 7

That’s it folks. See you next time.

Advertisements

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