10

I installed WSL 1, enjoyed having Linux on my PC, then discovered the limitations of the scarce interoperability over files between the two operating systems.

So I installed WSL 2 following the specs (enabled virtualization in BIOS settings and all the stuff) but the installation is not completely working, I cannot set it as default and not all the shell commands respond as expected.
I googled and somebody had similar issues, but not so many straightforward solutions are proposed (I guess it is still a relatively new case).

So I want remove WSL as deeply as possible and reinstall WSL 2 from scratch.

  • What is the most secure and advisable process to remove WSL completely?
  • Can WSL 2 be installed from scratch without installing WSL 1 before?

1 Answer 1

14

Can WSL 2 be installed from scratch without installing WSL 1 before?

No. The base WSL support is required for WSL2.

What is the most secure and advisable process to remove WSL completely?

Here's the best info I have on removing everything related to WSL.

It sounds like you consider the existing instance a lost cause, but if you'd like to back it up for posterity, you can start with:

  • wsl --export <distroname> archivename.tar

Then remove the existing distro installation(s):

  • Any distro you installed from the Store, you should first remove through "Apps & Features" (a.k.a. "Add or remove programs") in Windows. This also goes for distributions installed manually via downloaded Appx package.

Then check to make sure nothing is left. From PowerShell or CMD:

  • wsl -l
  • wsl --unregister <distroname>

You may want to just install a new distro at that point from the Store. It's unlikely that any additional reinstallation of the other components is going to make a difference. But if you do want to remove them:

  • From "Apps & Features" (a.k.a. "Add or remove programs") in Windows, remove the "Windows Subsystem for Linux Update". I'm fairly certain this is the Linux kernel update. Probably reboot if you want to be sure it's fully gone before the next step.
  • From "Turn Windows Features on or off" in Windows, disable the "Virtual Machine Platform". This is the WSL2 Hyper-V support. Probably reboot if you want to be sure it's fully gone before the next step.
  • From "Turn Windows Features on or off", disable "Windows Subsystem for Linux.
  • Reboot.

When you are reinstalling from there, I'd appreciate it if you could confirm that "Windows Subsystem for Linux Update" returns to Apps & Features after installing the kernel update package (Step 4 in the Install doc). I will update this answer based on that info.

7
  • Thanks for the detailed info, I will come back to confirm the process and the last point in particular.
    – yodabar
    Jan 21, 2021 at 7:55
  • 1
    FWIW I did your steps and I did the 'simplified install' (wsl --install on the command line) and it reinstalled the kernel update package automatically. Sep 10, 2021 at 10:00
  • @EddieParker Thanks! That also reminds me that I need to go back through my old answers and update them for wsl --install since it's now GA. Sep 10, 2021 at 15:19
  • These steps successfully unborked my WSL install that was borked by upgrading to Windows 11. Oct 30, 2021 at 5:47
  • 1
    @RobinDeSchepper True, but that does assume that (a) the distribution is Ubuntu (the non-versioned one from the Microsoft Store) and (b) it was installed from the Store. For Store distros, it could also be ubuntu2004 or alpine or debian or others. I tend to prefer the /etc/wsl.conf method of setting the default user as described here. That also has the advantage of (a) working even if the distribution wasn't installed from the store, and (b) any --export's you do with that image from that point on will "remember" the default user. Feb 11 at 18:30

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.