Use Linux efibootmgr Command to Manage UEFI Boot Menu

The Linux efibootmgr command line utility is very handy when it comes to managing UEFI boot menu. This tutorial shows you how to use efibootmgr with 5 examples. It’s assumed that you have installed Linux in UEFI mode.

You can install the efibootmgr command line utility with the following commands.

Debian/Ubuntu/Linux Mint

sudo apt install efibootmgr

Fedora, CentOS, RedHat

sudo dnf install efibootmgr

SuSE

sudo zypper install efibootmgr

Arch Linux/Manjaro

sudo pacman -S efibootmgr

1 Displaying Current Settings

Simply run the following command. In some Linux distributions like Debian, you need to run it with sudo privilege.

efibootmgr

This command allows you to view the default boot entry (BootCurrent), boot order and all boot entries.  Each boot entry is identified by a boot number in hexadecimal. The asterisk (*) means the boot entry is active.

linux efibootmgr

You can also add -v option to show verbose information.

efibootmgr -v

You can see the EFI system partition number, the partition table type (GPT), UUID of the EFI system partition and the boot loader file.

efibootmgr-show-verbose-information

The above screenshot shows that my EFI system partition (ESP) is on the 7th partition of my hard disk (/dev/sda7). It’s a GPT partition table.

2. Changing Boot Order

First, copy the current boot order. For example, my boot order is:

0013,0012,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E

Then type in the following command

sudo efibootmgr -o

And append the boot order to the above command.

sudo efibootmgr -o 0013,0012,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E

Let’s say you want 0012 to be the first boot entry. All you have to do is move it to the left of 0013 and press Enter.

sudo efibootmgr -o 0012,0013,0014,0000,0001,0002,0003,000D,0011,0007,0008,0009,000A,000B,000C,000E

3. Adding Boot Entry

If you have installed multiple Linux distributions on your computer, but one of the Linux distribution doesn’t have a UEFI boot entry, you can manually add it.

Boot into the Linux distro that doesn’t have UFEI boot entry.  Then make sure it has the EFI version of GRUB boot loader installed.

Debian/Ubuntu/Linux Mint

sudo apt install grub-efi

Fedora

sudo dnf install grub2-efi-modules

Then mount the EFI system partition (ESP) under /boot/efi/ directory. In this example, /dev/sda7 is the ESP.

sudo mount /dev/sda7 /boot/efi/

Then install Grub boot loader to ESP.

sudo grub-install /dev/sda --target=x86_64-efi --efi-directory=/boot/efi/

x86_64-efi means that we are going to install Grub for UEFI firmware. The default target is i386-pc, which is for traditional BIOS firmware.

Now, you should see a new entry in UEFI boot menu with the bootmgr command.  Under the hood, the Grub installer first installs a .efi booloader file to /boot/efi/EFI/<label>/ directory. Usually it’s named grubx64.efi. Then it runs the following command to add a new entry in UEFI boot menu.

efibootmgr -c -d /dev/sda -p 7 -L <label> -l \EFI\<label>\grubx64.efi

Newly added entry will be the first in boot order.

4. Deleteing Boot Entry

Let’s say you have installed multiple Linux distributions on a hard disk so you have multiple boot entries just like the above screenshot. And now you deleted a Linux distro but the boot entry is still there. To remove the respective boot entry, run:

sudo efibootmgr -b <bootnum> -B

For example,

sudo efibootmgr -b 0014 -B

-b option specify the boot number. -B option delete that boot number.

5. Setting a Boot Entry Active or Inactive

A boot entry followed by asterisk indicates that it’s active. Otherwise it’s inactive. To set a boot entry active, run:

sudo efibootmgr -b <bootnum> -a

To set a boot entry inactive, run:

sudo efibootmgr -b <bootnum> -A

That’s it! I hope this tutorial is helped you master the Linux efibootmgr command. As always, if you found this post useful, then subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page. Thanks for visiting!

Rate this tutorial
[Total: 31 Average: 3.8]

