18
February
2022
Editing the BIOS UEFI boot menu using the efibootmgr utility
17:03

Editing the BIOS UEFI boot menu using the efibootmgr utility

18 February 2022 17:03

Installing Linux or Windows can change the boot menu in the laptop, adding their own items to it, for example, "ubuntu".
If the operating system is removed, this item in the BIOS only gets in the way...

To remove the boot menu item from the EFI BIOS, you need the efibootmgr program!

This efibootmgr program is included by default in most Linux distributions; you do not need to install it.

To check if the program is running, you need to run the program as superuser:

sudo efibootmgr

The command will display a list of menu items from the setup UEFI BIOS.

There is only one problem that can arise: when booting from an MBR-partitioned hard drive, the operating system will not be able to access the EFI menu; there will be an error message: "EFI variables not supported on this system".

In this case, there is a solution: you need to restart your computer and boot from a Linux flash drive with GPT (UEFI) markup also in UEFI mode by selecting the Setup "Boot override" menu item.

Then connect to Wi-Fi and in the temporary runtime Live CD program in the terminal command to install efibootmgr:

sudo apt-get install efibootmgr

then

sudo efibootmgr

On the laptop, the program displayed the following text:

BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0001,0003,0000
Boot0000 ubuntu
Boot0001* Hard Drive
Boot0003* UEFI: USB

As you can see, the menu item with the inscription "ubuntu" under number 0000 - this should be deleted.

Removing the UEFI BIOS menu item is done with the command sudo efibootmgr -b 0000 -B,
where 0000 is the number of the "ubuntu" menu item in this case.

I deleted a menu item:

sudo efibootmgr -b 0000 -B

BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0001,0003
Boot0001* Hard Drive
Boot0003* UEFI: USB

As can be seen from the program output, the deletion of item number 0000 was completed successfully.

After rebooting into the BIOS, EFI found confirmation of this - the “ubuntu” item disappeared from the menu.
after

Other features of the efibootmgr program are described at the link:

*https://www.linuxbabe.com/ ... efibootmgr-examples

For example, using the efibootmgr utility, you can add items to the EFI BIOS boot menu or change the boot order.
I was only interested in removing the extra item.

The command syntax to delete an EFI menu item is:

sudo efibootmgr -b <num> -B

where is a number corresponding to the boot menu item that the efibootmgr utility displays when called without parameters.

The command syntax to change the EFI BIOS boot order or to select the first boot item (default):

sudo efibootmgr -o 0003,0001,0004,0000

In this example, item 0003 will be the first, 0001 second, 0004 third and 0000 fourth in the UEFI BIOS menu.



Related publications