How to Uninstall Ubuntu

A few weeks ago, you decided to dive into the world of Linux and install Ubuntu on your PC, but the results were not impressive. You find yourself more comfortable with Windows, and for this reason, you’d like to remove the open-source operating system from your computer to free up some space on your hard drive. Did I guess right? You want to know if I can help you achieve this? Of course, don’t worry.

That said, while my recommendation would be to give Linux a second chance, perhaps trying another distro that might better suit your needs, I will explain how to uninstall Ubuntu whether you have installed the distro in dual boot with Windows or as the only operating system on the PC.

For completeness, I will also explain how to proceed if you have chosen to use Linux on Windows 10/Windows 11 in a semi-native manner and wish to deactivate that feature. In short, by the end of this reading, you should have a clear picture of the situation. Now let’s cut to the chase and get into the heart of the matter. I wish you a good read and good luck with everything!

Table of Contents

Preliminary Operations

Before explaining the steps required to uninstall Ubuntu from your computer, there are some preliminary operations that you need to carry out to ensure everything goes smoothly.

First of all, since uninstalling Ubuntu will delete from the hard disk partition where the operating system is installed, it is advisable to back up your data (unless you have created a specific partition solely for storage).

To do this, you simply need to connect an external hard drive to your computer and transfer your personal files to it using the file manager in Ubuntu, accessible by clicking on the File icon (the one with the folder) found on the Applications Bar on the left.

If you plan to reinstall Windows from scratch on the computer to completely replace the current operating system, you will also need to obtain the Windows installation media along with a valid license key for the chosen edition. If you don’t already have these tools at hand, read the tutorial I wrote on how to create a bootable USB drive for Windows and, if necessary, the guides where I show how to purchase Windows 11 and how to purchase Windows 10.

How to Uninstall Ubuntu from PC: Dual Boot Windows

To remove Ubuntu from a dual-boot PC, you first need to reset the Microsoft boot loader by completely removing GRUB; after that, you can free up the space previously occupied by Linux by deleting the designated partitions. In the first instance, regarding the boot loader reset, you need to determine if Windows (and Ubuntu) is installed in UEFI mode (and partitioned under GPT) or in MBR mode.

To find out, you can operate from either operating system: if you’re in Windows, press the Win+R key combination on your keyboard, type the command diskmgmt.msc in the text field that opens, and hit Enter to access the Disk Management utility.

Now, locate the main disk that hosts the operating systems, right-click on its icon and select the Properties option from the context menu; in the next window, click on the Volumes tab and take a look at what’s listed next to the Partition style entry: if it says GPT, it means the operating systems are installed in UEFI mode; if it says MBR, it indicates that the operating systems follow the old BIOS partitioning scheme.

If you are using Ubuntu, open your computer’s Applications menu, click on the system’s logo found at the bottom left, enter the Utilities folder, and click on the Disks icon; then, select the disk that hosts Ubuntu from the sidebar on the left and check what’s indicated by the Partitioning entry: if it says GUID Partition Table, it means that both operating systems are installed in UEFI mode; otherwise, if it says Master Boot Record or MBR, it means they are installed in BIOS mode.

Based on the result from this step, proceed with the most suitable method from the suggestions below.

Restore UEFI Bootloader

To restore the Windows boot loader on a UEFI system with GPT partitioning, I recommend doing it from within Ubuntu: after booting into Ubuntu, open the Terminal from the Applications screen, enter the command sudo efibootmgr -v | grep Ubuntu and hit the Enter key: if all goes smoothly, after entering the Ubuntu password and hitting Enter again, you should see a text string starting with Boot000X (e.g., Boot0005), indicating the file dedicated to the Ubuntu UEFI bootloader.

If you receive no result, enter the command sudo efibootmgr -v, hit Enter, and if prompted, type the Ubuntu password. Now, you need to locate the line containing the word Ubuntu, preceded by the string Boot000X.

The information you need to pay attention to is the number sequence that appears immediately after the Boot word, which refers to loading GRUB in EFI: in the previous example, it is the character sequence 0005 (zero-zero-zero-five). Be careful: correctly identify the above sequence and remember it well because an error in the following command could completely prevent you from booting your computer.

At this point, to remove GRUB, you must enter the command sudo efiboomgr -b 000X -B, being careful to replace 000X with the numerical sequence seen earlier: once you are sure you’ve entered the command correctly, hit the Enter key on your keyboard, type the Ubuntu password, and hit Enter again.

