Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] UEFI - efibootmgr - not creating a working entry
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
apyh
n00b
n00b


Joined: 17 Mar 2003
Posts: 67
Location: Texas

PostPosted: Tue Sep 06, 2016 4:45 am    Post subject: [SOLVED] UEFI - efibootmgr - not creating a working entry Reply with quote

hey all,

I've got a new system with nvme ssd, I've finally got it booting under UEFI with grub:

Code:

gentoobox ~ # uname -a
Linux gitaroo 4.4.6-gentoo #4 SMP Mon Sep 5 23:15:36 CDT 2016 x86_64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz GenuineIntel GNU/Linux
gentoobox ~ # mount | grep efi
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)


Code:

gentoobox ~ # more /etc/fstab
/dev/nvme0n1p1      /boot          vfat      noauto,noatime   1 2
/dev/nvme0n1p3      /      ext3      noatime      0 1


But I did run into an annoying issue with efibootmgr

Code:

 * sys-boot/efibootmgr

     Mon Sep  5 10:21:27 2016 >>> sys-boot/efibootmgr-0.12
       merge time: 2 seconds.


Ultimately, to get things working, I had to fall back to using the efibootmgr off of a fedora live iso. When I created my grub entry for efi under fedora:

Code:

[root@localhost liveuser]# efibootmgr -v --create --disk /dev/nvme0n1 --part 1 --label "GrubFromFedora" --loader '\EFI\grub2\grubx64.efi'
BootCurrent: 0003
Timeout: 3 seconds
BootOrder: 0001,0003,0000,0002
Boot0000* GentooBootX64_efi     HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0001* GrubFromFedora        HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\grub2\grubx64.efi)
Boot0003* UEFI: PNY USB 2.0 FD 4096, Partition 1        PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x2,0x15e1c,0x2990)..BO


It creates a working entry (Boot0000 was created in Fedora too, following the efibootmgr section in the handbook)

Fedora's efibootmgr also reports version 0.12.

Once i'm in gentoo (thru either of the two aforementioned entries or in my gentoo chroot after UEFI booting into Fedora) and try and make a new entry:

Code:

gentoobox ~ # efibootmgr -v --create --disk /dev/nvme0n1 --part 1 --label "GrubTestGentoo" --loader '\EFI\grub2\grubx64.efi'
BootCurrent: 0001
Timeout: 3 seconds
BootOrder: 0002,0001,0003,0000
Boot0000* GentooBootX64_efi     HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0001* GrubFromFedora        HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\GRUB2\GRUBX64.EFI)
Boot0002* GrubTestGentoo        HD(1,0,00000000000000000000000000000000,0x0,0x0)/File(\EFI\grub2\grubx64.efi)
Boot0003* UEFI: PNY USB 2.0 FD 4096, Partition 1        PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x2,0x15e1c,0x2990)..BO


You can see the GrubTestGentoo is created with HD(1,0,000...) which doesn't work on reboot. And I get a gibberish label in the boot menu (i'm on a ASRock Z170 Pro4s mobo).

Since i was able to manually create bootx64.efi and grubx64.efi entries under fedora, I'm up an running, for now. But it ended up costing me a couple of hours on install and deviation from the handbook (the handbook really needs a UEFI section makeover, as well as nvme notes), since grub-install ultimately uses efibootmgr, I didnt see what was happening until I gave up on grub and the chroot and tried to get only efibootmgr working (https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#Alternative:_Using_efibootmgr)

Did I miss a kernel option somewhere? Or not emerge efibootmgr, grub2 correctly? I had to unmask grub-9999 to get grub to see nvme.

Any help on this would be appreciated!


Last edited by apyh on Fri Sep 09, 2016 4:37 am; edited 1 time in total
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Sep 06, 2016 2:30 pm    Post subject: Reply with quote

Personal opinion:

I used to use the linux mint bootloader for years without even bothering with the gentoo provided grub / grub2 stuff.

The bootloader is not htat important that you need to install it / update it always.

As long as you have a way to apply changes to reflect new kernels and changes to your disk structure you are fine, regardless if you use fedoras bootloader or not.

I never got the gentoo bootloaders working on any of my boxes, regarding old mbr and newer uefi boxes. Because I usually install a binary distro like arch or mint, i use these bootloaders and change the settings manually there.

A bootloader is just a tool to get your box in an useable state. The documentation regarding bootloaders was very bad regarding a year ago (set up date of this box)

