GRUB2 Quick Start

Summary
This article provides information on how to get up and running with grub:2 in the simplest configurations. For more complex or obscure usage, see GRUB2.

Installing the software
Unmask the package.

Set GRUB_PLATFORMS in make.conf (optional). If unset, grub will guess which platform you want. It guesses "pc" for x86/amd64.

Run emerge.

Installing a bootable image
Mount your /boot volume if you have one.

If you are using an EFI platform, mount your EFI boot volume at /boot/efi. This should be a FAT volume containing an EFI subdirectory.

Run the grub2-install utility to copy the relevant files to /boot/grub2. On the PC platform, this also installs a boot image to the master boot record (MBR) or a partition's boot sector.

grub2-install accepts a --target option to specify which CPU/Platform to install. If unspecified, grub2-install will make a guess; on amd64/x86 it will use "i386-pc" by default.

Installing to the MBR:

Installing to a partition:

Installing on EFI:

Configuration
GRUB2 is traditionally configured by using the grub2-mkconfig program to generate a config file.

grub2-mkconfig generates the config file based on template sections in /etc/grub.d. The default templates should cover most common boot setups.

The behavior of these templates may be controlled by setting variables in /etc/default/grub. See the GRUB2 Config Variables article for reference.

Generate the grub.cfg file: