Guide to efibootmgr for Linux UEFI Boot Entries

This article provides an overview and practical breakdown of the efibootmgr command-line utility in the Linux operating system. It covers the core purpose of the tool, why it is essential for modern system administration, and how it interacts directly with system firmware to manage, create, reorder, and remove UEFI boot variables without needing to access the motherboard's BIOS/UEFI setup interface.

What Is efibootmgr?

The efibootmgr tool is a standard Linux user-space application designed to modify the UEFI (Unified Extensible Firmware Interface) Boot Manager. In traditional BIOS systems, boot priorities were dictated entirely by the hardware configuration or the MBR (Master Boot Record). Under UEFI systems, the motherboard firmware maintains its own non-volatile RAM (NVRAM) containing a list of bootable devices, bootloaders, and kernel binaries.

The primary purpose of efibootmgr is to manipulate these NVRAM variables directly from a running Linux environment by interfacing with the efivarfs (EFI variable filesystem).

Key Functions and Use Cases

1. Inspecting the Boot Configuration

Running efibootmgr without any arguments displays the current UEFI boot entries, the currently booted entry (BootCurrent), the boot order (BootOrder), and any temporary boot selections (BootNext).

Adding the verbose flag (efibootmgr -v) displays the complete disk UUIDs and exact file paths to the .efi executable binaries stored on the EFI System Partition (ESP).

2. Changing the Boot Order

When dual-booting or managing multiple operating systems, firmware updates or installations can alter which OS starts by default. The efibootmgr -o flag allows administrators to change the boot sequence by providing a comma-separated list of boot numbers (e.g., efibootmgr -o 0001,0000,0002), ensuring the preferred operating system boots first.

3. Creating New Boot Entries

When installing a new bootloader (such as GRUB, systemd-boot, or rEFInd) or configuring a Linux kernel with EFISTUB support, a firmware pointer must be created so the motherboard knows where the executable resides.

Using flags such as -c (create), -d (disk), -p (partition), -L (label), and -l (loader path), administrators can register custom boot options directly:

efibootmgr -c -d /dev/nvme0n1 -p 1 -L "Arch Linux" -l "\vmlinuz-linux" -u "root=/dev/nvme0n1p2 rw initrd=\initramfs-linux.img"

4. Deleting Stale or Broken Entries

Uninstalling an operating system or replacing a drive often leaves orphaned entries in the UEFI NVRAM. These dead entries clutter the boot menu and can cause boot delays. efibootmgr can permanently remove these records using the entry identifier combined with the delete flags:

efibootmgr -b 0003 -B

5. Configuring One-Time Boots

The -n (boot next) option specifies a boot entry to run only on the very next system reboot. Once booted, the system reverts to the standard boot order on subsequent restarts. This is particularly useful for remote system updates, kernel testing, or automated maintenance scripts.

6. Activating and Deactivating Entries

Entries can be disabled without removing them entirely from NVRAM. The -A flag deactivates a specific boot record, preventing the firmware from attempting to boot it, while the -a flag reactivates it when needed.

System Requirements

To use efibootmgr effectively: