X
Tech

A Few Notes about the GRUB Bootloader

Because of my multi-boot setup, and the fact that I am more or less continually reloading one distribution or another, I've had to look a bit deeper into setting up and configuring GRUB recently. Here are just a few random notes about things I have come across.
Written by J.A. Watson, Contributor

Because of my multi-boot setup, and the fact that I am more or less continually reloading one distribution or another, I've had to look a bit deeper into setting up and configuring GRUB recently. Here are just a few random notes about things I have come across.

- Not all GRUBs are created equal. There is a version which knows how to do graphics while booting (developed at SUSE, if I am not mistaken), which is typically used to show a timeout countdown to a default boot. More entertainingly, it is also used for the openSUSE "winter penguin" boot graphic. Of the distributions I have installed, the graphic GRUB (grub-gfxboot) is used by openSUSE, Mandriva, PCLinuxOS and SimplyMEPIS; the non-graphical version is used by Ubuntu and Fedora.

- If you are multi-booting different Linux distributions, and installing a new one changes the GRUB configuration such that it boots from the new partition rather than whatever other one you want it to, you can fix it rather easily using the GRUB shell, either running on one of the installed partitions, or from one of the LiveCD systems:

grub> find /boot/grub/stage1 (hd0,4) (hd0,5) (hd0,7) (hd0,8)

You have to know what partition you want to set GRUB to run from, in GRUB terms, which are not the same as Linux devices. Even if you think you know this, it's always good to use this "safety check" to be sure. If the partition you have in mind isn't listed by the find command, then you aren't going to be able to set GRUB to run from it.

grub> root (hd0,7)

This sets the partition that GRUB will be loaded from.

grub> setup (hd0)

This copies the GRUB files from the specified partition, and configures GRUB to boot from that partition.

grub> quit

You should now be ready to reboot.

- Regarding the graphic boot capability of GRUB, it is generally controlled by an entry in the /boot/grub/menu.lst file, on a line starting with gfxmenu. The file specified there should be a cpio archive, containing a number of files, including the graphics and masks to be displayed, and some configuration and control files as well. Experienced users can extract those files, modify or replace them, and create a new archive without too much difficulty. One interesting thing in particular that you can do on openSUSE is edit the gfxboot.cfg file to change how often the "winter penguin" boot screen is displayed.

- When multi-booting Linux partitions, if you are careful about what version of GRUB you are booting, and how your menu.lst files are written, you can get some sort of graphical boot background for all of the partitions, including even the ones which don't include the graphic capability in their own GRUB.

- At least some versions of GRUB have built-in translations of keywords for Linux and Windows systems, so when the menu.lst file only says "linux", the boot menu says "Mandriva 2009" or some such. This can lead to rather surprising results when you multi-boot from another version of GRUB, and then point it at a partition with one of these menu.lst files.

I don't expect any of this to be great revelations to many people. But I spent a fair amount of time figuring out and tracking down some of it, so maybe it will save someone else a bit of time and effort.

jw 9/1/2009

Editorial standards