Gentoo Archives: gentoo-user

From: Rod <Rod@×××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] UEFI booting [solved]
Date: Wed, 19 Aug 2015 13:28:30
Message-Id: 55D4846F.4060701@Rods.id.au
In Reply to: Re: [gentoo-user] UEFI booting by Jeremi Piotrowski
1 On 08/17/2015 11:37 PM, Jeremi Piotrowski wrote:
2 > On Mon, 17 Aug 2015, Rod wrote:
3 >> Hi list,
4 > Hi
5 >
6 >> I'm trying to figure out how to make my boot partition to boot from UEFI,
7 >> I have grub2 installed, but I keep getting a error when I ask it to install
8 >> the boot information.
9 > First things first, are you installing gentoo from an UEFI booted
10 > installation media? From what I know the gentoo minimal install cd does
11 > not allow for this, and I will assume you are using that.
12 >
13 > If you're using some other installation method, check whether the
14 > directory /sys/firmware/efi/efivars has any content, try to mount efivarfs
15 > following the instructions in this link:
16 >
17 > https://wiki.gentoo.org/wiki/Efibootmgr#Configuration
18 >
19 > and then check again.
20 >
21 >> # efibootmgr
22 >> efibootmgr: EFI variables are not supported on this system.
23 >>
24 >>
25 >> # grub2-install --target=x86_64-efi /dev/sdc
26 >> Installing for x86_64-efi platform.
27 >> efibootmgr: EFI variables are not supported on this system.
28 >> efibootmgr: EFI variables are not supported on this system.
29 >> Installation finished. No error reported.
30 > In your case it seems that the system is not in an UEFI-booted state. But
31 > we can work around this by using a nice part of the UEFI specification,
32 > details below.
33 >
34 >> mount
35 >> /dev/sdc1 201633 156 201478 1% /boot/efi
36 >>
37 >> I have the /boot/efi part mounted ok..
38 > Before we go further make sure that the partition is a valid EFI boot
39 > partition: code EF00 (gdisk), partition flags boot/esp (for parted).
40 >
41 >> How can I get this UEFI be become bootable without media to make it boot
42 >> in to that mode to begin with ?
43 > It's actually much easier than it may seem, and it's outlined here:
44 >
45 > https://wiki.gentoo.org/wiki/GRUB2#Alternative:_using_the_default_UEFI_firmware_location
46 >
47 > Basically, for all sorts of removable media there must be a way to tell
48 > UEFI what to boot without having to hardcode the entries into NVRAM (like
49 > efibootmgr does). Therefore UEFI firmware is supposed to check for the
50 > first ESP partition on a drive and boot \EFI\boot\bootx64.efi from it.
51 > This also works for harddrives, and since you can access a FAT partition
52 > even when booted in bios mode you just put grub there.
53 >
54 > Now this works perfectly well for a linux kernel with efi stub and cmdline
55 > built-in, but grub may have trouble finding it's configuration files, I do
56 > not know. So I suggest you try it. Find grubx64.efi in /boot/efi and copy
57 > it to /boot/efi/EFI/BOOT/BOOTX64.EFI. Voila, should boot just fine.
58 >
59 > On my first UEFI install I did not know about this, efibootmgr did not
60 > work, but the handbook says to place the kernel at /EFI/boot/bootx64.efi
61 > and it just magically worked.
62 >
63 > Generally you will find that provided the UEFI implementation of your
64 > vendor is not complete shit (lots of them exist) UEFI makes it generally
65 > easier to handle booting. One partition and the EFI variables and you can
66 > boot anything, no more hidden sectors.
67
68 Ok, thnks for your help, all was checked out as you said, the boot
69 partition was correct, boot, esp which was a good thing.
70
71
72 Just found a slight problem, my .efi program that the system was
73 trying to boot was /boot/efi/EFI/gentoo/grubx64.efi
74
75 copying the .efi to /boot/efi/EFI/BOOT changed nothing, I filed to
76 notice that the name was incorrect, as installing the UEFI with the
77 bootloader (without the efivar loaded) resulted in a file named
78 "grubx86.efi" which doesn't work when copied in to the BOOT directory :(
79
80 Renaming this file -> mv grubx86.efi bootx86.efi
81
82 System now happily boots in UEFI mode, I guess I didn't read "Find
83 grubx64.efi in /boot/efi and copy it to /boot/efi/EFI/BOOT/BOOTX64.EFI"
84 correctly :P
85
86 during this time, the original sda drive I was using failed (SMART
87 was reporting that I should replace it soon) and I guess it was slightly
88 too soon, but I did have the chance to rsync the filesystem across :P
89
90 Thanks heaps for your help :)
91
92 --
93 ---
94
95 Regards,
96
97 Rod Smart
98 0417 513 286