How do I remove Windows from the UEFI boot menu after custom installing Ubuntu?
I installed Ubuntu 18.04 using the "Something else..." option on a laptop with a single HDD that came with Windows 10. During installation I deleted all the partitions except the EFI
partition. Then I created a /
root file-system partition and a /home
partition. All went well.
Except now I have an extra Windows entry in the UEFI boot menu that gets picked up by Grub. I can manually edit /etc/default/grub
to hide the now defunct Windows boot option, but I want to get rid of the entry in the EFI system as well. How do I get rid of this final vestigial remnants of Windows?
Find UEFI boot entries
To remove the now useless Windows boot entry in the UEFI, first you need to find it. This can be done directly from the main Ubuntu OS. There is no need to boot from a live USB/DVD. The installed Ubuntu already has the required commandline utility.
Open a terminal by pressing Ctrl+Alt+T and then enter:
sudo efibootmgr
Enter the password when prompted and hit Enter. The cursor won't move and you won't see any asterisks(*****). This is normal in Ubuntu terminal. You will see some output like:
BootCurrent: 0002
Timeout: 2 seconds
BootOrder: 0002,0001,000
Boot0000* Dell
Boot0001* Windows Boot Manager
Boot0002* ubuntu
Note, I got two entries other than windows, 0
for "Dell" and 1 for "Windows Boot Manager". Since I deleted all the original partitions except EFI, I can no longer boot "Dell" or "Windows Boot Manager." I could delete both 0
and 1
. But for this answer I will show how to delete only the Windows Boot Manager entry.
Note: the entries you want to delete may be different than this example. Use the output you get from your own computer, not the above example, to decide which entries you want to delete.
Delete the obsolete boot entries
Now that you know you want to delete the entry 1
(in this example), In the terminal enter:
sudo efibootmgr -b 1 -B
Note, the 1
in the command above. This command will delete the entry:
Boot0001* Windows Boot Manager
Delete the corresponding folder from the EFI partition
We are almost done. This last step makes sure the UEFI
does not regenerate the entries we just deleted. To do this you have delete a folder corresponding the entry you deleted in the previous steps.
If EFI partition is not mounted:
In some computers the EFI partition may not be mounted by default. If this is the case, find out which one is the EFI partition with this command:
sudo os-prober
and look for the Windows Boot Manager. It may be /dev/sda1
for example. Yours may be different.
Then mount the EFI partition with:
sudo mount /dev/sda1 /boot/efi
End of "If"
Now you find the name and location of the folder to delete. Use the following command to list all the folders in the EFI
subfolder in the partition:
sudo ls /boot/efi/EFI
You will see some output like:
Dell Windows ubuntu
To delete the Windows
(it may be called Microsoft
) folder use the following command:
sudo rm -r /boot/efi/EFI/Windows
To verify that the folder was deleted, use the sudo ls /boot/efi/EFI
command again.
Finally update GRUB to hide the GRUB menu
At this stage when you boot the laptop, GRUB will still show the menu to choose various OSs, even though you have only Ubuntu installed. Edit the file /etc/default/grub
with the following command. You may use any other editor if you want.
sudo nano /etc/default/grub
Make the two lines look like this:
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
If the line GRUB_TIMEOUT_STYLE=hidden
does not exist, add the line as above.
When done, save and exit the editor by Ctrl+X, followed by Y and Enter.
The final step is to update GRUB with the following command:
sudo update-grub
Now the laptop should directly boot Ubuntu without showing the GRUB menu. If you need to get to the recovery mode in the future, then hit Esc while the laptop boots to reveal the GRUB menu.
Reference: This answer is based on How do I remove "Ubuntu" in the bios boot menu? (UEFI)