grub2-install: error: /boot/efi doesn't look like an EFI partition on a fresh Gentoo install

The answer is simple. EFI System Partition (ESP) should be FAT32 (FAT16 or even FAT12 will also do for most proper UEFI; they are mostly shown as vfat in Linux) instead of ext2:

mkfs.fat -F32 /dev/sda2

FWIW, if you are not going to install grub i386-pc (for BIOS/CSM boot), you don't need the "BIOS boot" partition. It is only required by grub i386-pc (but not grub x86_64-efi or i386-efi) on GPT.

It doesn't really matter whether you use the ESP for /boot. If you do, you should run:

grub2-install --efi-directory /boot

If you mount it on /boot/efi instead, then you should run:

grub2-install --efi-directory /boot/efi

--boot-directory /boot is implied (i.e. default); It doesn't matter whether /boot is the ESP, another separate partition, or a directory on the / filesystem.

You may not even need to chroot again to perform grub2-install; For example, you mounted sda4, your partition for /, on /mnt; AND THEN, mounted sda2, your ESP, on /mnt/boot/efi, then you can simply run:

grub2-install --boot-directory /mnt/boot --efi-directory /mnt/boot/efi

Although grub2-mkconfig needs to be run in chroot AFAIK. But if you plan on writing a simple and clean grub.cfg yourself instead (which is the only graceful way to use grub2), then this will be out of your concern.


The problem seemed to be mixing and matching BIOS, EFI, MBR, and GPT. I tried to follow the guides and use the GPT, but there were some dependencies that I could not resolve because I am too inexperienced. Its not even clear to me the kernel was built with GPT support (via config option CONFIG_EFI_PARTITION).

When I dropped GPT and EFI and switched to purely BIOS and MBR, I was able to boot the resulting machine. BIOS and GPT are supposed to be a valid combination, but I'm wondering if it works in practice (see, for example, Bootloader Options).

Here's the configuration I was able to run the machine with:

$ parted
GNU Parted 3.2
Using /dev/sda
(parted) print                                                            
Model: ATA VMware Virtual I (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  135MB   134MB   primary  ext2            boot
 2      135MB   19.5GB  19.3GB  primary  ext4
 3      19.5GB  21.5GB  2012MB  primary  linux-swap(v1)

Partition 1 is /boot, Partition 2 is /, and Partition 3 is swap.