Now, all that’s left is to restart the computer in the usual way (just click on the shutdown symbol in the upper right corner twice, and then press the Restart option) and the job is done: if all goes well, on the next boot, you should immediately see the Windows welcome screen, indicating that GRUB has been completely removed.

Restore BIOS Bootloader

If you are using a PC with MBR partitioning on a BIOS system, I recommend acting from Windows: so boot into the Microsoft operating system, and after logging in, get the EasyBCD software. This software is used to restore the Master Boot Record of Windows, thus overwriting the one managed by GRUB.

To download EasyBCD, go to this website, click the Register button located in the Non-commercial box, and on the next page, click the Download button to download the installation file. Once downloaded, run the obtained file and sequentially click on the Yes, Next, I agree, Next, Install, and Finish buttons to complete the setup and automatically launch the software.

At this point, choose the language to use from the drop-down menu that appears on the screen, click on the Yes and OK buttons (twice), and when you see the program interface, first click on the Edit Boot Menu tab that appears on the side.

Now, ensure that the option Microsoft Windows is present in the list and that the box named Skip Boot Menu is checked; if not, check this last box and press the Save Settings button.

Finally, go to the BCD Path tab, check the box next to Install the Windows BCD bootloader and bootmanager (Vista and later), and click the Write MBR button: after a few seconds, at the bottom left, you should see the message MBR written correctly. Now, just restart your computer and verify that during the next boot, GRUB is not shown, only the Windows welcome screen.

Delete Partitions

After successfully removing GRUB from EFI/MBR and confirming that Windows boots correctly, it’s time to permanently delete the Ubuntu partitions to recover the space previously occupied by the operating system. If you don’t want to install any programs, you can perform this operation through the Disk Management utility, included in all editions of Windows starting from 7.

To proceed, press the Win+R key combination on your keyboard, type the command diskmgmt.msc in the text field that opens, and hit Enter to call up the main program screen; alternatively, open the Start menu, type the words disk management in the search field, and click on the result Create and Format Hard Disk Partitions to access the utility.

In the window that opens, right-click on the box corresponding to the partition where Ubuntu is installed (recommended to identify by size), click on the Delete Volume… option, present in the context menu that opens, and, aware that this operation will delete all data on the partition, press the Yes button to confirm.

Now, repeat the process with the partition used as SWAP, if you created it, and with any other partitions dedicated to Ubuntu (e.g., those marked as mount points root, /user, and so on), if you chose to create them.

After this operation, you should obtain unallocated space, which you can reformat as you see fit (by right-clicking on the corresponding icon and selecting the New Simple Volume… option from the menu that opens), or merge it with one of the contiguous partitions by right-clicking on the name of the partition to be expanded, then the Extend Volume… option from the menu that opens and following the guided procedure provided.

In any case, if you have difficulties deleting the Ubuntu partitions and/or reallocating the free space elsewhere, read my tutorials on how to delete a partition and how to merge a partitioned hard disk.

In Case of Problems

Have you unfortunately deleted the Ubuntu partitions before cleaning out the EFI/MBR area of the computer and now, when you try to boot, you end up with a GRUB text shell and are unable to boot any operating system? In this case, I recommend using a installation media containing the version of Windows you are using, whether it be a USB stick or a CD ROM.

After creating the bootable media (if necessary), connect it to the computer, restart it, and when you see the message inviting you to press any key to boot from USB/CD, do so and wait for the Windows files to load. If you see the GRUB screen again, you need to configure the UEFI/BIOS of your computer for booting from USB or disc, just as I explained in this guide.

In any case, when the Windows screen appears, choose the language, time format, and the keyboard layout to be used, click Next, and click the Repair your computer option located in the lower-left corner.

Now, if you are using Windows 8.1 or earlier, wait for the computer to detect the existing copy of Windows, click on it, click the Next button, and if necessary, enter the password of an administrative account set up on the computer to obtain the necessary privileges. Then click on the Command Prompt entry to access the Windows shell.

If you are using Windows 10 or later, click on Troubleshoot and Command Prompt, and if prompted, enter the password for the administrative account in use.

Now, you need to determine if your Windows copy is installed on an EFI system or on BIOS; to do this, enter the command diskpart, hit Enter, and once the text utility is open, type the command list disk followed by hitting the Enter key. Now, look at the right part of the table that appears: if there’s an asterisk corresponding to GPT next to the Windows disk (which you can recognize by its size), then it is an EFI installation; otherwise, it is a BIOS installation. Then proceed based on the results obtained earlier.

EFI

If it is a Windows with EFI installation, enter the command sel disk X (replacing X with the number associated with the Windows disk), hit Enter, enter the command list vol, and hit Enter again to display the list of volumes/partitions on the disk.

