Partner links

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.

 

NFTs were hot in 2021. They will be even more so this year and beyond. NFT South is a conference where NFT enthusiasts will meet to explore and celebrate the different use cases of NFTs. It’s going to be a fun event. Get your ticket today!

 

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.

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. Note: If the ls command is not available in your shell, use the dir command instead.

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:

Facebook
Twitter
Pinterest
LinkedIn

Partner links

Newsletter: Subscribe for updates

Subscribe
Notify of
guest
199 Comments
Inline Feedbacks
View all comments
Willian
Willian
6 years ago

I can’t remove ‘deepin’ directory;

Got this log

D:\EFI>rmdir /s deepin
deepin, Are you sure (Y/N)? Y
deepin\=0 – “the filename, directory name or volume label syntax is incorrect”
deepin\ – Access denied.
deepin\8ab5.<0 – "the filename, directory name or volume label syntax is incorrect"
deepin\ – Access denied.
deepin\<0 – "the filename, directory name or volume label syntax is incorrect"
deepin\j;68.b5 – "the filename, directory name or volume label syntax is incorrect"
.
.
.
and so on

what can I do to remove it?

my EFI folder: (ls)
Boot Microsoft OEM deepin

HadeesKyu
6 years ago

can i restore the boot when i have done delete it? thanks

Yuga
Yuga
6 years ago

BIG Thanks for you..

ydk2
ydk2
6 years ago

Greate but not ls in Windows is dir command

J.P
J.P
6 years ago

Also from me Thank You very much!!!. People like you and postings like these, make the internet worth spending time.:)

Apfelmusking
Apfelmusking
6 years ago

Thank You so much. This is the first and only solution that actually worked. I’ve tried the different ways before.. thanks!!!

joe
joe
6 years ago

why not use visual bcd

Syed Kaab
Syed Kaab
6 years ago

Getting this message.
H:\>ls
‘ls’ is not recognized as an internal or external command,
operable program or batch file.

Michael
Michael
Reply to  finid
6 years ago

When I use command “dir” (ls would not work) and it says.

B:\>dir
Volume in drive B is System Reserved
Volume Serial Number is C291-F4FD

Directory of B:\

File Not Found

Ray
Ray
6 years ago

You are great. I have been trying to get things working for 2 days and going crazy. Using Win 10 install disk to repair and reinstall and a bunch of other stuff. Your directions are the only thing that worked, thank you!!!

TM
TM
6 years ago

Perhaps change the instruction so that you’re not telling people to open “CMD”, because “ls” isn’t valid there. It is an alias in Powershell, so the instructions will work as written in PS.
Otherwise, thanks for the instructions, they helped me clean up a Linux install that was preventing stupid Windows updates from installing

Steve
Steve
6 years ago

Worked as described (apart from using dir instead of ls). Thanks. The final step was to go into the BIOS and remove the Ubuntu boot option which was still there after performing the tasks listed in this article. I was unable to delete it prior to this.

Kim
Kim
6 years ago

Worked like a charm, thank you very much. My pc did not recognise the ls command, but I used DIR instead and all went well.

Joshua Roche
Joshua Roche
6 years ago

THANK YOU!!!!!!!!!!!!!!!!!!!

Knight
Knight
6 years ago

Great post Dude! Whoo…you save my day XD. Thanks for sharing.

Rick
Rick
6 years ago

I have been trying everything for about two weeks to solve this problem that got created when I try to install Ubuntu on a USB drive and forgot to put grub on the USB and instead got install on my local drive. Your instructions were clear and easy to fully and they sole my problem flawlessly. Thanks so much for this post. It saved my laptop. The only thing that I had to do different was to use the DIR command instead of the LS one since LS was not recognized by my computer. Which I learned from a clarification on the comments and a reply that you posted. So, thanks so much for your help. Have a great one!

1 3 4 5 6 7 9

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

Bash guide

Bash shell terminal
How to set the PATH variable in Bash
Categories
Archives
199
0
Hya, what do you think? Please comment.x
()
x