Skip to content

efibootmgr

A practical and in-depth reference for efibootmgr, the Linux utility used to inspect, create, modify, and delete UEFI firmware boot entries. Covers EFI variables, direct kernel booting, PXE/network boot entries, and Gentoo-oriented workflows without relying on a traditional bootloader


# Device Drivers  --->
>   Firmware Drivers  --->
>      [ ] Disable EFI runtime services support by default
>           [*] Network core driver support # Symbol: NET_CORE [=y]

# File systems  --->
>   Pseudo filesystems  --->
>       <*> EFI Variable filesystem
#!/bin/bash

for x in $(efibootmgr -v \
    |grep ^Boot \
    |grep -vi order \
    |cut -f1 -d ' ' \
    cut -f1 -d'*' \
    |sed "s/Boot00//g" \
    |sed "s/^0//g"); do 
	    efibootmgr -b $x -B ; 
done

Getting Started

List all boot options by just enter efibootmgr

efibootmgr 
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0004,0001
Boot0000* \EFI\Gentoo Linux\grubx64.efi PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)/HD(2,GPT,525cbfeb-c4bb-43c9-9070-75931eb00100,0x1000,0x1dc000)/\EFI\Gentoo Linux\grubx64.efi0000000049535048
Boot0001  Seagate Expansion Desk NAABL96K       PciRoot(0x0)/Pci(0x14,0x0)/USB(17,0)4eac0881119f594d850ee21a522c59b21180000049535048
Boot0002* \EFI\BOOT\grub.efi    PciRoot(0x0)/Pci(0x14,0x0)/USB(2,0)/HD(2,MBR,0xdfdd3c1,0x1d1b5970,0x10000)/\EFI\BOOT\grub.efi0000000049535048
Boot0004* USB 3.0 Device USB 3.0 Device 000000004BA8    PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)4eac0881119f594d850ee21a522c59b21180000049535048

Remove the USB-only entry

efibootmgr -b 0002 -B

Remove external disk entry

efibootmgr -b 0001 -B

Configure efibootmgr

This is how I start my gentoo machine if no other functions are needed (then I'm not using grub in this example)

efibootmgr -d /dev/sda -p 2 -c -L "Gentoo Linux" -l /vmlinuz-5.4.97-gentoo-x86_64 -u "cryptdevice=UUID=80bf5e3b-c34f-4917-b7e8-6733909ef5a8:latitude-rootfs root=UUID=80bf5e3b-c34f-4917-b7e8-6733909ef5a8 rw initrd=/initramfs-5.4.97-gentoo-x86_64.img"
efibootmgr -d /dev/sda -p 2 -c -L "Gentoo Linux" -l /vmlinuz-5.4.97-gentoo-x86_64 -u "cryptdevice=UUID=UUID:lvm root=UUID=<real_root_uuid></real_root_uuid> rw initrd=/initramfs-5.4.97-gentoo-x86_64.img

Creating Network Boot Entries

!From the efiboomgr manual - As I have read and simplified for with correct examples

A system administrator wants to create a boot option to network boot (PXE). Unfortunately, this requires knowing a little more information about your system than can be easily found by efibootmgr, so you've got to pass additional information - the ACPI HID and UID values.

These can generally be found by using the EFI Boot Manager (in the EFI environment) to create a network boot entry, then using efibootmgr to print it verbosely.

  • Here's one example:

Boot003* Acpi(PNP0A03,0)/PCI(5|0)/Mac(00D0B7F9F510)` \ `ACPI(a0341d0,0)PCI(0,5)MAC(00d0b7f9f510,0)` In this case, the ACPI HID is `0A0341d0` and the `UID` is `0`
For the zx2000 gigE, the HID is 222F and the UID is 500". For the rx2000 gigE, the HID is 0002 and the UID is 100.

You create the boot entry with: efibootmgr -c -i eth0 -H 222F -U 500 -L netboot

IMPORTANT: Failsafe EFI Setup for HP Elitedesk (One-Time Step`)

mkdir -p /boot/EFI/BOOT
cp /boot/EFI/Gentoo/grubx64.efi /boot/EFI/BOOT/BOOTX64.EFI