Is it possible to uninstall Bash on Ubuntu on Windows, since the latest updates provide a different Ubuntu and SUSE app?

8

If it is, how do I safely remove the Bash on Ubuntu on Windows application while leaving a working Ubuntu and OpenSUSE?

Thomas Owens

Posted 2017-10-21T12:59:05.193

Reputation: 3 663

Answers

5

Running lxrun /uninstall /full in (e.g.) Windows Powershell with administrative privileges will remove Bash on Ubuntu while leaving your new app-based Ubuntu installation untouched.

Silviu

Posted 2017-10-21T12:59:05.193

Reputation: 74

lxrun command not found (see other answers...) – rogerdpack – 2019-11-04T13:25:24.923

9

Since lxrun was deprecated and removed in the Windows 10 April 2018 Update (see Command Reference for Windows Subsystem for Linux), the only way for me to get rid of "Bash on Ubuntu on Windows" was:

  1. Remove Windows Subsystem for Linux (WSL) via the Control Panel
  2. Restart the computer
  3. Try to start "Bash on Ubuntu on Windows"
  4. Agree to remove the shortcut
  5. Re-install WSL
  6. Restart the computer

Hat tip to How-To Geek:

If you’d like to remove the bash.exe tool and the Windows Subsystem for Linux from your computer completely, you’ll need to revisit the “Turn Windows Features On or Off” dialog in the Control Panel.

To find it, open the Control Panel and head to Programs > Turn Windows Features On or Off.

Uncheck the “Windows Subsystem for Linux” option here and click OK. Windows will uninstall the Windows Subsystem for Linux, bash.exe, and lxrun.exe commands. You can always revisit the Windows Features dialog to reinstall them in the future.

Christian Davén

Posted 2017-10-21T12:59:05.193

Reputation: 418

this worked thanks – Muhammad Umer – 2019-05-14T23:51:47.383

5

TLDR

wsl --unregister Legacy

Explanation

I believe Christan Davén's answer just removes the shortcut from the start menu, but does not actually remove the WSL (you will still be able to run the WSL by executing C:\Windows\System32\bash.exe and find all of your files and installed apps as you left them).

Silviu's answer is correct. However, if you've upgraded to the Windows 10 Fall Creators Update the lxrun /uninstall /full command will not be available anymore and you should instead run wsl --unregister Legacy.

A third option is to run wslconfig /u Legacy (try this if you are not using Windows Version 1903 or higher).

Source

https://docs.microsoft.com/en-us/windows/wsl/install-legacy#uninstallingremoving-the-legacy-distro

chris

Posted 2017-10-21T12:59:05.193

Reputation: 51