75

I was fooling around a bit with the Linux/Bash subsystem for Win10.

But then I decided to stay with Cygwin for now. So I uninstalled it - or thought I did.

Now I've installed Cygwin and put its bin directory first in the PATH.

In cmd.exe , when I type bash , it will start the Cygwin's Bash.

But when I do Win+R and type bash, I still get the prompt:

Windows Subsystem for Linux has no installed distributions.
…bla-bla-bla…

How do I get rid of the Linux/Bash subsystem entirely, so it will instead pick up Cygwin's Bash from the PATH?

robinCTS
  • 4,407
Rop
  • 1,509

7 Answers7

79

If your OS has been upgraded to the Fall Creators Update, you should be able to issue the command wslconfig.

You could of course try uninstalling first by using the command lxrun /uninstall /full.

If its still there, you can try unregistering the distro:

  • First you need to know which distro is installed by using

    wslconfig /l
    
  • From the list choose the distro (e.g. Ubuntu) you want to uninstall and type the command

    wslconfig /u Ubuntu
    
robinCTS
  • 4,407
Casey SV
  • 891
67

In order to disable WSL, one has to go back into

Control Panel -> programs-features -> turn on/off Windows features and deselect Windows Subsystem for Linux, and Save. A dialog shows you progress as it uninstalls. You must restart the PC to complete the uninstall.

screenshot of the steps described above, Control Panel then Programs/Features then Turn on/off Windows features then deselect Windows Subsystem for Linux

Rop
  • 1,509
14

On my Windows 11 computer, executing wslconfig /u or removing the Windows feature didn't fully remove WSL.

This worked:

wsl --uninstall
MonkeyDreamzzz
  • 433
  • 4
  • 7
8

Just a few notes for experimenters, but for Windows 10 client o/s, you can use the following:

 (Get-WindowsOptionalFeature -Online -FeatureName '*linux*') | Select-Object FeatureName

Then:

Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Or the analogue:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

You can use other tooling to the same affect, such as dism.exe (as illustrated here: https://evidencen.com/wsl2/)

JustinC
  • 181
  • 1
  • 3
5

Edit - This would only work on Windows Server, not on Client OS.

Similar to what Rop suggested, but you can also use Powershell to completely remove the Windows Subsystem for Linux, with the advantage of not having to look for it in Control Panel. Note that you will have to run this as an administrator.

Remove-WindowsFeature Microsoft-Windows-Subsystem-Linux

List all the features available, filtering for Linux:

Get-WindowsFeature | Where-Object Name -like '*linux*' | Select-Object Name
ElRojo
  • 184
3

I combined removing Ubuntu-18.04

wslconfig /l 
wslconfig /u 'Ubuntu-18.04'

and with adding and launching Ubuntu-20.04 from the Windows store to successfully get WSL 2.0 running again it stopped working. I was getting

[process exited with code 4294967295] 

when I launched wsl 2.

Greenonline
  • 2,390
2

Windows 10:

  • search: "optional features" (-> manage optional features)
  • second last entry on page: more windows features
  • second last entry: WSL