Now, find the volume formatted in FAT32 among the listed items (sometimes marked with the label SYSTEM, exactly 100 MB, and hidden) and enter the command sel vol X, replacing X with the corresponding figure (e.g., 2). At this point, “mount” the volume to make it accessible as a virtual drive, using the command assign letter=L: and pressing the Enter key on the keyboard.

After this, type the command exit and hit Enter to exit diskpart, and type the command L:, again followed by hitting the Enter key, to access the virtual drive created earlier. We are almost there: type the command cd EFI, hit Enter, type the command dir, then press Enter again, and make sure there is a folder named ubuntu. If it’s there, enter the command rd /s ubuntu, followed by pressing Enter to delete it; if asked, hit S on the keyboard and hit Enter to confirm.

Now, close the command prompt window by clicking the X at the top right and click on the Continue button to restart the computer: with a bit of luck, on the next boot, you should directly see the Windows startup screen.

BIOS

If it’s a BIOS system, the steps to take are much simpler: first, type the command exit and hit Enter to exit Diskpart, then enter the four commands listed below, one at a time, each followed by pressing the Enter key on the keyboard.

bootrec /fixmbr
bootrec /fixbootcd
bootrec /scanos
bootrec /rebuildbcd

Finally, close the Command Prompt by clicking the X at the top right and restart the computer: if everything went well, GRUB should have disappeared completely. If you have problems, read the guide where I explain how to restore the Master Boot Record on Windows.

How to Uninstall Ubuntu and Install Windows

If you’re interested in understanding how to uninstall Ubuntu while going on to install Windows in its place, because you had installed the distro as the only operating system on the computer, the steps you need to take are identical to those you would use to install Windows on a new computer, with the only difference being that you need to reformat the Ubuntu partition beforehand.

So, to start, obtain the appropriate installation media for the edition of Windows you want to use, connect it to your computer and configure it for primary boot from USB/DVD, as I explained in this guide. Now, restart your computer, press a key to boot from USB/DVD, and when prompted, set the language of the operating system, the format, currency, and keyboard layout, then click on the Next and Install buttons.

Now, if necessary, enter your product key for your copy of Windows (or click on the option I don’t have a product key to activate Windows later), accept the license agreement, and click Next. At this point, choose to perform a Custom Installation, click on the Ubuntu partition, click on the Drive Options (Advanced) button at the bottom right, and first click on the Delete link, then click the OK button to confirm the operation.

To conclude, ensure that the partition you just formatted is the selected one, click the Next button, and wait for the Windows installation to complete and the device configuration to be executed. Then follow the initial procedure for setting up Microsoft’s operating system, at the end of which you’ll finally be able to use the operating system.

If you need specific step-by-step instructions for your case, refer to the tutorials where I have explained how to install Windows 10, how to perform a clean installation of Windows 11 (even without requirements), how to install Windows 8, and how to install Windows 7. However, remember that the latter two operating systems are now considered obsolete, as they lack security updates and are thus potentially vulnerable.

How to Remove Ubuntu from Windows

Still, if you previously installed Ubuntu on Windows 10/11 using the Windows Subsystem for Linux (WSL), you can remove any trace of the operating system like you would with any other application on your computer. So, open the Windows Settings by clicking on the gear symbol in the Start menu, click on the Apps option and, if using Windows 11, on the Installed apps entry.

Then, click the button corresponding to Ubuntu (on Windows 11) or the Name of Ubuntu (on Windows 10), click on the Uninstall option, and confirm your intention to proceed by clicking the Uninstall button again.

Now, unless you have other Linux distributions you want to keep, you simply need to completely remove WSL from the computer: to do this, open the Start menu, type turn Windows features on or off and click on the first result related to the Control Panel; then, uncheck the box next to Windows Subsystem for Linux and click OK to proceed with the full uninstallation of the component.

How to Uninstall Ubuntu from Virtual Machine

Are you using a virtual machine manager and want to delete all files related to Ubuntu? It’s very simple. Generally, all you need to do is right-click on the Ubuntu virtual machine, select the Delete option from the context menu that opens, and after checking the box for deleting all files and associated virtual disks, click OK.

For example, if you’re using VirtualBox, open the main program screen, shut down the Ubuntu virtual machine (if necessary), and then right-click on the relevant entry; now, select the Remove… option from the context menu that opens, and, aware that this operation will delete all files and virtual hard disks related to Ubuntu (unless they are in use on another virtual machine), click on the Delete all files button, and the job is done.

More Reading

Post navigation