Originally written: 9/23/2011; last update: 4/27/2013
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
|Donate $1.00||Donate $2.50||Donate $5.00||Donate $10.00||Donate another value|
This page is part of my Managing EFI Boot Loaders for Linux document. If a Web search has brought you to this page, you may want to start at the beginning.
The GRand Unified Bootloader (GRUB) is actually two boot loaders. This page describes GRUB Legacy, which is the first, and now officially discontinued, version of the boot loader. The next page, Using GRUB 2, describes the current version of the boot loader. The official version of GRUB Legacy doesn't support EFI booting; however, Fedora (up to Fedora 17) uses a greatly modified version that includes EFI support. This page therefore describes this variant of GRUB Legacy.
GRUB Legacy is capable of both booting a Linux kernel and chain loading another EFI boot loader. Thus, if you want to use GRUB Legacy, you may be able to use it as the primary boot manager. As a general rule, GRUB Legacy is more reliable than GRUB 2 but slightly less reliable than ELILO or the kernel's EFI stub loader; however, there are significant system-to-system differences and therefore exceptions to these rules. In terms of specifics:
Because Fedora's version of GRUB Legacy is so heavily modified, installing it on other distributions can be a challenge. I provide links to both RPMs and tarballs below to help overcome this problem. Fedora has moved from its patched GRUB Legacy to GRUB 2 with its version 18, so future development of this branch of GRUB is unlikely, which in turn means that problems may crop up in the future because of incompatibilities or lack of features, and never be corrected. For instance, to the best of my knowledge GRUB Legacy doesn't support Secure Boot, and the binary versions are compiled with an old version of GNU-EFI which prevents them from being signed for use on a Secure Boot system. In theory, you should be able to build GRUB Legacy from source yourself, sign the binary, and use it to launch signed or unsigned Linux kernels. I've not tried to do this myself, though, so I can't promise it would work. See my page on Secure Boot for more on this topic.
GRUB Legacy installation works just as described in EFI Boot Loader Installation. If you're using a Fedora 17 or earlier system, GRUB Legacy should have been automatically installed for you, so you might not need to do anything else. (Fedora 18 has switched to GRUB 2 for EFI-mode booting.) If you're not using a Fedora system, here are links to some relevant package files from Fedora 17:
Fedora 17's grub package installs only the EFI version of GRUB Legacy. This package places the grub.efi file in the /boot/efi/EFI/redhat directory. Thus, if you installed this package with the ESP unmounted, you should copy this file out before you mount the ESP at /boot/efi, then copy it back to its proper location.
GRUB Legacy normally installs a grub.efi file to the ESP and reads its configuration file, grub.conf, from the same directory as the grub.efi file. (The configuration file's name should be the same as the boot loader's filename but with a .conf extension, so if you rename the boot loader, you should rename its configuration file, too.) GRUB Legacy reads the Linux kernel, the initial RAM disk, and other support files from Linux's /boot directory. This directory must be on a filesystem that GRUB Legacy supports, such as ext2fs, ext3fs, ext4fs, ReiserFS, XFS, JFS, Btrfs, or FAT. If your computer uses a Linux RAID or Logical Volume Manager (LVM) setup, you must place the /boot directory on a regular partition outside of the RAID or LVM setup.
GRUB Legacy's configuration file, grub.conf (or menu.conf for some versions, although not for Fedora's modified version), provides global options and a series of stanzas describing individual kernels or chainload options. This file's format is nearly identical on EFI systems as on BIOS systems, so if you're used to configuring GRUB Legacy on BIOS systems, you should have no problems on EFI computers. (An exception is how you chainload another boot loader.) An example file looks like this:
default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz #hiddenmenu title Fedora (3.5.4-1.fc17.x86_64) root (hd0,3) kernel /vmlinuz-3.5.4-1.fc17.x86_64 ro root=/dev/sda5 rhgb quiet initrd /initramfs-3.5.4-1.fc17.x86_64.img title Fedora (3.5.1-1.fc17.x86_64) root (hd0,3) kernel /vmlinuz-3.5.1-1.fc17.x86_64 ro root=/dev/sda5 rhgb quiet initrd /initramfs-3.5.1-1.fc17.x86_64.img title Windows 7 root (hd0,0) chainloader /EFI/Microsoft/Boot/bootmgfw.efi
You can cut and paste this example and modify it for your own needs. Some key points when you make your modifications include the following:
When GRUB Legacy is launched, you'll see a menu of boot options, each named after a title line in the configuration file. Select one and the associated kernel or EFI boot loader should launch. An example is shown below (note that it doesn't match the example configuration file earlier).
Distributions that ship with GRUB Legacy generally include scripts that update its configuration whenever you install a new kernel. Thus, you shouldn't have to do much to keep GRUB Legacy working in normal operation, at least not on a Linux-only installation and if you use the version of GRUB Legacy that shipped with your distribution. If you multi-boot several OSes, though, you may need to re-adjust your configuration whenever you upgrade your kernel, since the scripts might not get these details right. Likewise if you installed Fedora's GRUB Legacy on another distribution, since that distribution might try to modify grub.conf or menu.lst in /boot/grub rather than in /boot/efi/EFI/grub (or wherever you install the grub.efi file). You may also need to add, delete, or modify stanzas as you make changes to other OSes.
Go on to "Using GRUB 2"
Return to "Managing EFI Boot Loaders for Linux" main page
If you have problems with or comments about this web page, please e-mail me at firstname.lastname@example.org. Thanks.
Return to my main Web page.