Pages

Sunday, November 1, 2009

GRUB2

I think I am partial to Linux and hate MS Windows and that might be the reason when I started loving GRUB (Legacy) and LILO the real bootloader. And I watched grand success of GRUB. As I have already told that Ubutnu always prefer to adopt the latest software and its standards, GRUB2 came to make another history.

GRUB 2 is the default boot loader and manager for Ubuntu 9.10 (Karmic Koala) and Ubuntu 10.04 onwards and many other operating systems. As the computer starts, GRUB2 either presents a menu and awaits user input or automatically transfers control to an operating system kernel. GRUB 2 is a descendant of GRUB (GRand Unified Bootloader). It has been completely rewritten to provide the user significantly increased flexibility and performance. GRUB 2 is Free Software.

GRUB 2 introduces many new changes. GRUB 2 has better portability and modularity, supports non-ASCII characters, dynamic loading of modules, real memory management, and more. All these may be pretty much irrelevant for the most common users. What you need to know are the changes in the configuration files and the way GRUB 2 operates. Well there are  so many online documentations on GRUB2 . Then also I am writing this guide just for the common home user who does not want more detailing and a straight forward to to know the common GRUB2 task.

Old GRUB files were located under /boot/grub/, including the menu.lst file that was read during boot and which contents were displayed to the user in the form of the GRUB menu.

GRUB2 places its files in three core locations:

/boot/grub/grub.cfg - This is the main configuration file that replaces menu.lst. Unlike menu.lst, this file is not recommended to edit by hand! I strongly advise against trying to tamper with this file, using gedit or nano command or anything of the sort as this file is grub generated and gets over written every time when the update-grub command is used.

/etc/grub.d/ - This new directory contains GRUB scripts. These scripts are building blocks from which the grub.cfg file is built. When the relevant GRUB command is executed, the scripts are read in a certain sequence and grub.cfg is created.

/etc/default/grub - This file contains the GRUB menu settings i.e the scripts for OS Prober, Custom menu entry and GRUB2 theme etc that are read by the GRUB scripts and written into grub.cfg. It is the customization part of the GRUB, similar to the old  menu.lst, except the actual boot entries.