Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub boot entries for UEFI disappear.
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
Kresp
Tux's lil' helper
Tux's lil' helper


Joined: 17 Oct 2016
Posts: 77

PostPosted: Tue May 16, 2017 4:58 am    Post subject: grub boot entries for UEFI disappear. Reply with quote

Every time I replug my boot M.2 NVMe drive or update BIOS, grub boot entry disappears, so I have to boot live dvd, chroot, and execute grub-install --efi-directory=/boot/efi again.
What might be the problem? Why this might occur in the first place? Does this entry gets stored somewhere in bios's data instead of on boot drive, so that motherboard wipes it on HW change?
Win7 UEFI installation on similar M.2 drive does not have this problem. Neither do UEFI boot options for livedvd medium disappear (dd'd to USB or SATA devices).
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2678

PostPosted: Tue May 16, 2017 5:14 am    Post subject: Reply with quote

Quote:
Why this might occur in the first place?
I'll answer this and I think it will answer all your questions. EFI works by storing a directory on the motherboard of bootable kernels/media/whatever. The default location is \EFI\boot\bootx64.efi and take one guess what Windows calls itself. When you add grub, your kenerel, etc. to the variables it will give you the option to try and boot the new path. The order in which it tries can be changed so grub/your kernel will be tried first and then fall back to windows then to your live CD or whatever. There is no boot data stored to disk. Just kernels waiting to be executed.

What appears to happen is that when you change your hardware your particular implementation says to itself "Well, my system changed and all this old data is obsolete. I better go back to the default." I doubt you can change this.

Quote:
Win7 UEFI installation on similar M.2 drive does not have this problem. Neither do UEFI boot options for livedvd medium disappear (dd'd to USB or SATA devices).
This actually makes perfect sense. These options are what the EFI programmers expected to exist and default to.

I hope this helps.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


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

PostPosted: Tue May 16, 2017 6:40 pm    Post subject: Reply with quote

Thats by design. that uefi removes obsolete bindings


I do the same to rebind those uefi settings.
Happens when i swap discs after a backup.
Uefi randomly forgets the mappings, happens once a year.

--

Microsoft has its fingers in the UEFI thing. So they have some way to rebind those settings, even when you just plug in a harddrive which was months ago in my laptop, and which has windows 10 on it. It just boots.

--

There are always boot entries in lets say, the last tab of uefi, for live medium. like android usb phone, worm media

--

Workaround for myself is to keep a piece of paper around with what to type. so i have just to type that command line, and a live worm media.

--

I wish the grub guys could implement the same feature as windows does, to reconfigure the uefi thing after you put the disc back into the computer
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 318

PostPosted: Tue May 16, 2017 8:08 pm    Post subject: Reply with quote

If you have a hard drive which is always connected with an ESP system partition then you should be able to set things up so that the boot options are always available.

In my case I have a few internal hard drives and a few external hard drives - one of which I boot from occasionally. When I installed grub on the external hard drive ESP system partition it would only appear for as long as the external hard drive was connected. I copied grub to an internal hard drive ESP which I always keep connected.

Example output of efibootmgr -v below, sde is the external hard drive in my case ... luks encrypted ... with secure boot enabled as well ;)
Code:
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001,0002,0003,0004,0005,0006,0007,0008
Boot0000* Gentoo Grub (/dev/sda1)       HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\Custom_boot\grubx64.efi_gentoo_sda1.signed)
Boot0001* Gentoo Grub (/dev/sda8)       HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\Custom_boot\grubx64.efi_gentoo_sda8.signed)
Boot0002* Gentoo hardened direct boot (/dev/sda1)       HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\Custom_boot\bootx64.efi.signed)
Boot0003* Mint Grub (/dev/sda9) HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\Custom_boot\grubx64.efi_mint_sda9.signed)
Boot0004* Gentoo Grub (/dev/sdd1)       HD(1,GPT,883ebefd-8367-4d92-b4a2-aa0a37c55312,0x800,0x200000)/File(\EFI\Custom_boot\grubx64.efi_gentoo_sda1.signed)
Boot0005* Gentoo Grub (/dev/sde1)       HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\Custom_boot\grubx64.efi_gentoo_ext_sda1.signed)
Boot0006* UEFI OS       HD(2,GPT,6b0f87bf-4cfb-4aee-a8de-b496cf224621,0x2800800,0x200000)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0007* UEFI: WDC WD10EARS-00Z5B1     PciRoot(0x0)/Pci(0x11,0x0)/Ata(0,1,0)/HD(1,GPT,076254aa-1495-47b6-864f-408a50f7b53b,0x800,0x200000)AMBO
Boot0008* UEFI: TOSHIBA DT01ACA200      PciRoot(0x0)/Pci(0x11,0x0)/Ata(1,0,0)/HD(1,GPT,9829d088-275f-4c60-aaf6-ab865eb6cc06,0x800,0x200000)AMBO


