GRUB
For me, GRUB (aka GRUB Legacy) made its existance felt with the release of RedHat Linux 7.2. In this release, RedHat changed the default boot loader from lilo to GRUB.
Now, since I was already comfortable with lilo, I wasn't sure I wanted to change to GRUB. However, I had read about GRUB in a Linux Journal article, so I took the plunge.
Now that I have had to deal with configuring GRUB, I can say that the features that GRUB offers are far superior to what lilo offers.
Getting all GRUBy
When I updated my kernel there was a problem with the resultant grub.conf file that rpm created. As it turned out, the root partition, the path to the kernel image, and the path to the initrd image were wrong for my configuration; I have /boot on its own partition.
So in trying to fix my grub.conf file I learned that you must specify as root the partition that /boot resides and the path relative from that partition's root.
Hopefully an example will clarify what I am trying to say. Given the following partitions on drive hda:
hda1 /boot
hda2 FAT32
hda3 /
hda4 Extended partion
hda5 /tmp
hda6 /var
the grub.conf settings for a particular kernel would be:
title "My new kernel"
root (hd0,0)
kernel /vmlinuz-2.4.9-13 ro root=hda3
initrd /initrd-2.4.9-13.img
title "My old kernel"
root (hd0,0)
kernel /vmlinuz-2.4.7-10 ro root=hda3
initrd /initrd-2.4.7-10.img
The installation of the new kernel totally gibbed up my original configuration. Firstly, the file /boot/grub/grub.conf became a soft link to the non-existant file ./System.map. The real System.map file, which normally lives in /boot and is a soft link to a kernel specific System.map, was now a file that had the contents of what should have been the "new" /boot/grub/grub.conf file.
So a quick mv and ln, and my files are back in order. Or are they? Well not only did installing the kernel rpm screw the above two files up, the new grub.conf had the following incorrect configuration:
title "My new kernel"
root (hd0,0)
kernel /boot/vmlinuz-2.4.9-13 ro root=hda1
initrd /boot/initrd-2.4.9-13.img
title "My old kernel"
root (hd0,0)
kernel /boot/vmlinuz-2.4.7-10 ro root=hda1
initrd /boot/initrd-2.4.7-10.img
The above configuration probably would have worked if you used the auto-partitioning option when installing RedHat which puts the /boot directory in with the / partition and the / partition was hda1. This as you know was not my configuration.
Just for completeness, here is the correct grub.conf file for my configuration:
title "My new kernel"
root (hd0,0)
kernel /vmlinuz-2.4.9-13 ro root=hda3
initrd /initrd-2.4.9-13.img
title "My old kernel"
root (hd0,0)
kernel /vmlinuz-2.4.7-10 ro root=hda3
initrd /initrd-2.4.7-10.img
The Moral of this Story
GRUB cannot mount more than one partition, so make sure that root is specified as the partition that contains the /boot directory and set the paths for the kernel and initrd images relative from that partition.
GRUB2
GRUB is an old, currently unmaintained, boot loader. This has left each distribution that uses GRUB to maintain their own patches to GRUB. Nature abhors a vacuum, so the GRUB2 project is getting ready to become the new boot loader for distributions.
References
- The GNU GRUB Boot Loader, Linux Gazette, Issue 64.
- Linux+Win9x+Grub HOWTO, Linux Documentation Project
- Multiboot with GRUB Mini-HOWTO, Linux Documentation Project
- Mastering Grub 2 The Easy Way