Introduction
If you have installed Ubuntu alongside Windows 10 and you want to remove it so that Windows 10 is left on its own again follow these steps.
These steps only work for computers where Windows 10 and Ubuntu have been installed on a computer with a UEFI bootloader.
A separate guide will be created for computers with a standard bios.
The steps required for getting Windows back to normal are as follows:
- Change the boot order
- Delete Ubuntu From The UEFI boot menu
- Remove Ubuntu Folder From EFI partition
- Delete the Ubuntu partition
- Expand Windows 10 into free space
Change The Boot Order
Boot into Ubuntu and open a terminal window (either press CTRL, ALT and T at the same time or press the super key and type term until an icon appears and click on it).
Within the terminal window type the following:
sudo efibootmgr
This will show you the current boot order and in theory Ubuntu will be first and Windows second.
My boot order has a few extra ones because I have been a little bit untidy and not deleted old entries. As you can see though it starts at 0004 which is ubuntu and then goes to 0001 which is Windows, 0000 which in theory is Fedora, 0008 which is CentOS, 0005 which is another ubuntu, 0006 which is yet another ubuntu, finally finishing with 2001 which is a USB drive.
Now I don't really have loads of Ubuntus, Fedora and CentOS installed. These are old entries. The important bits are 0004 which really is Ubuntu and 0001 which is Windows.
What you need to do is make Windows the first item in the list again.
Run the following command picking the number which matches Windows Boot Loader:
sudo efibootmgr -0 1
As you can see in my list 0001 is Windows. You can add extra entries if you so wish but this should suffice to make Windows first.
On its own this doesn't delete Ubuntu but it stops it from booting.
Delete Ubuntu From The UEFI Menu
In the previous section you will have noticed from the screenshots that I had a lot of old menu items hanging around.To delete a menu option you specify the following command:
sudo efibootmgr -b 8 -BYou need to replace the 8 with the number of the menu item you wish to remove. If you look at the image above boot0008 is for CentOS Linux. After running the above command the CentOS has been removed.
The -b switch stands for modify boot number and the -B stands for delete bootnum.
You can specify the same command in the following way:
sudo efibootmgr --bootnum 8 --delete-bootnum
Remove Ubuntu From The EFI Partition
If you don't remove Ubuntu from the EFI partition then it may be added back to the UEFI boot menu when you add other Linux operating systems.The steps required here are to work out which partition is the EFI partition, mount it, navigate to it and then delete the Ubuntu folder.
To find out which partition is the EFI partition type the following in a terminal window:
sudo fdisk -lThis lists all the partitions on all the disks attached to your computer.
As you can the EFI partition on my disk is /dev/sda1 as the type shows as EFI system.
I therefore need to mount the EFI partition. I can do this by running the following commands:
mkdir EFIWith the EFI partition mounted you can navigate to it using the following command:
sudo mount /dev/sda1 EFI
cd EFIWhen I ran the ls command against the EFI partition there was a folder called EFI. So I navigated to the EFI folder using the cd EFI command again and ran the ls command once more.
As you can see I have folders for the following distributions:
- Apricity
- centos
- debian
- fedora
- mageia
- ubuntu
To remove each of the folders all I have to do is use the rm command as follows:
sudo rm -R Apricity
In the image above I have removed all of the Linux folders on the computer leaving just the Boot and Microsoft folders.
Delete The Ubuntu Partition
Boot back into Windows 10 and then right click on the start menuClick on the "Disk Management" option in the menu.
As you can see I have highlighted the partition on my computer that currently still has Ubuntu installed on it.
Make sure you choose the correct partition otherwise you may delete something important.
Right click on the partition and choose "Delete Volume".
A message will appear asking whether you are sure you want to delete the selected partition. Click "Yes".
Expand The Windows Partition
You will now have a large area of unallocated disk space. To make that space available again you can extend the windows partition which in most cases is the C: drive.
Right click on the C: drive and choose "Extend Volume".
A wizard will load. Click "Next" to continue.
The maximum amount of available disk space will be automatically selected. Click "Next" to continue.
A summary will appear. Click "Finish".
Summary
Your computer should now be set up as if you had never installed Ubuntu on it in the first place.
Shouldn't this be "How to remove Windows 10 from a computer dual booting with Ubuntu", or possibly "How to replace Ubuntu with Linux Mint on a computer dual booting with Windows 10"?
ReplyDeleteWhy would you want to do that other thing?
That is one I will be looking into doing
DeleteI get asked the question about getting Windows back to normal quite a lot.
DeleteHello,
DeleteIs there a guide to remove Ubuntu from non UEFI BIOS. I followed your blog to install ubuntu from non-UEFI BIOS.
Kindly post a blog for this too.
Great guide. You should also make a guide on how to remove Windows from a dual boot setup (keeping Ubuntu), although I think it would be a lot easier.
ReplyDeleteIs this an adequate article on this forum?
ReplyDeleteNot everybody is going to enjoy Linux and I feel that as the question has been asked a number of times about removing Ubuntu then it is fair to provide the reverse procedure. Besides coming next is a tutorial showing how to dual boot Linux Mint with Windows 10, so I needed to get back to the correct starting point.
DeleteAs for me, this article is exactly what I needed to go ahead and take the plunge into Linux. I've debated for years and I'm finally there - especially now that I know I can go back in the unlikely event I regret it. Installing dual-boot this week. This was my final assurance. Thank you, Gary
DeleteIs there any chance you know how to fix the wifi problem that i have with ubuntu?
ReplyDeleteI am also interested in this
DeleteCould be one of many things. In the first instance open a terminal and type rfkill list all. check to see if any of the wireless lan drivers have soft blocked set to yes or hard blocked set to yes. If you can answer that question and tell me the make of your wifi card I will be able to help further
Deletesoftblocked is set to yes in my case.
DeleteI also have WiFi problem in ubuntu
I also have same problem.
DeleteIn my case soft blocked is set to yes
And hard blocked is set to no
I had a permission issue when navigating to EFI folded:
ReplyDelete$ bash: cd EFI: permission denied
But i fixed this issue by granting myself super user permission:
$ sudo su
sorry if that's a stupid question, but will this work if I'm using the grub bootloader?
ReplyDeleteGreat article! And very timely too as I just installed Ubuntu but now regret not installing Fedora instead. I remember a while back I had to rebuild Windows bootloader after uninstalling Linux but I can't remember why and now I can't remember why I brought that up 😕
ReplyDeleteGary Newell your article helped me to remove Linux (dual boot).
ReplyDeletewell there is a mistake in your article .
ReplyDeletesudo efibootmgr -0 1
here it is not 0. It is o
Hello everyone,
ReplyDeletemy main operating system was windows 7 and there was a ubuntu alongside with windows 7. but when windows 7 was updated to windows 10, the ubuntu did not work properly and did not allow me to get in ubuntu. so now I want to remove ubuntu totally from my pc. Is the method above suitable for my case skipping the first part (directly deleting from boot option) ?
If i skip the first part and directly start from booting option what happens?
ReplyDeleteThe windows boot manager in my Ubuntu has index 0000* .
ReplyDeleteWhen I enter sudo efibootmgr -0 0 ,it shows. 0 is invalid option.
Please tell me how to remove Ubuntu?
Is there a way to do the 3rd step "Remove Ubuntu Folder From EFI partition" from Windows? I am actually trying to install Ubuntu but something seems to have gone wrong, because Ubuntu won't boot. So I want to remove Ubuntu and then try to install again. And I am only able to use Windows (10) on this machine right now.
ReplyDelete