Amazon holiday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Completely Uninstall WSL on Windows

If you’re looking to remove Windows Subsystem for Linux (WSL) entirely from your Windows system—whether to troubleshoot, free up space, or switch to a different setup—this guide walks you through the complete uninstallation process. Removing WSL involves more than just deleting a folder; it requires stopping services, removing features, and cleaning residual data to ensure your system is clean. Before starting, make sure you have administrator rights on your Windows account, as some steps require elevated permissions. Additionally, back up any important data stored within your WSL distributions, since uninstallation will delete all associated files.

What You’ll Need

  • Administrator access to your Windows account
  • Optional: Backup of your WSL data if needed

Step-by-Step

  1. Close all WSL instances and terminal windows. Ensure no WSL terminals or processes are running. You can do this by closing all open WSL windows and checking with Task Manager (Ctrl + Shift + Esc) to end any lingering ‘wsl.exe’ processes.
  2. Unregister and delete all WSL distributions. Open PowerShell as Administrator and run:
    wsl --unregister <DistributionName>

    Replace <DistributionName> with the name of your installed distribution, such as ‘Ubuntu’. To list all installed distributions, use:

    wsl --list --verbose

    This step removes the Linux environment data associated with each distribution.

  3. Disable the Windows Subsystem for Linux feature. In PowerShell (Admin), execute:
    Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    Alternatively, you can disable via the Windows Features dialog:
    – Open Control Panel > Programs > Turn Windows features on or off.
    – Uncheck ‘Windows Subsystem for Linux’.
    – Click OK and restart your computer when prompted.

  4. Remove WSL 2 components if installed. If you installed WSL 2, you should also remove the Virtual Machine Platform feature:
    Disable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

    And disable Hyper-V if it was enabled:

    Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All

    Again, restart your PC after these changes.

  5. Delete residual WSL files and data. Navigate to the local app data folder:
    C:\\\\Users\\\YourUsername\\AppData\\Local\\Packages

    Look for folders related to your Linux distributions (they often start with ‘CanonicalGroupLimited’ or the distribution name). Delete these folders to free up space.

  6. Clean up WSL network interfaces and services. Open Command Prompt or PowerShell and run:
    netsh winsock reset

    This resets network settings that might have been altered by WSL.

  7. Optional: Remove WSL-related registry entries. For advanced users, open the Registry Editor (regedit) and search for entries related to WSL or your distributions. Be cautious and back up the registry before making changes.
  8. Restart your computer. After completing all steps, reboot your system to finalize the removal process.

Common Mistakes

  • Not closing all WSL processes before uninstallation, leading to errors.
  • Forgetting to unregister distributions, which leaves residual data.
  • Disabling only the feature but not deleting associated files, causing incomplete removal.
  • Accidentally removing system-critical features or files—always double-check commands.
  • Not restarting after feature removal, which may cause WSL components to persist.

Tips

  • Use PowerShell with administrator privileges for most commands to avoid permission issues.
  • List all installed distributions before removing to ensure nothing is missed: wsl --list --verbose.
  • Back up important data from WSL before uninstalling, as all Linux files will be deleted.
  • If you plan to reinstall later, note down your current distribution names and configurations.
  • For a cleaner system, consider running a disk cleanup tool after uninstallation.

Troubleshooting

If you encounter issues during uninstallation, such as errors or residual files, try the following solutions:

  • Ensure all WSL processes are closed: Use Task Manager to end any ‘wsl.exe’ or ‘VBoxHeadless.exe’ processes that might be running.
  • Run commands in elevated mode: Always run PowerShell or Command Prompt as Administrator.
  • Reboot after each major step: Sometimes, features or services only disable properly after a restart.
  • Use the Windows Troubleshooter: Search for ‘Troubleshoot’ in Settings, then select ‘Additional troubleshooters’ > ‘Windows Update’ or ‘Programs’ to fix common issues.
  • Check for Windows updates: Installing the latest updates can fix bugs related to feature removal.
  • Manually delete leftover files: If residual folders remain, delete them manually, but be cautious not to remove unrelated system files.

Frequently Asked Questions

Can I uninstall WSL without affecting Windows?
Yes, removing WSL is safe and doesn’t affect the core Windows OS, but it will delete Linux environments and data.
Will uninstalling WSL delete my Linux files?
Yes, all files stored within WSL distributions will be deleted unless you back them up beforehand.
Is it necessary to disable features before deleting files?
Disabling features like WSL and Virtual Machine Platform is recommended to fully remove the components and prevent conflicts.
Can I reinstall WSL later after uninstalling?
Yes, you can reinstall WSL by enabling features and downloading distributions from the Microsoft Store.
What should I do if uninstallation fails?
Try restarting your PC, closing all related processes, and repeating the steps. Use troubleshooting tools if necessary.
Are there any risks in manually editing the registry?
Yes, incorrect changes can harm your system. Only edit the registry if you are experienced and have backed it up.

By following this comprehensive guide, you can thoroughly remove WSL from your Windows system, freeing up space and resolving issues related to the subsystem. Always proceed carefully, especially when editing system files or registry entries, and ensure you have backups of important data before starting the process.

How to Completely Uninstall WSL on Windows
Scroll to top