Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Running grub-install on UEFI...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1602
Location: Fayetteville, NC, USA

PostPosted: Mon Feb 13, 2017 11:02 pm    Post subject: Running grub-install on UEFI... Reply with quote

I have an odd issue. I have been using Gentoo on UEFI systems for eons now, but this server is giving me some trouble.
Code:

(chroot) sysresccd ~ # grub-install /dev/sdb
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

As you can see, I am using System Rescue CD 4.9.0 (Gentoo-based) to install Gentoo. I have for ages. I built my kernel and such but am now stuck. GRUB 2.02 is not wanting to install. My setup is two 500GB SATA disks. Eacho one is GPT. the first partition is 1MiB-8MiB, bios_grub is on. The second partition uses the remaining disk and is BTRFS, RAID1, data and metadata. Under BTRFS I have /boot, /usr/portage, /usr/src, and /home as subvolumes for easy backups (snapshots) of my important stuff. I intend to install GRUB directly to /dev/sda and then /dev/sdb so both disks can boot should one fail.
Code:

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 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: 7BB71979-E7B8-4FD6-9F44-F0F95312D227

Device     Start       End   Sectors   Size Type
/dev/sda1   2048     16383     14336     7M BIOS boot
/dev/sda2  16384 976773119 976756736 465.8G Linux filesystem


Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 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: 0E3F168F-8447-465F-AE7C-FADE5CE779A3

Device     Start       End   Sectors   Size Type
/dev/sdb1   2048     16383     14336     7M BIOS boot
/dev/sdb2  16384 976773119 976756736 465.8G Linux filesystem

I do not have parted in the chroot so I had to use fdisk to list it. Below is the output from parted outside of the chroot.
Code:

root@sysresccd /root % parted --list
Model: ATA ST3500413AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  8389kB  7340kB               UEFI   bios_grub
 2      8389kB  500GB   500GB   btrfs        BTRFS


Model: ATA ST3500413AS (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   Flags
 1      1049kB  8389kB  7340kB               UEFI   bios_grub
 2      8389kB  500GB   500GB   btrfs        BTRFS

Help?
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Tue Feb 14, 2017 12:19 am    Post subject: Reply with quote

I don't know why, but fdisk won't handle it. You have to use gdisk. It's on the October release of Sysrescuecd.

I had the same problem as you. I had to repartition with gdisk. Grub legacy still wouldn't work, and I hate grub2. So I went with refind.
However, lots of people use grub2.

Gdisk is the answer to your immediate problem.
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1602
Location: Fayetteville, NC, USA

PostPosted: Tue Feb 14, 2017 12:38 am    Post subject: Reply with quote

That is incorrect. The error was kind of covered in poor responses via Google. The issue was that I *DID* create a grub area on the disk, but I also needed a 128MiB partition formatted as FAT32 for the EFI stuff. I have wiped the disks and started over again, adding a 128MiB partition and formatting it as FAT32. It is mounted at /boot/efi and ready to use. If it works I will report success so others can get the help they need.

*UPDATE*

It wasn't even a minute after this post I did it.
Code:

(chroot) sysresccd ~ # grub-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.

The issue is that you need a 128MiB FAT32 partition. The program you use to partition is irrelevant. My partition scheme is now 1-8MiB for GRUB, 8-136MiB FAT32 for EFI, and 136-100% for BTRFS RAID1. I mounted the FAT32 partition in /boot/efi (I created the efi directory) and it created "/boot/grub/efi/EFI/gentoo/grubx64.efi" in there. Now we're good.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Tue Feb 14, 2017 12:56 pm    Post subject: Reply with quote

The_Great_Sephiroth wrote:
That is incorrect. The error was kind of covered in poor responses via Google. The issue was that I *DID* create a grub area on the disk, but I also needed a 128MiB partition formatted as FAT32 for the EFI stuff. I have wiped the disks and started over again, adding a 128MiB partition and formatting it as FAT32.


That's what gdisk does for you. It is correct. It is interesting that you were able to torture fdisk into creating GPT partions, but it's not standard behavior.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Feb 14, 2017 2:54 pm    Post subject: Re: Running grub-install on UEFI... Reply with quote

The_Great_Sephiroth wrote:
Eacho one is GPT. the first partition is 1MiB-8MiB, bios_grub is on.

The_Great_Sephiroth wrote:
The issue was that I *DID* create a grub area on the disk, but I also needed a 128MiB partition formatted as FAT32 for the EFI stuff.

The_Great_Sephiroth ... they are different things:

GPT plus an "EFI System Partition" (EF00) (no "grub area") ... this is what constitutes a EFI boot.
MBR (BIOS) plus grub writing to the MBR (master boot record) ... this is what constitutes a 'pc' boot.

Both grub-legacy, and grub2 can use GPT partitions (for 'pc' booting), but in this case 'bios_grub' isn't involved, you're booting efi.

best ... khay
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1602
Location: Fayetteville, NC, USA

PostPosted: Tue Feb 14, 2017 3:18 pm    Post subject: Reply with quote

There's no torture going on. As I stated I used parted. Parted can easily do GPT, you seem to be confused. The process is not complex for an EFI/UEFI boot.

  • Create a GPT label
  • Create a small 2~8MiB partition for GRUB
  • Create a 128MiB partition (FAT32) for EFI
  • Create your other partition(s) and have fun

The issue was that I did NOT create the 128MiB partition and format it as FAT32 the first time. I forgot for some reason.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Feb 14, 2017 8:18 pm    Post subject: Reply with quote

The_Great_Sephiroth wrote:
There's no torture going on. As I stated I used parted. Parted can easily do GPT, you seem to be confused. The process is not complex for an EFI/UEFI boot.

The_Great_Sephiroth ... no, I'm not confused ...

The_Great_Sephiroth wrote:
  • Create a small 2~8MiB partition for GRUB
  • Create a 128MiB partition (FAT32) for EFI

The former would be un-necessary, EFI uses the ESP (exclusively), it doesn't need a "2~8MiB partition for GRUB" (because nothing it written to the "MBR", or in other words the portion of the disk "BIOS" would expect to find an MBR). What happens is, when you boot the UEFI firmware reads NVRAM (efivars) this points it to an "efi executable" (in this case grub2.efi installed on the ESP), it then runs this executable (and grub2 is started), anything else is superfluous.

best ... khay
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1602
Location: Fayetteville, NC, USA

PostPosted: Wed Feb 15, 2017 7:37 pm    Post subject: Reply with quote

Yeah I know I don't need the small partition for EFI. I was tired. I also wasn't saying you were confused. I know you well enough by now to know that you know your stuff.
_________________
Ever picture systemd as what runs "The Borg"?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Feb 15, 2017 7:50 pm    Post subject: Reply with quote

The_Great_Sephiroth wrote:
Yeah I know I don't need the small partition for EFI. I was tired. I also wasn't saying you were confused. I know you well enough by now to know that you know your stuff.

The_Great_Sephiroth ... no problem. I wasn't correcting you for the sake of it, you never know who might read the thread at some other point (and think "oh, I need a 2~8mb partition for grub").

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum