GRUB 2 is the latest version of GNU GRUB, the GRand Unified Bootloader. A bootloader is the first software program that runs when a computer starts. It is responsible for loading and transferring control to the operating system kernel, (Linux, in the case of Fedora). The kernel, in turn, initializes the rest of the operating system.
GRUB 2 has replaced what was formerly known as GRUB (i.e. version 0.9x), which has, in turn, become GRUB Legacy.
Starting with Fedora 16, GRUB 2 is used for new installs on x86 BIOS systems. For upgrades of BIOS systems the default is also to install GRUB 2, but you can opt to skip bootloader configuration entirely.
Tasks / Common issues
If you have other operating systems installed and wish to boot them via GRUB 2:
# yum install os-prober # grub2-mkconfig -o /boot/grub2/grub.cfg
Setting default entryDue to
grub2-mkconfig(and os-prober) we cannot predict the order of the entries in /boot/grub2/grub.cfg, so we set the default by name/title instead. To do this, first, we set
/etc/default/grub, and run
grub2-mkconfig -o /boot/grub2/grub.cfgto update grub.cfg. Then we call
grub2-set-default <title or number>with the title of the newly installed Fedora's entry. From that point on you can change the default by calling
grub2-set-default <title or number>or view it by running
To do that, you'll need the list of possible menu entries, which you can find with
grep menuentry /boot/grub2/grub.cfg(Surely there's a better way?)
If you understand the risks involved and still want to directly modify /boot/grub2/grub.cfg, here's how you can do it:
Edit /boot/grub2/grub.cfg, and change the line
Updating GRUB 2 configuration
It is safe to directly edit /boot/grub2/grub.cfg in Fedora. Grubby in Fedora modifies the configuration when a kernel update is performed but does so in a safe manner. Other distributions, in particular Debian and Debian-derived distributions provide a software patch that adds an
update-grub command which is neither included nor needed in Fedora.
Encountering the dreaded GRUB 2 boot prompt
If improperly configured, GRUB 2 may fail to load and subsequently drop to a boot prompt. To address this issue, proceed as follows:
1. List the drives which GRUB 2 sees:
2. The output for a dos partition table /dev/sda with three partitons will look something like this:
(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
3. While the output for a gpt partition table /dev/sda with four partitions will look something like this:
(hd0) (hd0,gpt4) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
4. With this information you can now probe each partition of the drive and locate your vmlinuz and initramfs files:
Will list the files on /dev/sda1. If this partition contains /boot, the output will show the full name of vmlinuz and initramfs.
5. Armed with the location and full name of vmlinuz and initramfs you can now boot your system.
5a. Declare your root partition:
grub> set root=(hd0,3)
5b. Declare the kernel you wish to use:
grub> linux (hd0,1)/vmlinuz-3.0.0-1.fc16.i686 root=/dev/sda3 rhgb quiet selinux=0 # NOTE : add other kernel args if you have need of them # NOTE : change the numbers to match your system
5c. Declare the initrd to use:
grub> initrd (hd0,1)/initramfs-3.0.0-1.fc16.i686.img # NOTE : change the numbers to match your system
5d. Instruct GRUB 2 to boot the chosen files:
6. After boot, open a terminal.
7. Issue the grub2-mkconfig command to re-create the grub.cfg file grub2 needed to boot your system:
grub2-mkconfig -o /boot/grub2/grub.cfg
8. Issue the grub2-install command to install grub2 to your hard drive and make use of your config:
grub2-install --boot-directory=/boot /dev/sda # Note: your drive may have another device name. Check for it with mount command output.
Other GRUB 2 issues
Absent Floppy Disk : It has been reported by some users that GRUB 2 may fail to install on a partition's boot sector if the computer floppy controller is activated in BIOS without an actual floppy disk drive being present. A possible workaround is to run (post OS install) from rescue mode:
grub2-install <target device> --no-floppy