How to Completely Uninstall WSL on Windows

This guide provides a detailed, step-by-step process to completely uninstall WSL from your Windows system, ensuring no residual files or configurations remain.

Bertie Atkinson

Windows Subsystem for Linux (WSL) has become a powerful tool for developers and IT professionals, enabling seamless integration of Linux environments within Windows. However, there may come a time when you need to uninstall WSL, whether for system cleanup, troubleshooting, or transitioning to a different development environment.

Understanding Windows Subsystem for Linux (WSL)

WSL allows users to run a GNU/Linux environment directly on Windows, without the overhead of a traditional virtual machine. It supports various Linux distributions, such as Ubuntu, Debian, and Kali Linux, and is widely used for development, testing, and system administration tasks. While WSL offers significant advantages, there are scenarios where its removal becomes necessary, such as freeing up system resources or resolving compatibility issues.

Before proceeding with the uninstallation, it’s essential to understand that WSL consists of two main components: the WSL feature itself and the installed Linux distributions. Both need to be removed to ensure a complete cleanup.

Step 1: Uninstalling Linux Distributions

The first step in uninstalling WSL is to remove any installed Linux distributions. These distributions are separate from the WSL feature and must be uninstalled individually. Follow these steps:

  • Open the Start Menu and search for Apps & Features.
  • Scroll through the list of installed applications and locate your Linux distribution (e.g., Ubuntu).
  • Click on the distribution and select Uninstall.
  • Follow the on-screen prompts to complete the uninstallation process.

Repeat this process for any additional Linux distributions you may have installed. This ensures that all user data and configurations associated with the distributions are removed.

Step 2: Disabling the WSL Feature

Once the Linux distributions are uninstalled, the next step is to disable the WSL feature. This can be done using the Windows Features dialog or PowerShell. Here’s how:

  • Press Win + R, type optionalfeatures, and press Enter to open the Windows Features dialog.
  • Scroll down and locate Windows Subsystem for Linux.
  • Uncheck the box next to it and click OK.
  • Restart your computer when prompted.

Alternatively, you can use PowerShell to disable WSL. Open PowerShell as an administrator and run the following command:

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

This command disables the WSL feature and prepares your system for the next steps.

Step 3: Removing WSL-Related Files and Folders

Even after uninstalling the distributions and disabling the WSL feature, some residual files and folders may remain. These can take up valuable disk space and potentially cause issues if not removed. To ensure a thorough cleanup, follow these steps:

  • Navigate to C:\Users\YourUsername\AppData\Local\Packages.
  • Look for folders related to your Linux distributions (e.g., CanonicalGroupLimited.UbuntuonWindows_…).
  • Delete these folders to remove any remaining files.
  • Additionally, check C:\Users\YourUsername for any hidden .wsl or .wslconfig files and delete them.

This step ensures that all traces of WSL are removed from your system.

Step 4: Cleaning Up the Windows Registry

The Windows Registry may contain entries related to WSL and its distributions. While editing the registry can be risky, removing these entries can help ensure a complete uninstallation. Proceed with caution and follow these steps:

  • Press Win + R, type regedit, and press Enter to open the Registry Editor.
  • Navigate to HKEY_CURRENT_USER\Software and look for keys related to your Linux distributions.
  • Delete any relevant keys, but avoid removing unrelated entries.
  • Repeat the process for HKEY_LOCAL_MACHINE\Software.

If you’re unsure about a specific entry, it’s best to leave it untouched to avoid potential system issues.

Step 5: Verifying the Uninstallation

After completing the above steps, it’s important to verify that WSL has been completely uninstalled. To do this, open PowerShell or Command Prompt and run the following command:

wsl --list

If WSL has been successfully uninstalled, this command should return an error or indicate that no distributions are installed. Additionally, check your system for any remaining WSL-related files or processes.

Step 6: Reinstalling WSL (Optional)

If you decide to reinstall WSL in the future, the process is straightforward. Simply enable the WSL feature again and install your preferred Linux distribution from the Microsoft Store. This flexibility is one of the key advantages of WSL, allowing you to integrate Linux environments into your Windows workflow as needed.

Share This Article