I've installed Linux Subsystem for Windows on my machine. It works beautifully!

Since then, I've done unspeakable things to my install. Nothing works anymore. How do I start again from scratch?

  • This is no longer the recommended approach. PS C:\IaC> lxrun /uninstall Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution. Distributions can be installed by visiting the Windows Store: aka.ms/wslstore Mar 1, 2018 at 5:24

5 Answers 5


You can reset Ubuntu from settings, just find it in the start menu, right-click to go to App settings, then press the reset button.

find ubuntu in start

reset from settings

  • 13
    Damn.. didn't expect it would be that straightforward! Oct 10, 2019 at 13:07
  • 2
    that ends in: Error code: Wsl/Service/CreateInstance/MountVhd/ERROR_FILE_NOT_FOUND
    – Andre
    Oct 30, 2023 at 16:03

Open Command Prompt (AKA cmd.exe), and type lxrun /uninstall. That should wipe your Ubuntu image.

Once this is done, you can reinstall with lxrun /install.


  • This would have to be run in the Windows cmd.exe shell, right?
    – Byte Commander
    Apr 23, 2016 at 17:37
  • Yup. I've edited to clarify. Apr 23, 2016 at 18:30

With the new distro-specific store apps, for example:

C:\> ubuntu /?
Launches or configures a linux distribution.

    <no args>
      - Launches the distro's default behavior. By default, this launches your default shell.


      - Uninstalls the distro. The appx remains on your machine. This can be
        useful for "factory resetting" your instance. This removes the linux
        filesystem from the disk, but not the app from your PC, so you don't
        need to redownload the entire tar.gz again.

So, ubuntu clean should be enough.

If ubuntu clean fails, then you'll have to uninstall the app from the store and reinstall it. See WSL #2387.

  • The ubuntu clean flag has been removed from the app.
    – James
    Jan 6 at 5:47

After WSL 2 it's simple:

wsl --unregister Your_Ubuntu_distro

How to get distro name?

wsl --list

Per https://docs.microsoft.com/en-us/windows/wsl/basic-commands:

Caution: Once unregistered, all data, settings, and software associated with that distribution will be permanently lost. Reinstalling from the store will install a clean copy of the distribution. For example, wsl --unregister Ubuntu would remove Ubuntu from the distributions available in WSL. Running wsl --list will reveal that it is no longer listed.

You may want to backup your home directory and other data prior to unregistering the distro.

  • Only this solution worked for me.
    – steph643
    Oct 12, 2023 at 7:39

launch -> cmd /d

ubuntu config --default-user root

launch -> C:\Windows\System32\bash

passwd your_username set new_password and confirm new_password close the bash

back into cmd /d

ubuntu config --default-user your_username

Launch the bash and fell free to use the new_password for your_username when needed (like for a "sudo apt-get install gcc")

  • This helped me resetting my lost password. Instead of doing the complete reinstallation or cleaning, I just did a password reset. Thanks! Feb 12, 2022 at 17:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .