GRUB2 Quick Start
This article provides information on how to get up and running with GRUB2 in the simplest configurations. For more comprehensive information, see GRUB2.
Gentoo GRUB Legacy (0.97) to GRUB2 Migration Guide
The guide is available here.
The sys-boot/grub package is slotted; both grub-0.97 and grub-2.00 may be installed at the same time.
If you want to install grub-0.97 or keep it installed after an upgrade, call emerge with the "0" slot on the end of the package atom. This will add sys-boot/grub:0 to your world file. For example:
Only one version may be installed in your MBR at one time.
Installing the software
Set GRUB_PLATFORMS in make.conf (optional). If unset, grub will guess which platform you want. It guesses "pc" for x86/amd64.
Installing a bootable image
Mount your /boot volume if you have one.
If you are using an EFI platform, mount your EFI system 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/grub. 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 (not recommended):
Installing on EFI:
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 GRUB manual for reference.
In order for grub2-mkconfig to detect your Linux kernel(s), they must be named vmlinuz-version or kernel-version. For example:
If you use an initramfs, it should be named initramfs-version.img or initrd-version.img. File names generated by genkernel will also work.
Generate the grub.cfg file:
Silent Kernel Decompression
To silence kernel decompression make your line in /etc/default/grub look like this.
To boot systemd with GRUB2 make your line look like this
Loading another operating system
grub2-mkconfig can generate a configuration to load other operating systems. This requires the sys-boot/os-prober package.
To boot Windows, you should also install sys-fs/ntfs3g to allow grub2-mkconfig to probe NTFS filesystems.
Instead of using
grub2-mkconfig, a typical simple grub.conf can easily be converted to be suitable for use in grub.cfg.