How to remove “Ubuntu”, “CentOS”, etc. in the UEFI (bios) boot menu

To remove annoying menu item from UEFI menu after you isntall and then delete Linux (let’s say Ubuntu) just follow the following step below. Please be very careful in order not to delete you primary (for example, Windows) partition. It is highly advised to create a back-up disk image that you can boot with if something goes wrong.

  1. Load either in you installed Ubuntu or load computer OS from Live Ubuntu CD (USB).
  2. Install efibootmgr:
    sudo apt-get install efibootmgr
  3. Then add to the kernel efi support
sudo modprobe efivars

Then run sudo efibootmgr to check your boot entries. It will return something like this:

sudo efibootmgr
BootCurrent: 0003
Timeout: 2 seconds
BootOrder: 0001,0002,0003
Boot0000* Windows Recovery System
Boot0001* Windows Boot Manager
Boot0002* ubuntu
Boot0003* EFI USB Device

Then delete the option you don’t want from the BootOrder. In this example, Ubuntu is entry number 2. (CAUTION: Before executing the following command make sure you enter the correct Boot entry number):

sudo efibootmgr -b 2 -B

UEFI firmware will restoring the entry into the BootOrder unless you delete respective subdirectory in the EFI partition. So, first identify your EFI partition. Run

sudo fdisk -l

to see the partitions on all attached drives. The EFI partition named “EFI Partition” under the Type column.
Suppose your EFI partition is /dev/sda2, then mount it on an empty folder anywhere.

sudo mkdir /mnt/efipartition
sudo mount /dev/sda2 /mnt/efipartition

Now, please find the Ubuntu directory or any other distro’s name in this partition. It is mostly under EFI/distro_name.

sudo cd /mnt/efipartition
sudo ls -l /mnt/efipartition

Remove that directory and its contents by (PLEASE ENSURE THAT YOU DELETE THE CORRECT DIRECTORY)

sudo rm -r ubuntu%3

This article was written by UzLA