Skip to content

Uninstalling a Linux Distribution from Windows Subsystem for Linux (WSL) Comprehensively

Uninstalling a Linux distribution within WSL involves a few steps, and here's a guide on how to accomplish it.

Guide for Completely Uninstalling a Linux Distribution from the Windows Subsystem for Linux (WSL)
Guide for Completely Uninstalling a Linux Distribution from the Windows Subsystem for Linux (WSL)

Uninstalling a Linux Distribution from Windows Subsystem for Linux (WSL) Comprehensively

For users who frequently switch between different Linux distributions in WSL or those who wish to completely uninstall WSL, it's essential to understand the process of removing a Linux distribution and its associated file system from Windows.

Unregistering or Uninstalling the Linux Distribution

To remove a Linux distribution from WSL and delete all its associated files, follow these steps:

  1. Listing Installed Distros:

Open PowerShell as Administrator and run the command to view a list of all installed Linux distributions.

  1. Unregistering the Distro:

Select the Linux distribution you wish to remove from the list, and run the command . Replace with the exact name of the Linux distribution, ensuring the command is case-sensitive. This command deletes the distro and all its WSL-associated files, including the file system [1][5].

Alternatively, you can uninstall the Linux distribution app via Windows Settings:

  • Open Settings > Apps > Installed Apps.
  • Find your Linux distro (e.g., Ubuntu).
  • Click the three-dot menu and select Uninstall.

Removing WSL Components (Optional, if you want to uninstall WSL completely)

If you wish to uninstall WSL completely, follow these additional steps:

  1. Disabling WSL and Related Windows Features:
  2. Open Control Panel > Programs > Turn Windows features on or off.
  3. Uncheck:
    • Windows Subsystem for Linux
    • Virtual Machine Platform (used by WSL 2)
    • Windows Hypervisor Platform (optional)
  4. Click OK and reboot your system [5].
  5. Removing the WSL App Package:
  6. Open PowerShell as Administrator and run the command .
  7. This command removes the WSL app package from the system [3].

These steps ensure both the Linux distribution and its associated file system stored by WSL are fully removed from Windows.

Note: It's crucial to unregister or uninstall the Linux distribution app first, followed by removing the file system in the terminal, to completely remove a Linux distro from WSL [1][3][5].

[1]: Frequent changes to WSL installations may benefit from a backup process. [2]: Unlike a traditional virtual machine, WSL interacts directly with the Windows installation and can be easily reset if issues arise. [3]: Entering in the terminal unregisters the specified Linux distribution from WSL, destroying all traces of its file system and data. [4]: WSL can access the existing Windows file system and be used as the backend for the Windows version of VS Code. [5]: The unregister process may not always remove associated file systems, so it's recommended to check File Explorer for any leftovers. [6]: Removing a Linux distro from WSL through the Microsoft Store or winget in the terminal only uninstalls the app, leaving data and the file system behind.

Read also:

Latest