Remove unwanted entry in UEFI BIOS boot menu

If your original OS is installed in UEFI mode, the installation of some other OS (e.g Ubuntu) in UEFI mode later on introduces some artifacts to the EFI partition the hard drive, and due to them, in the UEFI BIOS boot menu you see the respective boot menu entry.

To remove the entry completely, you need to remove the artifacts to the EFI partition, and then move the respective boot entry.

Delete EFI/distro of the EFI partition

Linux

Locate your EFI partition with sudo fdisk -l and find out the partition with EFI Partition under the Type column.

Suppose the EFI partition is /dev/sda2, do the following to mount it on an empty folder.
mkdir /mnt/efipart
mount /dev/sda2 /mnt/efipart

Next find the directory corresponding to the OS that you have installed. It is mostly under EFI/distro_name

Remove that directory and its contents by sudo rm -r EFI/distro_name.

Windows

Start cmd.exe as administrator. Run diskpart in it.

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>diskpart

Microsoft DiskPart version 10.0.14393.0

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: EDDIE-ASUS-N550

DISKPART>

Run list disk to find out the ID of the physical disk that contains the EFI folder. It is usually the hard disk that you have on the PC.
  
DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          931 GB  2048 KB        *
  Disk 1    Online           59 GB  2048 KB

My physical disk is Disk 0. Select that disk using the select disk # command, and then you can list its partitions using list partition. To see the volumes of the system (including other disks that are  NOT selected currently), use list volumes. In the output, you can see the corresponding disk letter if there is any. Here I identify my EFI partition to be volume 3. It is normally a small (~100MB-2GB) FAT32 partition.
 
DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    System             100 MB  1024 KB
  Partition 2    Recovery           900 MB   101 MB
  Partition 3    Reserved           128 MB  1001 MB
  Partition 4    Primary            372 GB  1129 MB
  Partition 5    Recovery           450 MB   373 GB
  Partition 6    Primary            537 GB   373 GB
  Partition 7    Recovery            20 GB   911 GB

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1     C   OS           NTFS   Partition    372 GB  Healthy    Boot
  Volume 2     D   Data         NTFS   Partition    537 GB  Healthy
  Volume 3         SYSTEM       FAT32  Partition    100 MB  Healthy    System
  Volume 4         Recovery     NTFS   Partition    900 MB  Healthy    Hidden
  Volume 5                      NTFS   Partition    450 MB  Healthy    Hidden
  Volume 6         Restore      NTFS   Partition     20 GB  Healthy    Hidden
  Volume 7     F   use-live     FAT32  Removable   2048 MB  Healthy

Select that volume (select volume #), assign a drive letter to it (assign letter=M). Then quite diskpart (quit).

DISKPART> select volume 3

Volume 3 is the selected volume.

DISKPART> assign letter=M

DiskPart successfully assigned the drive letter or mount point.

DISKPART> exit

Leaving DiskPart...

Then you can enter the partition and delete the unwanted EFI/distro_name folder.

C:\WINDOWS\system32>M:

M:\>cd EFI

M:\EFI>dir
Volume in drive M is SYSTEM
Volume Serial Number is 00C4-49D3

Directory of M:\EFI

04/24/2014  12:07 PM              .
04/24/2014  12:07 PM              ..
04/24/2014  12:07 PM              Microsoft
04/24/2014  12:07 PM              Boot
04/24/2014  12:09 PM              ASUS
04/01/2017  11:04 AM              ubuntu
               0 File(s)              0 bytes
               6 Dir(s)      66,727,936 bytes free

M:\EFI>del ubuntu
M:\EFI\ubuntu\*, Are you sure (Y/N)? Y
 
Remove the drive letter assignment afterwards (Renter diskpart, then select volume #. Next remove letter=drive_letter and then exit).
 
M:\EFI>c:

C:\Windows\System32>diskpart

Microsoft DiskPart version 10.0.14393.0

Copyright (C) 1999-2013 Microsoft Corporation.
On computer: EDDIE-ASUS-N550

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> select volume 3

Volume 3 is the selected volume.

DISKPART> remove letter=M

DiskPart successfully removed the drive letter or mount point.

DISKPART> exit

Leaving DiskPart...

C:\Windows\System32>

Remove respective boot menu entry

You may do it through BIOS. Or if you like, you can boot into a Linux live CD and do the following:

Install efibootmgr: sudo apt-get install efibootmgr

Then add to the kernel efi support: sudo modprobe efivars

Next, run sudo efibootmgr to check your boot entries. It shall be like the following:

BootCurrent: 0004
Timeout: 2 seconds
BootOrder: 2001,0003,0005,0006,0000
Boot0000* Lenovo Recovery System
Boot0001* EFI Network 0 for IPv6 (B8-88-E3-84-F3-EF)
Boot0002* EFI Network 0 for IPv4 (B8-88-E3-84-F3-EF)
Boot0003* Windows Boot Manager
Boot0004* EFI USB Device (SanDisk)
Boot0005* ubuntu
Boot2001* EFI USB Device

Suppose "ubuntu" is the entry you wish to delete. It is of entry 5. Use the following command to remove the entry: sudo efibootmgr -b 5 -B

Reference

http://askubuntu.com/questions/63610/how-do-i-remove-ubuntu-in-the-bios-boot-menu-uefi

Comments

Popular posts from this blog

Using PlayStation 1 Densha de Go controller on emulators

Using PS1/PC Densha de Go! controller SLPH-00051/TCPP-20001/DGOC-44U on PS4/Switch Densha de Go!!

Play octoshape stream on windows with VLC player