23

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 – John Miller Mar 1 '18 at 5:24
9

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

  • Damn.. didn't expect it would be that straightforward! – Shishir Gupta Oct 10 '19 at 13:07
19

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.

References:

6

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

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

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

...

    clean
      - 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.

0

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")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.