Ed: I sometimes make a mess of things disconnecting drives etc so I have a script to recreate entries when I need to, may not be pretty but it works for me 8)
Code:
# boot delay timeout
efi_boot_timeout=1

# efivarfs on /sys/firmware/efi/efivars type efivarfs (ro,nosuid,nodev,noexec,relatime)
# remount efivarfs read/write
mount efivarfs /sys/firmware/efi/efivars -o remount,rw,nosuid,nodev,noexec,relatime 1> /dev/null 2> /dev/null

# erase existing entries
for x in {0..10} ; do efibootmgr -B -b $x 1> /dev/null 2> /dev/null ; done
for x in {A..H} ; do efibootmgr -B -b $x 1> /dev/null 2> /dev/null ; done

### sda2 entries
# internal hard drives
# Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
# Disk identifier: 8C19AB08-8F75-4115-8DED-C1CBAC2642BE
efibootmgr -t $efi_boot_timeout 1> /dev/null 2> /dev/null
efibootmgr -c -L "Gentoo Grub (/dev/sda1)" -p 2 -d /dev/sda -l \\EFI\\Custom_boot\\grubx64.efi_gentoo_sda1.signed 1> /dev/null 2> /dev/null
efibootmgr -c -L "Gentoo Grub (/dev/sda8)" -p 2 -d /dev/sda -l \\EFI\\Custom_boot\\grubx64.efi_gentoo_sda8.signed 1> /dev/null 2> /dev/null
efibootmgr -c -L "Gentoo hardened direct boot (/dev/sda1)" -p 2 -d /dev/sda -l \\EFI\\Custom_boot\\bootx64.efi.signed 1> /dev/null 2> /dev/null
efibootmgr -c -L "Mint Grub (/dev/sda9)" -p 2 -d /dev/sda -l \\EFI\\Custom_boot\\grubx64.efi_mint_sda9.signed 1> /dev/null 2> /dev/null

# Disk /dev/sdd: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
# Disk identifier: 5791E00B-5230-4E3E-B39A-8AA5786F255D
efibootmgr -c -L "Gentoo Grub (/dev/sdd1)" -p 1 -d /dev/sdd -l \\EFI\\Custom_boot\\grubx64.efi_gentoo_sda1.signed 1> /dev/null 2> /dev/null

# external hard drives
# sde

efibootmgr -c -L "Gentoo Grub (/dev/sde1)" -p 2 -d /dev/sda -l \\EFI\\Custom_boot\\grubx64.efi_gentoo_ext_sda1.signed 1> /dev/null 2> /dev/null

echo "efibootmgr -o 0,1,2,3,4,5"
efibootmgr -o 0,1,2,3,4,5

# remount efivarfs read only
mount efivarfs /sys/firmware/efi/efivars -o remount,ro,nosuid,nodev,noexec,relatime 1> /dev/null 2> /dev/null
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