Reinstalling WSL Distributions

🐧Part of the WSL Complete Guide, every Windows Subsystem for Linux post on this site, organised by task.

This guide walks you through reinstalling a WSL (Windows Subsystem for Linux) distribution via command line. This can be useful if you want to reset your WSL environment for a fresh start.

Before proceeding, ensure you back up any important work to Git or another storage solution.

1. List Installed WSL Distributions

To see the names of installed WSL distributions, run:

wsl -l
List installed WSL distributions

This command displays a list of available WSL distros on your system, which you’ll need for uninstallation.

2. Uninstall or Unregister a WSL Distro

Caution: Unregistering a WSL distribution will permanently delete all its data, settings, and software. Reinstalling the distribution from the store will provide a clean instance.

To unregister (uninstall) a specific distribution, replace <distro-name> with the name of your distro:

wsl --unregister <distro-name>
List Installed Windows Subsystem for Linux Distros
Unregister WSL Distro

3. Reinstalling a WSL Distribution

To reinstall Ubuntu (or any other distro) on WSL:

Via Command Line:
Download and install the distribution using its .exe file.
Run the command and follow the prompts to enter a new username and password.

Example for Ubuntu installation:

install Ubuntu WSL

Via Microsoft Store:
Search for and install your desired Linux distribution.

If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for SQL Server?

This site started as a SQL Server blog in 2017 and the archive is still here. The new SQL Server writing, and all the scripts, moved to a site of their own.

sqldba.blogScripts, error library, wait types, SSMS
Browse by topic