Tuesday, 12 April 2016

How To Remove Ubuntu From A Computer Dual Booting With Windows 10 (UEFI only)

Posted by Gary Newell  |  at  20:58 22 comments

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 -B
You 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 -l
This 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 EFI
sudo mount /dev/sda1 EFI
With the EFI partition mounted you can navigate to it using the following command:

cd EFI
When 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
If I now decided to install another Linux distribution my UEFI menu would undoubtedly be rebuilt with all of those options in it. It is just untidy to leave it this way.

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 menu





















Click 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.

22 comments:

  1. 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"?

    Why would you want to do that other thing?

    ReplyDelete
    Replies
    1. That is one I will be looking into doing

      Delete
    2. I get asked the question about getting Windows back to normal quite a lot.

      Delete
    3. Hello,

      Is 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.

      Delete
  2. 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.

    ReplyDelete
  3. Is this an adequate article on this forum?

    ReplyDelete
    Replies
    1. Not 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.

      Delete
    2. As 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

      Delete
  4. Is there any chance you know how to fix the wifi problem that i have with ubuntu?

    ReplyDelete
    Replies
    1. I am also interested in this

      Delete
    2. Could 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

      Delete
    3. softblocked is set to yes in my case.
      I also have WiFi problem in ubuntu

      Delete
    4. I also have same problem.
      In my case soft blocked is set to yes
      And hard blocked is set to no

      Delete
  5. I had a permission issue when navigating to EFI folded:
    $ bash: cd EFI: permission denied

    But i fixed this issue by granting myself super user permission:
    $ sudo su

    ReplyDelete
  6. sorry if that's a stupid question, but will this work if I'm using the grub bootloader?

    ReplyDelete
  7. Great 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 😕

    ReplyDelete
  8. Gary Newell your article helped me to remove Linux (dual boot).

    ReplyDelete
  9. well there is a mistake in your article .
    sudo efibootmgr -0 1
    here it is not 0. It is o

    ReplyDelete
  10. Hello everyone,
    my 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) ?

    ReplyDelete
  11. If i skip the first part and directly start from booting option what happens?

    ReplyDelete
  12. The windows boot manager in my Ubuntu has index 0000* .
    When I enter sudo efibootmgr -0 0 ,it shows. 0 is invalid option.
    Please tell me how to remove Ubuntu?

    ReplyDelete
  13. 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

Feel free to comment on any of the blog posts. Please try to be constructive.

Offensive messages will be removed as will blatant adverts for misleading products and sites.

Thanks for visiting my blog

    Popular Posts



back to top