Windows Subsystem for Linux (WSL) is a powerful feature that allows users to run a Linux environment directly on Windows 11. However, there may be times when you want to completely remove WSL from your system—perhaps to troubleshoot issues, free up space, or switch to a different setup. Uninstalling WSL can be straightforward if you follow the right steps, but it’s important to do it correctly to avoid leftover files or system inconsistencies. This guide walks you through the entire process of uninstalling WSL on Windows 11, ensuring a clean removal and helping you avoid common pitfalls along the way.
What You’ll Need
- Windows 11 PC with administrator privileges
- Optional: Backup of your Linux data or files, if needed
- Basic familiarity with Windows Settings and PowerShell or Command Prompt
Step-by-Step
- Close all WSL instances and Linux distributions: Make sure no Linux terminals or applications are running. You can do this by closing all terminal windows and ensuring no processes are using WSL.
- Open PowerShell as Administrator: Click on the Start menu, type “PowerShell,” right-click on Windows PowerShell, and select “Run as administrator.”
- List installed WSL distributions: To see which Linux distributions are installed, run:
wsl --list --verboseThis displays all distributions and their states.
- Unregister and remove each distribution: For each distribution listed, run:
wsl --unregisterReplace <DistributionName> with the actual names, such as Ubuntu or Debian. This command deletes all associated files and data for that distribution.
- Disable WSL feature in Windows: Still in PowerShell as Administrator, execute:
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxThis turns off the core WSL feature.
- Disable Virtual Machine Platform (if enabled): If you previously enabled the Virtual Machine Platform, disable it as well:
Disable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform - Reboot your system: Restart your computer to apply the changes.
- Optional: Remove remaining WSL files and folders: After reboot, you can manually delete leftover files:
- Navigate to %LOCALAPPDATA%\Packages and delete any folders related to Linux distributions (e.g., CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc).
- Check for and delete WSL-related files in your user profile or other locations if needed.
Common Mistakes
- Not closing all WSL terminals before uninstalling, which can cause errors or incomplete removal.
- Forgetting to restart after disabling features, leading to incomplete uninstallation.
- Unregistering distributions without noting their names, resulting in missed data or confusion.
- Removing files manually without backing up important data, risking data loss.
- Attempting to uninstall WSL via the Microsoft Store—this is not the correct method for WSL itself.
Tips
- Always back up important Linux files before uninstalling, especially if you plan to reinstall later.
- Use the command line for uninstallation to ensure all components are properly removed.
- If you plan to reinstall WSL later, consider noting your current configuration or exporting your distributions.
- Verify that the features are disabled by going to Windows Features and checking that “Windows Subsystem for Linux” and “Virtual Machine Platform” are unchecked.
- Perform a system restart after disabling features to fully apply the changes.
Troubleshooting
If you encounter issues during uninstallation, such as errors or leftover files, try the following:
- Run PowerShell as Administrator: Ensure you have elevated permissions to disable features and unregister distributions.
- Use the built-in Windows Troubleshooter: Search for “Troubleshoot” in Settings and run the relevant troubleshooter for Windows features.
- Manually delete leftover files: If distributions or files remain, locate and delete them manually, but be cautious to avoid deleting system files.
- Reset or repair Windows features: If features are stuck enabled, consider resetting Windows features or running system repair tools.
- Check for Windows updates: Sometimes, pending updates can interfere with feature changes. Make sure your system is up to date.
Frequently Asked Questions
Does uninstalling WSL delete my Linux files?
Yes, unless you’ve manually backed up your data, uninstalling WSL will remove all Linux files and configurations associated with your distributions.
Can I reinstall WSL later after uninstalling?
Absolutely. You can re-enable WSL through Windows Features or PowerShell and reinstall distributions from the Microsoft Store.
Will uninstalling WSL affect Windows features or other programs?
No, uninstalling WSL only affects the Linux environment and related components. It won’t impact other Windows features or programs.
How do I completely remove all traces of WSL?
Besides disabling features, manually delete leftover files in %LOCALAPPDATA% and your user profile. Be cautious and back up important data first.
Is it safe to disable WSL without uninstalling?
Yes, disabling the feature is safe if you plan to reinstall later. Uninstalling removes all Linux data, so only do it if you no longer need WSL.
What should I do if WSL won’t uninstall?
Try running PowerShell as administrator, restarting your PC, and reattempting the uninstallation steps. If issues persist, seek help from Windows support forums.