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.
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.
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.
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
Hello,
Thank you for taking the time to post this, but if my computer is able to successfully boot into Windows 10 is it necessary to delete the GRUB files? When the boot in the bios is set to UEFI my computer has no problem booting Windows, I only run into problems if I set my computer to Legacy mode.
Thank you for your response!
They don’t take up that much space, so you don’t have to delete them. Deleting them is just a way of tidying up.
Thank you! The rmdir /s command is working on windows 8 as well as 10.
You’re welcome.
Hi !
I have installed Ubuntu 16.04 over Windows 10, But after installation pc directly boots into Ubuntu skipping GRUB menu.
So I mounted EFI partition from Ubuntu and found that all the files are messed as grub from previous Phoenix OS installation also must exist there.
Additionally before current Win10 installation , I had attempted successful MBR to GPT conversation of my HDD at expense of broken OS. At that time , as I remember , the Windows Recovery Menu files were created in EFI partitions(I got this when I read EFI partition from ubuntu live cd.)
So now my problem is 2 fold .
I want to clear all the junk files from efi.
and I want to remove Windows Recovery Menu files and its option from Windows Boot Manager menu.
I can boot in both OS by choosing from UEFI boot order at each boot.
I really want to clear all this all mess.
Can’t I just extract & copy required EFI files from both corresponding OS.iso files ?
If YES , how to do that ?
Which files to copy ?
Thanks for Patience to read such a long question and looking forword for help 🙂
If you can boot into Ubuntu, you don’t have to mount anything or copy any EFI files. Just cd into the /boot partition, and form there, you can delete the older folders from other Linux distributions. Just don’t delete your Windows 10 folder.
All what you need to do are detailed in this How to keep your Boot EFI partition clean of old Linux bootloader folders
Actually, first i removed the ubuntu partitions and then i used aomei partition assistant to fix mbr. But when i reboot my pc , grub open.Somehow i was able to log in to windows and i followed your steps. But after the rmdir command, it shows “The system cannot find the file specified”.
Could you help me?
If you’re working on a UEFI system like this, MBR does not come into play.
Maybe the file has been deleted by aomei, which you really didn’t have to use.
Where you planning on installing another Linux distribution?
Hey I am trying to remove the ubuntu grub. I followed all your steps till rmdir /S ubuntu
but this gave me the error “The system cannot find the file specified”.
Can you please help me out?
Are you operating from the right directory?
I was doing it from the right directory. I rebooted and did it again. It worked the second time. Thank you very much for your post. It saved me at least couple of hours. I was going crazy.
You’re very welcome. Happy New Year.
I made it all the way until the “ls” command. From there it says “‘ls’ is not recognized as an internal or external command, operable program or batch file.” This is causing me to have a Minimal-Bash error when I start up my computer. Any advice?
Users that encountered that error used the dir command instead. Give it a shot.
I had deleted the ubuntu partition on a dual-boot system (Windows 10 was the original operating system) and couldn’t get rid of the GRUB showing up at each start-up or when calling back the system from sleep modus. Now it is fixed thanks to your valuable contribution! Thanks again! Fairly direct and simple 😉 :* :* :*
Glad it worked out for you.
How do you un-assign the D drive??
Thanks, this help a lot!
To echo the setiments of others: ‘I love you too!’
Thank you! As others have mentioned had to replace ls with dir but then all good. I had removed an unsuccessful install of Android but didn’t know how to get rid of grub.
As posted before, had to change ls to dir, but in the end all is good now. THANKS!!
I had created a new drive named U, and had followed all your steps. Thanks to you, it worked perfectly! 😀
Now, how do I remove the new drive U created? Is it safe to format the U drive? Or will it affect my EFI of Windows?
Did you create a new drive or a new drive letter?
A new drive letter U. But it does get displayed in My Computer right, with a separate allocated memory of 256MB. How do I deallocate this memory?
Can I just ‘remove letter=U’? Or format it? Will it affect my boot EFI, even it it is just a drive letter?
Unassign the drive letter.
I Love YOU! thanks for the post ;*
Just tried this, sadly it didn’t work. Although everything looked as if it worked, I go into my bios and I still see the ubuntu partition. I believe it’s what’s causing my live USB’s to go wrong as it’s using the GRUB instead of the loader on the USB.
This really worked well! Had to do the dir instead of ls but all else was quick and simple.
Thanks for the feedback.
Thanks! Unlike the procedure of restoring the MBR, this worked when I was having trouble booting Windows 10 after deleting a dual-boot Ubuntu-partition.