GRUB2 Quick Start/en

This article provides information on how to get up and running with GRUB2 in the simplest configurations. For more comprehensive information, see GRUB2. For a migration from GRUB Legacy to GRUB2, see GRUB2 Migration.

Installing GRUB2 software
The package is slotted; both grub-0.97 and grub-2.xx may be installed at the same time. However, while both versions of GRUB can be installed on the system at the same time, only one version of GRUB may be active as the system's boot loader at the same time.

To install GRUB2, first set the  variable in  (optional). If unset, GRUB2 will guess which platform to use on the system. It guesses "pc" (which is not UEFI; see examples below) for X86/AMD64 architecture.

After the variable is set, emerge the software:

Activating the GRUB2 boot loader
Mount if applicable:

When using an EFI platform, make sure that the EFI System Partition is available at. This can either be through a specific mount point (at ) or by having the boot partition be the EFI System Partition.

Presuming only is FAT:

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

To install GRUB2 to the MBR:

To install GRUB2 on an EFI capable system:

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

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

grub2-mkconfig generates the configuration file based on template sections located in. The default templates should cover most common boot setups.

The behavior of these templates can be controlled by setting variables in. See the GRUB manual for more information.

Kernel naming scheme
In order for grub2-mkconfig to detect the available Linux kernel(s), their names must start with or.

For example:

When using an initramfs, its name should start with or  and end with. The version must match one of a kernel image. File names generated by genkernel will also work.

For example:

To generate the file, execute the grub2-mkconfig command like so:

Silent kernel decompression
To silence kernel decompression at boot time, edit and add   to the   parameter.

Systemd
To boot systemd while using GRUB2 make the  variable look like this:

Loading another operating system
grub2-mkconfig can also generate configurations to load other operating systems. This requires the package.

To boot Windows, the also needs to be installed. It allows for the grub2-mkconfig utility to probe NTFS filesystems.

Manual configuration
Users do not need to use grub2-mkconfig</tt>. The file can be edited manually as well.

As most users have experience with GRUB Legacy format, the next example shows how to write a GRUB2 configuration file based on information from the GRUB Legacy configuration.