Jamie's Random Musings
Various thoughts and adventures, including but not limited to Linux, Windows XP and Widows Vista, and assorted bits of hardware new and old.
Friday 9 January 2009, 11:29 AM
A Few Notes about the GRUB Bootloader
- 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
Comments on this post
I have a dual-boot Linux system that has "hidden" one of the Linux boot partitions. This info will help me fix the "feature" I've run into.
Thanks.
I'm always pleased to hear that something I have posted has helped someone, but it is particularly nice when it helps someone as experienced and knowledgeable as you. Thanks for reading and commenting.
Oddly enough, this procedure saved me some trouble this morning as well. When I turned on the S2110, it failed to boot, GRUB just came up in command-line mode (grub>). Most likely because the last thing I did on Friday was fooling around trying to install Vector Linux, which wants to install LILO rather than GRUB, and blah blah blah... Anyway, the point is, from the GRUB command line I just used the exact three commands described above, and it reset GRUB to boot properly. Whew.
I'm going to write one more blog post about GRUB, mostly about the config file and graphical booting, because of a couple of other queries I have received. Hopefully today.
jw 12/1/2009


