From Gentoo Wiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
Deutsch • ‎English • ‎español • ‎italiano • ‎日本語 • ‎한국어 • ‎русский

The efibootmgr application interacts with the UEFI firmware on the system. It is a popular tool for manipulating the EFI settings in order to create and manage boot entries capable of booting Linux (or any other EFI operating system).

The sys-boot/efibootmgr application is not a bootloader. It is a tool that interacts with the EFI firmware of the system, which itself is acting as a bootloader. Using efibootmgr boot entries can be created, reshuffled, edited, and removed.



CONFIG_EFI_VARS support needs to be enabled:

KERNEL Enable EFI variable support
Firmware Drivers  --->
   EFI (Extensible Firmware Interface) Support  --->
       <*> EFI Variable Support via sysfs


The sys-boot/efibootmgr package does not have any USE flags. All that is needed is to install it:

root #emerge --ask sys-boot/efibootmgr


EFI vars

In order to successfully use efibootmgr the EFI variables filesystem must be accessible. This requires that the system has been booted in EFI mode (and not through the firmware's MBR mode) as otherwise the EFI variables themselves cannot be accessed. If the system is in MBR mode, reboot and do what is necessary in order to tell the system firmware to boot in EFI mode. Usually this involved either changing an option in the firmware's settings or selecting an EFI boot entry in the system's boot menu.

When the system is in EFI mode, run the following command to check for the existence of efivarfs:

root #mount | grep efivars
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)

If it is not mounted (it should be mounted through the sysfs init script), it is possible to manually mount it using the following command:

root #mount -t efivarfs efivars /sys/firmware/efi/efivars


In an EFI System Partition (ESP) does not exist one needs to be created, see EFI System Partition


Listing boot entries

To list the current boot entries by using the --verbose (-v) option:

root #efibootmgr -v
BootCurrent: 0002
Timeout: 3 seconds
BootOrder: 0003,0003,0002,0000,0004
Boot0000* CD/DVD Drive  BIOS(3,0,00)
Boot0001* Hard Drive    BIOS(2,0,00)
Boot0002* Gentoo        HD(1,800,61800,6d98f360-cb3e-4727-8fed-5ce0c040365d)File(\EFI\boot\bootx64.efi)
Boot0003* Hard Drive    BIOS(2,0,00)P0: ST1500DM003-9YN16G

Creating a boot entry

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
The path of the EFI image to boot must use \ (backslash) instead of / (forward slash) as path separator.

For instance:

root #efibootmgr -c -d /dev/sda -p 2 -L "Gentoo" -l "\efi\boot\bootx64.efi"

Deleting a boot entry

Before deleting an entry, first figure out what ID the entry has.

To delete the Gentoo entry as shown above (which has Boot0002 as the identifier), ask efibootmgr to delete the entry with id 2, passing the arguments --bootnum (-b) with the identifier, and --delete-bootnum (-B) to delete the entry:

root #efibootmgr -b 2 -B



root #emerge --ask --depclean sys-boot/efibootmgr

See also