Monday, August 2, 2010

Configuring GRUB

When you first boot your Ubuntu system, there is a small text screen that says GRUB Loading, and you have three seconds to press Esc before it boots the default operating system. GRUB is the GRand Unified Bootloader and determines which operating system you want to run. If you press Esc during the boot loader screen, you can select alternate operating systems, kernels, and kernel parameters.

If you don’t press Esc in three seconds, then GRUB will boot the default operating system. You can change the GRUB configuration by editing /boot/grub/menu.lst. For example, if you change the timeout value to 15 (from timeout 3 to timeout 15), then GRUB will wait 15 seconds before booting the default operating system. This is very useful if your monitor takes a few seconds to wake up from power-save mode or if you are just slow to press Esc.

Similarly, menu.lst file includes the list of known kernels and operating systems at the end of the file. The first one listed is item 0, the second is item 1, and so on. At the beginning of menu.list is a line that says Default 0. This identifies the default operating system configuration as the first one in the list. If you change it to Default 3, then the fourth system listed will become the default.



Altering Boot Parameters
The /boot/grub/menu.lst file contains three main sections. The first section, found at the top of the file, contains basic parameters such as timeout and default.

The second section is denoted by a line that says BEGIN AUTOMAGIC KERNELS LIST. This section contains parameters used for automatic kernel configuration. Each of these lines begins with one or two hash signs (# or ##). Usually a hash sign denotes a commented line. However, the automated script actively removes the first hash in order to obtain customized kernel parameters. Real comments have two hash signs; configuration parameters have one.

For example, one ofmycomputers requires the kernel parameter pci=nobios in order to boot properly. Rather than pressing Esc and manually entering it each time I reboot, I can add it to the boot options line. It needs to have one hash character so that it becomes a configuration parameter.

## additional options to use with the default boot option, but not with
## the alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=pci=nobios

The final section of the file comes after the line that says End Default Options. Do not modify anything below this line. Whenever you update the system and install a new kernel or make changes to GRUB, this section is\ regenerated. Anything manually changed after this line will be lost the next time you install a kernel upgrade.



Updating GRUB
The boot loader does not actually reside in the Linux partition. Instead, it is hooked into the sector containing the partition table on the hard drive. After you make any changes to the GRUB configuration files, you need to update the installed boot loader:

sudo update-grub

This command regenerates the /boot/grub/menu.lst file and updates the boot loader on the hard drive.

Source of Information : Wiley Ubuntu Powerful Hacks And Customizations

No comments: