7

Having played with WSL over several releases, I find that I'm getting various strange errors and inconsistencies.

I would like to reset the WSL environment back to defaults - what is the best way?

Julian Knight
  • 14,313
  • 3
  • 27
  • 41

1 Answers1

7

UPDATE 2023-01-06: You can use unregister on WSL v2 as well. You can also reset a distro from the add/remove programmes app.


WSL v1 is made up of 2 parts. WSL itself and the Linux distribution(s) you install.

You can reset any distribution that you have installed by using the following command (from W10 1903):

wsl --unregister <DistributionName>

You can then reinstall the distribution by finding it in the Windows store and clicking on "Launch".

Note that, prior to W10 1903, you need to use the wslconfig.exe - 1903 merges the commands from that into wsl.exe.

If you need to also reset WSL, you will need to uninstall it then reinstall. WSL is a Windows feature so you can add/remove it using the appropriate settings or control panel entry.

References:

Note that WSL v2 has been announced but no details are yet available. It is a totally different architecture to v1 so expect resetting that to be slightly different.

Julian Knight
  • 14,313
  • 3
  • 27
  • 41