Warning: stay away from scripts of mass destruction => grub-install => personal expierence. Linux mint overwrote hole mbr and grub configs without checking for custom lines... Make a backup of those structures and edit it manually. I usually only change the kernel name and the title of the grub2 after a kernel upgrade. Grub2 on uefi here now. Those script makes things only complicated and add a lot of lint which is hardly ever needed. In the initial installation phase you need to figure out which settings are needed anyway, therefor read kernel hints or your bootloader documentation. Wasted efforts to bother with those scripts ... do not work. do not recognize partitions and such (os-prober) ...
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Wed Sep 07, 2016 3:35 pm    Post subject: Reply with quote

efibootmgr still uses legacy interface (cf. Intel weblog) :!: [it's just an observation! Maybe, useless.]
Quote:
The primary reason for keeping the efivars interface around in the Linux kernel is that there are still tools that will only use this interface:
the efibootmgr tool, which is available on all Linux distributions to control the boot order on UEFI systems, still uses this legacy interface.

Best regards, feng.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 523
Location: Germany

PostPosted: Thu Sep 08, 2016 6:30 am    Post subject: Re: UEFI - efibootmgr - not creating a working entry Reply with quote

I don't know if this is the problem, but I see following

apyh wrote:


Code:

gentoobox ~ # more /etc/fstab
/dev/nvme0n1p1      /boot          vfat      noauto,noatime   1 2

Code:

gentoobox ~ # efibootmgr -v --create --disk /dev/nvme0n1 --part 1 --label "GrubTestGentoo" --loader '\EFI\grub2\grubx64.efi'
BootCurrent: 0001
Timeout: 3 seconds
BootOrder: 0002,0001,0003,0000
Boot0000* GentooBootX64_efi     HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0001* GrubFromFedora        HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\GRUB2\GRUBX64.EFI)
Boot0002* GrubTestGentoo        HD(1,0,00000000000000000000000000000000,0x0,0x0)/File(\EFI\grub2\grubx64.efi)
Boot0003* UEFI: PNY USB 2.0 FD 4096, Partition 1        PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x2,0x15e1c,0x2990)..BO



The name of the device in the /etc/fstab and in the command line do not match, the "p1" part is missing at the end.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Thu Sep 08, 2016 7:12 am    Post subject: Reply with quote

The device name is /dev/nvme0n1 and /dev/nvme0n1p1 is the first partition on the device.

efibootmgr (gentoo wiki) wrote:
To create an EFI boot entry, a couple of arguments are passed to efibootmgr:

--create (-c) to create a new entry;
--part (-p) followed by the partition number on which the EFI System Partition is hosted;
--disk (-d) followed by the disk on which the EFI System Partition is hosted;
--label (-L) followed by the label to use as the boot entry;
--loader (-l) followed by the path of the EFI image to boot

In the command line, there is the --part option which gives the partition number on which the EFI System Partition is hosted.
In other words, /dev/nvme0n1p1 is "the same thing" that (code) gentoobox ~ # efibootmgr ... --part 1 ... (/code)

Code:
gentoobox ~ # efibootmgr -v --create --disk /dev/nvme0n1 --part 1 --label "GrubTestGentoo" --loader '\EFI\grub2\grubx64.efi'

So, it seems all right for the command line.
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Thu Sep 08, 2016 9:48 am    Post subject: Reply with quote

I don't see where is the difficulty. The facts seem clear: the GRUB bootloader is loaded by the firmware, then, GRUB loads the operating system.

You installed GRUB with Fedora installation. You have to create a boot entry for Gentoo in the GRUB configuration file.

Why do you want install GRUB once again?

Code:
root # efibootmgr -b 2 -B


Best regards, feng.
Back to top
View user's profile Send private message
apyh
n00b
n00b


Joined: 17 Mar 2003
Posts: 67
Location: Texas

PostPosted: Fri Sep 09, 2016 4:36 am    Post subject: Reply with quote

It was indeed efibootmgr, thanks for the clues and suggestions!

added ~amd64 to my package.keywords for sys-boot/efibootmgr and sys-libs/efivar, that got me efibootmgr 0.13 and now I can create valid entries when booted into gentoo

Code:

