These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/Grub Configuration

Classnotes | UNIX02 | RecentChanges | Preferences

What is GRUB?

Traditionally, Linux booted via the very Linux-centric bootloader LILO (which stood for Linux Loader). LILO was moderately simple to use, but required some non-intuitive methods to reconfigure (which, if not followed, could render your system unbootable). LILO was not designed with "user-friendliness" in mind, and did not give any useful debugging information when something went wrong.

GRUB, the Grand Unified Bootloader, was created as an OS-independent bootloader with many extra features and useful debugging information. GNU GRUB is the Free Software Foundation's derivative of the original GRUB, and it is the one we will be using here today. (See

LILO is still in use today, and does have some functionality that is not yet supported by GRUB. For example, I use it on my system as LILO has better support for software RAID Linux file systems. However, for most situations, GRUB is better suited.

GRUB Configuration

Grub's configuration and system files are usually stored in /boot/grub. Many of these files we will not be important to us. We will focus on menu.lst (that's a lower-case "L" and not a "1").

menu.lst is the file which defines the boot menu and options. In the UNIX tradition, lines beginning with '#' are ignored and many lines are in an 'option = value' format. The file begins with a few optional global settings:

 # By default, boot the first entry.
 default 0

The first entry (here, counting starts with number zero, not one!) will be the default choice.

 # Boot automatically after 30 secs.
 timeout 30

As the comment says, GRUB will boot automatically in 30 seconds, unless interrupted with a keypress.

 # Fallback to the second entry.
 fallback 1

If, for any reason, the default entry doesn't work, fall back to the second one (this is rarely used, for obvious reasons).

For other commands, see this:

Now, on to the actual OS definitions. You will see that each entry begins with a special command, title (see title), and the action is described after it.

The argument for the command title is used to display a short title/description of the entry in the menu. Since title displays the argument as is, you can write basically anything in there.

 title Red Hat Linux (2.4.7-10)
        root (hd0,4)
        kernel /boot/vmlinuz-2.4.7-10 ro root=/dev/hda5
        initrd /boot/initrd-2.4.7-10.img

This boots Red Hat Linux from the 5th partition of the first hard disk. The root parameter tells where to find this OS kernel. The kernel parameter tells where the kernel is and what options to pass to it. Linux sometims uses an initrd (an initial ramdisk), here we see one in use.

A more general menu.lst file with a number of OSes is illustrated bellow:

 title Red Hat Linux (2.4.7-10)
        root (hd0,4)
        kernel /boot/vmlinuz-2.4.7-10 ro root=/dev/hda5
        initrd /boot/initrd-2.4.7-10.img
 title OpenBSD 3.0
        root (hd0,0)
        chainloader +1
 title Windows
        root (hd1,0)
        chainloader +1
 title FreeBSD 4.4 #1
        root (hd0,2,a)
        kernel /boot/loader
 title FreeBSD 4.4 #2
        root (hd0,3,a)
        kernel /boot/loader

Set up your system under Red Hat to also boot your FreeBSD installation. Reboot and verify that you can do so.

Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited May 9, 2003 7:50 pm (diff)
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.