I need a Gentoo 13 machine to test some software on the platform. I'm not a Gentoo regular, so I'm suffering their install procedures. I'm at Configuring the bootloader | Installing GRUB2, and it failed with:
# grub2-install --target=x86_64-efi --efi-directory=/boot
Installing for x86_64-efi platform.
grub2-install: error: /boot doesn't look like an EFI partition.
I backtracked to Preparing the disks | Default: Using parted to partition the disk, and it appears I have things setup as instructed:
(chroot) Gentoo-2012 / # parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit mb
(parted) print
Model: ATA VMware Virtual I (scsi)
Disk /dev/sda: 21475MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1.05MB 3.15MB 2.10MB grub bios_grub
2 3.15MB 131MB 128MB ext2 boot boot, esp
3 131MB 2572MB 2441MB linux-swap(v1) swap msftdata
4 2572MB 21474MB 18902MB ext4 rootfs msftdata
The results above are from the same chapter of the manual, sections Applying a filesystem to a partition and Activating the swap partition.
I also followed the comment EFI directory should not be /boot but /boot/efi from Bootloader problems and questions on the Gentoo forums, but it resulted in the same error:
(chroot) Gentoo-2012 / # mkdir /boot/efi
(chroot) Gentoo-2012 / # grub2-install --target=x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi
Installing for x86_64-efi platform.
grub2-install: error: /boot/efi doesn't look like an EFI partition.
What's the problem and how do I fix it?
Here's the corresponding fdisk
view of the information presented by gparted
above.
(chroot) Gentoo-2012 / # fdisk -l
Disk /dev/loop0: 3.3 GiB, 3567640576 bytes, 6968048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 52F5571A-808B-XXXX-XXXX-XXXXXXXX
Device Start End Sectors Size Type
/dev/sda1 2048 6143 4096 2M BIOS boot
/dev/sda2 6144 255999 249856 122M EFI System
/dev/sda3 256000 5023743 4767744 2.3G Microsoft basic data
/dev/sda4 5023744 41940991 36917248 17.6G Microsoft basic data
I also verified the package sys-boot/grub
supports EFI:
(chroot) Gentoo-2012 / # cat /etc/portage/make.conf | grep GRUB
GRUB_PLATFORMS="emu efi-32 efi-64 pc"
I then performed an emerge --ask --newuse sys-boot/grub
, emerge -pv sys-boot/grub
, and then rebuilt grub
.
grub2-install --target=x86_64-efi --boot-directory=/boot --efi-directory=/boot/efi
fdisk
to prepare your partitions on the disk, then it says right in the manual: "grub is going to give you some serious problems if you use fdisk, and you're on your own". Their solution is to follow the manual's advice and prepare your disks using theparted
tool, and using that to label your disks using the GPT flags. Then thegrub-install
won't complain about: "What the partition looks like".