# efibootmgr -v --create --disk /dev/nvme0n1 --part 1 --label "GentooEFI" --load '\EFI\grub2\grubx64.efi'
BootCurrent: 0001
Timeout: 3 seconds
BootOrder: 0002,0001,0003,0000
Boot0000* GentooBootX64_efi   HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0001* GrubFromFedora   HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\GRUB2\GRUBX64.EFI)
Boot0003* UEFI: PNY USB 2.0 FD 4096, Partition 1   PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x2,0x15e1c,0x2990)..BO
Boot0002* GentooEFI   HD(1,GPT,98eea2c1-7139-4451-a5da-2619e5caac31,0x800,0x1ff800)/File(\EFI\grub2\grubx64.efi)


@feng:

Yes, like I said, I got up and running, but that was only after pulling my hair out for the first hour or so while in chroot using an efibootmgr that didn't work, and unless you are calling efibootmgr with -v, you're not seeing the full entries it creates, so following the handbook, there's no inkling of warning that this isn't going to work.

Where can I go to submit possible updates changes to this section of the handbook? even if it's just an example of what a valid entry should look like for UEFI (i.e., if you see what looks like an empty entry "00000000", you know something isn't right).

And even tho I ended up in a working state, I wanted to solve this in gentoo as I don't want to have to rely on another distro's iso the next time I updated grub, or the next time I setup a new box. And hopefully, the next person who sets up a similar box (nvme), they'll find this post and know what to do. =)
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Fri Sep 09, 2016 7:43 am    Post subject: Reply with quote

The Handbook can only be edited by Gentoo developers or trusted contributors (ref. Gentoo Documentation Project).
You can request a change by sending a bug report (see Bugzilla guide).

However, I'm not sure the handbook is the appropriate place because there are many things to explain about UEFI technology.
How do we know what is the more important?

I don't know if the thread will be helpful. You gave one problem solving. You updated GRUB and efibootmgr to latest versions but
we don't know why this has solved the problem. We need to seek and maybe we will understand.
However, the thread is useful because you, and others, give informations.

Best regards, feng.
Back to top
View user's profile Send private message
phil_r
Apprentice
Apprentice


Joined: 14 Mar 2006
Posts: 218
Location: Lincoln, NE, USA

PostPosted: Wed Oct 26, 2016 2:10 pm    Post subject: Reply with quote

For what it's worth, I had the same situation as the OP - Gentoo on a NVMe device and efibootmgr was not updating the UEFI correctly.

After following the tip at the bottom of the thread - using ~amd64 for efibootmgr and efivars - efibootmgr was updating UEFI correctly and Gentoo could boot natively without needing help from another bootloader or live CD.

Just putting that out there for anyone else who's stuck.
_________________
Just when you think you know the answers, I change the questions.

AMD64 Phenom-II 6-core, 440Gb Intel SSD NVMe, 4Tb SATA II, 20576Mb, 1Gb Ethernet, GeForce GTS 950, x64
MacBook, ESX servers, many other toys
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Thu Oct 27, 2016 12:17 pm    Post subject: Reply with quote

phil_r wrote:
For what it's worth, I had the same situation as the OP - Gentoo on a NVMe device and efibootmgr was not updating the UEFI correctly.

After following the tip at the bottom of the thread - using ~amd64 for efibootmgr and efivars - efibootmgr was updating UEFI correctly and Gentoo could boot natively without needing help from another bootloader or live CD.

Just putting that out there for anyone else who's stuck.


Just proofs the fact running stable on newer machine is a bad point. Use ~amd64 instead. I still see guys here with bug reports with antique kernels or software => amd64 / x86
Back to top
View user's profile Send private message
phil_r
Apprentice
Apprentice


Joined: 14 Mar 2006
Posts: 218
Location: Lincoln, NE, USA

PostPosted: Thu Oct 27, 2016 12:55 pm    Post subject: Reply with quote

Roman_Gruber wrote:


Just proofs the fact running stable on newer machine is a bad point. Use ~amd64 instead. I still see guys here with bug reports with antique kernels or software => amd64 / x86


Not really. Using ~amd64 has caused me a ton of problems in the past, so much so I ditched Gentoo for two years and just came back to it. KDE was a nightmare in the past with ~amd64. To be honest I have things working well and really dare not do ~amd64 globally. PLUS the latest nvidia drivers aren't compatible with a kernel =>4.5 so I have to be on 4.4 in order to even run X with nvidia-drivers. So tell me again why I should go unstable?
_________________
Just when you think you know the answers, I change the questions.

AMD64 Phenom-II 6-core, 440Gb Intel SSD NVMe, 4Tb SATA II, 20576Mb, 1Gb Ethernet, GeForce GTS 950, x64
MacBook, ESX servers, many other toys
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