quinta-feira, abril 08, 2010

How to configure Grub 2 in Ubuntu 9.10 (Karmic Koala)

I've installed Ubuntu version 9.10 (Karmic Koala) recently, and previously I had another operating system installed in my computer. I tried configure Grub (GRand Unified Bootloader) to execute the dual boot screen, so I noticed that this version of Grub was not the same as the previous versions of Ubuntu.


Ubuntu 9.10 uses Grub 2, and there are some new features to make it easy to configure.
First: You should NOT edit the /boot/grub/grub.cfg file. This file replaces the old /boot/grub/menu.lst Grub legacy file. By the way, it no longer exists.

Actually, there is another configuration file /etc/default/grub that can be edited by a root user (like the old menu.lst). Some of the parameters of this file are:

GRUB_DEFAULT: Sets the default and pre-selected menu entry. Entries may be numeric or saved.

GRUB_DEFAULT: Sets the default menu entry by menu position. As with Grub Legacy, the first "menuentry" in grub.cfg is 0, the second is 1, etc.

GRUB_DEFAULT: Sets the default menu entry by name. Example: "Windows XP Professional (on /dev/sda1)".

GRUB_DEFAULT: Sets the default menu entry with whatever was selected on the last boot. If the menu is displayed during boot, the previously selected option will be highlighted. If no action is taken, this is selection which will be booted at the end of the timeout, or if the menu is hidden.

GRUB_TIMEOUT: No change from Grub Legacy. This is the number of seconds before the default entry is automatically booted.
Setting a value of -1 will display the menu until the user makes a selection (no timeout).

There are another parameters that were ommited in this post.

After you edit /etc/default/grub, run the command update-grub at console as root user, so /boot/grub/grub.cfg will be updated automatically by system.

For further information about Grub 2, read: https://wiki.ubuntu.com/Grub2.