How to delete GRUB files from a Boot EFI partition in Windows 10

Figure

After several failed attempts to dual-boot Ubuntu 15.04 and Windows 10 on a single hard drive and on a computer with UEFI firmware, and not knowing what caused the first failed attempt, I figured that subsequent failed attempts must have been due to an existing Ubuntu GRUB folder in the Boot EFI folder.

Especially since the machine always froze when the installer is attempting to install GRUB

So I thought that If I could just delete the ubuntu folder from the Boot EFI folder, that the installation would complete – successfully. Ultimately, it didn’t, but I figured out how to delete GRUB files from inside Windows 10, from the command line.

This post documents how it was done. It involved, from the command line, listing and selecting the detected hard drives, listing the partitions on the hard drive, then, finally, listing and deleting the target folder. Another reason you might want to do this, is if you deleted the Linux partitions, which would not automatically delete the GRUB files from the Boot EFI folder.

To start, log into Windows 10, click on the menu and type cmd. Then right-click on the terminal application’s icon and select run as administrator. Figure 1 show the commands (underlined) used to accomplish the first step – listing and selecting the hard drive. To make it possible to copy-and-paste, for those who might need to, I’ve provided the commands in the code block after the last image.

Related Post:  Dual-boot Deepin 2014 and Windows 7 on a PC with UEFI firmware

In this figure, the target disk is shown as a 465 GB hard drive, with GPT partition.

Windows 10 diskpart
Figure 1: Using diskpart to list hard drives detected on Windows 10

After the target disk has been selected, its partitions are listed, so that the partition (volume) that corresponds to the Boot EFI folder can be identified. In Figure 2, that partition is Volume 2. It’s usually the only volume with FAT32 in the Fs (file system) column, and System in the Info column. After it has been identified and selected, you assign it a drive letter to make it easier to work with. In this example, I assigned it a drive letter D. After that, exit diskpart.

Listing Windows 10 partitions
Figure 2: Listing disk partitions on Windows 10

The final task involves changing into the Boot EFI folder, listing its contents to identify what subfolder the GRUB files would be. It will be in the EFI folder. The GRUB files for the distribution that was installed will be under a folder of the same name as the distribution. For example, if Ubuntu was installed, as in this example, the name of the folder will be ubuntu. Delete the folder using the rmdir /s command. That’s the Windows 10 equivalent of the Unix/Linux rm -r command.

Delete Ubuntu Boot EFI GRUB files
Figure 3: Deleting non-empty Ubuntu GRUB directory in Windows 10

All the commands used are given in this code block. Note that this procedure is not necessarily the best or only way to go about do this, so if you know of a better method, post a comment.

## These commands are used to identify and select the hard drive

diskpart

list disk

sel disk 0

## These commands are used to list the partitions, select the Boot EFI partition, 
## then assign it a drive letter

list vol

sel vol 2

assign letter=D:

exit

## These commands are used to change into the Boot EFI folder and delete the GRUB folder

cd /d D:

ls

ls EFI

cd EFI

ls

rmdir /s ubuntu

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Newsletter: Subscribe for updates

Subscribe
Notify of
guest
189 Comments
Inline Feedbacks
View all comments
Harry
Harry
4 days ago

I experienced a similar problem while trying to duel boot Android with my Windows 10, my search found a thread that was borrowed from here (they had a link borrowed from here). the instructions worked great for me, I only changed one thing, I used AOMEI Partition assistant to assign my drive letter prior to running my command prompt then delete it after I was finished.
Thank you for your instructional post that has helped many.

Rill
Rill
10 months ago

Thank you very much (instead of the “ls” command, you really should use “dir”) it really worked. Thanks. Jesus loves you.

PawelG
PawelG
10 months ago

This article resolved my problem! Thanks a lot!

K Kadam
K Kadam
10 months ago

if I do the rmdir /s ubuntu, I get this message:

Remove-Item : A positional parameter cannot be found that accepts argument ‘ubuntu’.
At line:1 char:1
+ rmdir /S ubuntu
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

Harry
Harry
Reply to  K Kadam
4 days ago

in case nobody told you by now, don’t use power shell, use run command in admin mode.

Use dir
Use dir
11 months ago

use “dir” instead of “ls”

Putrid
Putrid
1 year ago

Thanks, I have 2 linux uninstalled in my laptop, which mean, 2 grub bootloader.
Had to “exit” all of those to enter windows, not a big deal indeed. But it feel so stupid.

PandasOnTreadmills
PandasOnTreadmills
1 year ago

It worked!! Thank you so much. Literally no other solutions worked.

Sashwat
Sashwat
1 year ago

Thanks it worked for me. I wanted to remove grub2 got installed with android x86 os. No other method worked so far.
Date- May 13 2020.

John
John
1 year ago

Followed all the steps but only Boot and Microsoft were in my EFI folder.

someone
someone
1 year ago

How is ls working? It’s supposed to be a unix command. It’s not working for me.

someone
someone
Reply to  someone
1 year ago

I meant ls is a unix command.

JohnMJ
JohnMJ
1 year ago

Thanks very much. This worked for me perfectly.

Daksh Sharma
Daksh Sharma
1 year ago

Hey,
I followed all your steps but it didn’t seem to work for me :/
I pressed F2 and all I got was a “Black Screen” and nothing else, not even a white dash.
I was able to enter bios after I updated my bios through the uploaded file given by Acer but I was only able to do it once.
Mind that I was having the problem before the bios update and it was the reason I updated the BIOS

yoshicat
yoshicat
Reply to  finid
9 months ago

nope, it works perfectly on my windows 10

Afrah Rahman
Afrah Rahman
2 years ago

It works! Thanks …

1 6 7 8

Get the latest

On social media

Security distros

Hacker
Linux distros for hacking and pentesting

Crypto mining OS

Bitcoin
Distros for mining bitcoin and other cryptocurrencies

Crypto hardware

MSI GeForce GTX 1070
Installing Nvidia GTX 1070 GPU drivers on Ubuntu

Disk guide

LVM
Beginner's guide to disks & disk partitions in Linux
Categories
Archives
189
0
Hya, what do you think? Please comment.x
()
x
Algorithm 2020

Did you get your ticket yet?

Algorithm 2022 is a 3-day conference on blockchain, cryptocurrencies and AI set for Feb. 10 – 12, 2022, in Dallas. Speakers from the US Air Force, Ministry of Digital Transformation, Ukraine, and more. click that button to learn more and get your ticket. Use BSD20 code for 20% off ticket price.