GRUB 2

From Wiki :: openmamba
Jump to: navigation, search

GRUB 2 is a Multiboot boot loader. It's derived from GRUB (GRand Unified Bootloader), originally designed and developed by Erich Stefan Boleyn.

Shortly the boot loader is the first programm that starts when a PC starts. It loads the first stage of the operative system and give to it the control so that it can initialize all the system.

Configuration[edit]

The configuration of GRUB 2 in openmamba is possible editing the file

/etc/sysconfig/grub

which default content is:

#
# grub2 configuration file
#
#
# Uncomment the following lines to configure other systems (chainloaded)
# to appear in grub2 boot menu.
#
GRUB_OTHER_TITLES=("Windows 98")
GRUB_OTHER_DEVICES=(/dev/hda3)

# Define an alternative command line for linux entries
#
#GRUB_CMDLINE_LINUX="resume2= video=uvesafb:1024x768-32,ywrap,mtrr:3 quiet splas
h=silent,fadein console=tty1"

# Define default menu entry
#
GRUB_DEFAULT=1

# Define boot menu timeout before loading default menu entry
#
GRUB_TIMEOUT=1

# Definitions for serial console
#
#GRUB_TERMINAL=
#GRUB_SERIAL_COMMAND=

#Apply changes with:
#
# update-grub

The modify done to the file are applied running the following command:

/usr/sbin/update-grub

that create the true configuration file used by grub:

/boot/grub/grub.cfg

Note: It'is advised to not edit that file because it's rewrited at every kernel update. The correct way to apply the modify is to use the update-grub.

Booting a non Linux operative system[edit]

To configure the boot of a non Linux operative System (for example a Windows version), you must identify the partition in which the system is, as Linux know it, for example

/dev/hda1

is the firts partition of the first IDE hard disk. Now we can add the following lines to the configuration file '/etc/sysconfig/grub:

GRUB_OTHER_TITLES=("Windows 98")
GRUB_OTHER_DEVICES=(/dev/hda1)

The following example shows the case in which there are more then one alternative system:

GRUB_OTHER_TITLES=("Windows 98" "FreeBSD")
GRUB_OTHER_DEVICES=(/dev/hda1 /dev/hda4)

How to set the default boot system[edit]

Normally GRUB starts a default system if, after 5 seconds from the boot menu, the user don't touch any key. To set a default system other than the first (know as number 0) add (or uncomment) the following line in /etc/sysconfig/grub:

GRUB_DEFAULT=1

In that case the default boot system is the one in the second line of the boot menu.

How to change the timeout of the boot menu[edit]

To modify the boot menu timeout, set the following line in /etc/sysconfig/grub:

GRUB_TIMEOUT=30

That example set the timeout to 30 seconds.