Installing GRUB2 in a GPT disk on a partition
I solved by creating a EFI-stub kernel and then, while booted with it, I proceeded to install grub with grub2-install --target=$arch-efi --efi-directory=$esp
where $esp
is the directory where I mounted my /boot
and $arch
is the architecture of my CPU (in my case, x86_64
. With this procedure, grub is then installed in the $esp
and a grubx64.efi
is created.
Last step to be taken is the config creation:
grub2-mkconfig -o $esp
And everything's set!
So to sum it up:
- Create a EFI-STUB kernel and boot it
- Install grub as usual with:
grub2-install --target=$arch-efi --efi-directory=$esp
- Create the config file for grub:
grub2-mkconfig -o $esp
- Done!
Related videos on Youtube
peperunas
Updated on September 18, 2022Comments
-
peperunas over 1 year
I'm using a MacBook Air 2013 and I'm trying to install Gentoo. I already did it several times but I always used other "workarounds" to this problem such as using directly a EFI-stub kernel image.
What I'm trying to achieve is installing GRUB on a PARTITION so I won't scramble the original disk layout of my Macbook.
This is my partition table:
GPT fdisk (gdisk) version 0.8.8 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 236978176 sectors, 113.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): 9DF6BE23-87E0-4602-B71F-7DAD445D5614 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 236978142 Partitions will be aligned on 8-sector boundaries Total free space is 6 sectors (3.0 KiB) Number Start (sector) End (sector) Size Code Name 1 40 409639 200.0 MiB EF00 EFI System Partition 2 409640 176582599 84.0 GiB AF00 Customer 3 176582600 177852135 619.9 MiB AB00 Recovery HD 4 177852136 178114279 128.0 MiB EF00 EFI System 5 178114280 236978142 28.1 GiB 8300 Linux filesystem
The 1st partition is the original ESP of my Mac (where I installed Refind) and I would like to keep it as it is. I tried to place GRUB on the 4th partition (which is vfat) but when I try to install it there I get:
# > grub2-install /dev/sda4 /usr/sbin/grub2-bios-setup: warning: File system 'fat' doesnt' support embedding. /usr/sbin/grub2-bios-setup: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged.. /usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.
I also tried using
grub2-install --force /dev/sda4
but that did nothing. How can I solve this thing? Thanks!