GRUB is a bootloader package which lets you boot any installed operating system on your computer. It does this by referring to its configuration file which is generally installed in the boot partition along with GRUB itself. GRUB is an excellent piece of software which does an good job of helping you boot multiple operating systems.
The GRUB configuration file is located in the “/boot/grub” folder. It could be saved as “menu.lst” or “grub.conf” depending on your distribution’s packagers and GRUB’s configuration. Don’t worry though, both files are generally the same aside from the name. More often than not, the files will also be symlinked, so you might not even notice a difference if you’ve been working with a grub.conf file and all the sudden this new-fangled distribution uses menu.lst.
Updating GRUB to recognize new Linux distributions or kernel images can be done in two ways, automatically and manually.
The automatic procedure involves executing a simple command which will scan your boot partition for new kernel images and make relevant entries for them in the GRUB configuration file. The command is “update-grub” or “sudo update-grub” depending on your current user permissions.
To accomplish the same manually is a little more involved and requires you to edit a configuration file. You will be editing the menu.lst or grub.conf file. Fire up your favorite editor, I personally prefer nano, and type:
sudo nano -w /boot/grub/grub.conf
This will open the grub.conf or menu.lst file in nano. You will be able to see existing entries in GRUB’s configuration file. If you want to add an entry, you will need to know the location of the kernel image (vmlinuz file) and optionally, the location of the initial ramdisk file (initrd). Once you know the location of these files, adding an extra entry is as simple as referring to the earlier entries and creating an extra entry below the current entries. Here is an example:
title New Linux Installation
kernel /vmlinuz-2.6-newinstall ro root=LABEL=/
In this example, the name displayed in the GRUB menu will be “New Linux Installation” and selecting that entry will load the kernel named vmlinuz-2.6-newinstall which is stored on the third partition of the first disk. The initial ramdisk used will be initrd-2.6.img which is also present in the third partition of the first disk.
Once you’re satisfied with the configuration, press Ctrl + X to save and exit nano. On the next reboot, the GRUB menu will have this new entry at the bottom of the list, and selecting it should boot your desired distribution.
GRUB calculates the disk numbers and partition numbers by starting from 0. So a disk named hd1,2 will be referring to the third partition on the second disk, which Linux would refer to as /dev/hdb3 or /dev/sdb3. Please find out the correct disk numbers before saving the GRUB configuration file.
As always, updating grub automatically is the preferred method due to ease of use.