TechBuzzPro

Uninstall WSL Windows 11: A Complete Guide

· 5 min read · Windows & PC

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can uninstall WSL on Windows 11. While WSL is a powerful tool for developers, there are times when you might want to remove it. The process involves disabling the optional feature, removing associated distributions, and optionally, removing the virtual hard disk. This guide walks you through each step, covering potential pitfalls and offering troubleshooting advice to ensure a clean uninstall.

What You'll Need

  • Administrator privileges on your Windows 11 computer. You'll need to be logged in as an administrator or have the ability to elevate your privileges.
  • Time and patience. The process can take some time, especially if you have multiple WSL distributions installed.

Step-by-Step

  1. Disable the "Windows Subsystem for Linux" optional feature: This is the primary step to uninstall WSL.
    1. Open the Settings app. You can do this by pressing Windows Key + I, or by searching for "Settings" in the Start menu.
    2. Click on Apps.
    3. Click on Optional features.
    4. In the "Installed features" list, look for Windows Subsystem for Linux. Note: The exact wording might vary slightly depending on your Windows 11 version.
    5. Click on Windows Subsystem for Linux.
    6. Click on the Uninstall button.
    7. Confirm the uninstall when prompted. Windows will remove the core WSL components.
  2. Remove WSL Distributions: Even after disabling the feature, the distributions you’ve installed (like Ubuntu, Debian, etc.) remain on your system. You need to remove these individually.
    1. Open the Microsoft Store app.
    2. Click on the Library icon (usually located in the bottom-left corner).
    3. You'll see a list of installed apps, including your WSL distributions.
    4. For each WSL distribution you want to remove, click on its name.
    5. Click on the Uninstall button.
    6. Confirm the uninstall when prompted.
  3. Remove the Virtual Hard Disk (Optional, but Recommended): WSL uses a virtual hard disk to store the file system for your distributions. Removing this disk frees up space on your system.
    1. Open File Explorer.
    2. In the address bar, type %LOCALAPPDATA%\Packages and press Enter.
    3. You’ll see a list of folders with long, alphanumeric names. These represent the installed applications.
    4. Look for folders that start with MicrosoftCorporationII.Linux.*; followed by a series of characters. These correspond to your WSL distributions. For example, MicrosoftCorporationII.Linux.*;Ubuntu-22.04.
    5. For each distribution folder you want to remove, right-click on it and select Delete. You may need to confirm the deletion. Warning: This permanently deletes the file system and data associated with that distribution. Ensure you have backed up any important files before proceeding.
  4. Disable the WSL Service (Optional): While disabling the feature should stop the service, it's a good practice to confirm.
    1. Press Windows Key + R to open the Run dialog box.
    2. Type services.msc and press Enter.
    3. In the Services window, look for a service named LxssManager.
    4. Right-click on LxssManager and select Properties.
    5. In the Properties window, go to the General tab.
    6. Change the Startup type to Disabled.
    7. Click Apply and then OK.

Common Mistakes

  • Forgetting to remove WSL distributions: Disabling the feature alone doesn’t remove the distributions themselves. You must uninstall them from the Microsoft Store.
  • Not backing up data: Deleting the virtual hard disk permanently removes the file system and data associated with your WSL distributions. Always back up important files before proceeding.
  • Trying to delete the wrong folders: Be careful when deleting folders in the `%LOCALAPPDATA%\Packages\` directory. Deleting the wrong folder could affect other applications.
  • Not having administrator privileges: Some steps, like disabling the feature and removing the virtual hard disk, require administrator privileges.

Tips

  • Create a System Restore Point: Before making any significant changes to your system, create a system restore point. This allows you to revert your system to a previous state if something goes wrong.
  • Double-check folder names: When deleting folders in the `%LOCALAPPDATA%\Packages\` directory, carefully verify that you are deleting the correct folders.
  • Restart your computer: After completing the uninstall process, restart your computer to ensure that all changes are applied.
  • Check Disk Space: After removing the virtual disk, verify that the freed-up space is reflected in your disk properties.

Troubleshooting

  • Error message during uninstall: If you encounter an error message during the uninstall process, try restarting your computer and attempting the uninstall again. If the error persists, check the Windows Event Viewer for more detailed information about the error.
  • WSL distributions still appear in the Microsoft Store: Sometimes, the Microsoft Store may not immediately reflect the uninstallation of WSL distributions. Try restarting the Microsoft Store app or your computer.
  • LxssManager service cannot be stopped: If you are unable to stop the LxssManager service, it may be because another process is using it. Try restarting your computer and attempting to stop the service again.
  • Files still exist after deleting the folder: Some files might remain in the system even after deleting the package folder. This is normal; Windows may keep them for recovery purposes. A disk cleanup utility can help remove these remnants.
  • If that did not work: Ensure the Windows Subsystem for Linux feature is fully disabled in the optional features list. Sometimes a partial disable can cause issues. Try re-enabling and then disabling the feature again, following the steps carefully.

Frequently Asked Questions

What happens to my files when I uninstall WSL?

Uninstalling WSL, particularly deleting the virtual hard disk, permanently removes the file system and data associated with your WSL distributions. Ensure you have backed up any important files before proceeding.

Do I need to uninstall each distribution separately?

Yes, each WSL distribution (Ubuntu, Debian, etc.) needs to be uninstalled individually through the Microsoft Store.

Can I reinstall WSL later if I change my mind?

Yes, you can reinstall WSL later by enabling the "Windows Subsystem for Linux" optional feature in the Settings app.

Will uninstalling WSL affect other applications on my computer?

No, uninstalling WSL should not affect other applications on your computer, as long as you follow the steps carefully and don’t delete any files or folders that belong to other applications.

Is it safe to delete the folders in %LOCALAPPDATA%\Packages?

It is safe to delete the folders related to your WSL distributions in the `%LOCALAPPDATA%\Packages\` directory, but be extremely cautious and verify that you are deleting the correct folders to avoid accidentally deleting data from other applications.