17

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?

29

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.

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 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)

9
  • 2
    ESP should be already mounted on /boot/efi, I don't see a reason to mount ESP somewhere else. sudo ls /boot/efi/EFI and sudo rm -r /boot/efi/EFI/Windows should do it. – mook765 May 30 '18 at 16:52
  • @mook765 Thanks. I have edited the answer. – user68186 May 30 '18 at 17:04
  • efibootmgr can be buggy with some implementations. On those systems you might have to use bcfg from within a UEFI v2 shell. – Bob May 31 '18 at 0:52
  • @Bob Thanks! Feel free to add another answer using bcfg. I am not familiar with the UEFI shell. – user68186 May 31 '18 at 13:08
  • @user68186 I considered adding an answer but the Arch wiki really explains it better than I ever could, and I no longer have access to a machine I can easily try this on so at best it'd be a summary of the wiki. – Bob May 31 '18 at 13:30
-1

Open Terminal. cd /boot/efi/EFI. Remove Microsoft folder - sudo rm -R Microsoft. You can also remove the Boot folder - sudo rm -R Boot.

To remove Windows entry from grub2, sudo gedit /boot/grub/grub.cfg. Look for menu entry, Windows Boot Manager (or similar name description) and delete lines up to and including closing curly bracket, then save.

Job done. Restart.

4
  • 2
    A few problems with this answer: First, only deleting the folder may not be sufficient. See the comment by @Silversonic to the answer. Second, one should not use sudo directly with graphical programs like gedit as it can mess up user preferences. It is better to use sudo -i first to open a root shell if you want to use gedit with sudo. Third, directly editing grub.cfg is not recommended. It is recommended to edit /etc/default/grub and then sudo update-grub. – user68186 May 30 '18 at 19:19
  • See askubuntu.com/questions/1009574/… for not using sudo gedit and see askubuntu.com/questions/437323/is-it-possible-to-edit-grub-cfg for more on editing grub.cfg. – user68186 May 30 '18 at 19:29
  • It is sufficient. There are no problems with it. It works 100%. I've done this a number of times and it's always worked each time. It makes no difference whether you use sudo -i then gedit, or sudo gedit. The latter does not muck up your user preferences. Where are you getting that from? You can edit grub.cfg with ease if you know what you're doing, and you can back up grub.cfg first if you're not confident. You are being pedantic. If you already know all the answers then why ask the question in the first place??? – Paul Benson May 30 '18 at 20:13
  • @PaulBenson I can't comment on the rest, but asking a question you know the answer to and then self answering is not only allowed but is actively encouraged. – Reinstate Monica May 31 '18 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.