26 Responses to “Use Linux efibootmgr Command to Manage UEFI Boot Menu

  • Thom Mayor
    2 years ago

    I have used been using grub2 for several years now, but until recently only on MBR partitioned drives. I installed 5 linux distros on a VirtualBox VM all with UEFI on GPT partitioned drive and didn’t have too much trouble. One thing is I can’t get the EFI to boot to the grub menu directly, it always boots to the EFI shell first no matter what I try.

  • Douglas
    2 years ago

    Could you help me? I was trying to get delete an obsolete input from Ubuntu on bios through efibootmgr. I ended up deleting the bios / uefi setup from my samsung laptop and I can not recover it. I typed the command sudo efibootmgr -b 0 -B … (0 being the setup) .. any suggestions?

  • In section 4, “Delete Boot Entry,” I need some clarification. Does the -b # option refer to boot order numbering OR the ordinal numbering BELOW the boot order?

    So using your example above, if I want to delete:

    Boot0003 Lenovo Diagnostics

    The boot order # is 7, but it’s ordinal # is 3. Would I do:

    efibootmgr -b 7 -B (boot order)

    OR

    efibootmgr -b 3 -B (ordinal)

  • Thanks for the reply, Xiao. My case is not so straightforward.

    efibootmgr -v output (without the extra drive info):

    BootOrder: 0007,0009,0001,000A,0000,0005
    Boot0000* Windows Boot Manager
    Boot0001* ubuntu
    Boot0005 Windows Boot Manager
    Boot0007* ubuntu
    Boot0009* ubuntu
    Boot000A* Windows Boot Manager

    And the one I want to delete is Boot000A. I’ve tried:
    efibootmgr -b 000A -B
    and
    efibootmgr -b 0006 -B
    but neither worked. Can you advise, please?

      • How does one add the boot entry for Windows into grub for Arch based EFI. Currently grub has Windows entry but cannot find.

        • You need to update the Grub menu from your Linux OS. On Debian/Ubuntu/Linux Mint, run the following command.

          sudo update-grub

          On Arch Linux, run

          sudo grub-mkconfig -o /boot/grub/grub.cfg
      • Hi. I tried efibootmgr -B -b 0006 and it worked out flawlessly. First parameter is to delete; second refers to binary entry.

  • Dieter Pfeuffer
    12 months ago

    To 3. Adding Boot Entry:
    You have to specify the backslashes twice (to mask the backslash):
    efibootmgr -c -d /dev/sda -p 7 -L

    • Dieter Pfeuffer
      12 months ago

      correction (now quoted):

      efibootmgr -c -d /dev/sda -p 7 -L 
      • Dieter Pfeuffer
        12 months ago

        sorry, third try:

        efibootmgr -c -d /dev/sda -p 7 -L \
        • Dieter Pfeuffer
          12 months ago

          I give it up, to post the entire line correctly as a comment here. The commands above are not displayed as I wrote it, regardless my escaping tries.
          Just be aware, that you specify the backslashes twice (to mask the backslashes) when you type the the path after option -l for the efibootmgr command.

        • Morvan
          12 months ago

          Try it via Encode!

  • Hello there, just to let you know, there is a small typo in the instructions for adding an entry:

     efibootmgr -c -d /dev/sda -p 7 -L 

    it should be

  • Very nice article! I had debian installed on a atom board with 32bit efi, cloned the installation to a board with 64bit efi and used this guide – nice. Worked a flaw!

  • Lord_Sarcastic
    10 months ago

    You have no idea how you saved my life…

  • ALEXSANDER MARTINI
    10 months ago

    Thanks a lot, save my life!

  • Kewl ToyZ
    8 months ago

    I’m really having a peculiar issue with mine.
    The output of efibootmgr doesn’t match what I see in the grub version I boot from?

    BootOrder: 0002,0001,0000,0003,0011,0004,0012,0006,0009,000A
    Boot0000* Windows Boot Manager HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS………x…B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}…,…………….
    Boot0001* ubuntu HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\ubuntu\shimx64.efi)
    Boot0002* Nitrux HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\Nitrux\shimx64.efi)
    Boot0003* neon HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\neon\shimx64.efi)
    Boot0004* antiX19 HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\antiX19\grubx64.efi)
    Boot0006 Generic Usb Device VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
    Boot0009 CD/DVD Device VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
    Boot000A UEFI OS VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
    Boot0011* UEFI OS HD(7,GPT,33250818-c513-4c22-8b31-ff030d6403d1,0x11926800,0x47000)/File(\EFI\BOOT\BOOTX64.EFI)
    Boot0012* ubuntu HD(2,GPT,f5b046e2-4afa-48fd-b099-4b72a63b00d8,0x109000,0x32000)/File(\EFI\Ubuntu\grubx64.efi)

    I over wrote the neon partition with Zorin and Nitrux no longer displays in Grub?
    I’m curious how I edit the names of the OS on the partitions too?

  • Hi got a question. After deleting boot entries i shoud update grup right? But what if i use systemd-boot ? Which command should i use? bootctl update ?
    Thank you.

  • Hey there,
    I deleted an entry from boot option by the instruction, but after reboot the option CAME BACK!
    It seems that the extra option belongs to the previous install of the distro.

    please help me remove the option from boot menu.
    thanks.

    • Bumped into the same issue. I had to also remove the relevant folder to keep the EFI entry to come back. See https://askubuntu.com/questions/1042031/how-do-i-remove-windows-from-the-uefi-boot-menu-after-custom-installing-ubuntu/1042032#1042032

  • Hi,
    The efibootmgr showed multiple entries of an OS in my bootorder that I had stopped using. I deleted those, but they occupied the initial string of items in the list. Now, I want to renumber the remaining entries which are Grub (0009), Ubuntu (0008), and MacOs (0080) How can I renumber the bootorder?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.


The maximum upload file size: 2 MB.
You can upload: image.