GRUB2 Quick Start/pt-br

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 which means both grub-0.97 and grub-2.xx may be installed at the same time. However, while both versions of GRUB can be installed simultaneously, only one version of GRUB may be active as the system's bootloader at a time.

To install GRUB2, first set the GRUB_PLATFORMS variable with one or more appropriate values in the system's. If unset, GRUB2 will guess which platform to use on the system. It guesses  (which is the MBR style of installation) for / architectures.

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 (mounted) at. This can either be through a specific mount point (at ) or by having an entire partition formatted with the FAT filesystem. This will effectually render into a large EFI System Partition.

Presuming only is FAT:

Run the 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 command accepts a   option to specify which CPU/Platform to install. If unspecified, will make a guess: on / it will use the   value by default.

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

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 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 will also work.

For example:

To generate the file, execute the  command like so:

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

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

Loading another operating system
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 utility to probe NTFS filesystems.

Manual configuration
Users do not need to use. 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.