Saturday 3 February 2018

linux - How can the bash shell on Window be completely reset?


I'm new to Unix but interested learn, so started trying to use bash/Ubuntu on Windows. Unfortunately, bash crashed and now bash/Ubuntu seems to be broken as most folders are now missing from the Ubuntu root folder, i.e.:


root@Desktop:~# ls
root@Desktop:~# cd /root
root@Desktop:~# ls
root@Desktop:~# ls -a
. .. .bashrc .profile

I don't have a %localappdata%\lxss folder (I'm pretty certain this is where the Linux root was originally). I appear to have a %localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc folder, which is apparently the new location for the Linux root, but it is not complete (i.e. doesn't contain a ...\LocalState\rootfs folder).


After searching for solutions on here and elsewhere, I've tried:



  • Completely uninstalling Ubuntu\bash from Windows with lxrun.exe /uninstall full.

  • As above, in conjunction with disabling and re-enabling the Windows Subsystem for Linux (beta) feature too.

  • Running: apt-get remove upstart, apt-get remove udev, apt-get autoremove in bash.


Unfortunately none of the above have solved the problem. Can anybody suggest a way to perform a complete 'factory reset'?



Answer




After searching for solutions on here and elsewhere, I've tried:



  • Completely uninstalling Ubuntu\bash from Windows with lxrun.exe /uninstall full.

  • As above, in conjunction with disabling and re-enabling the Windows Subsystem for Linux (beta) feature too.

  • Running: apt-get remove upstart, apt-get remove udev, apt-get autoremove in bash.



lxrun.exe isn't supposed to work on the current version of WSL. I find it difficult to believe you have installed the Windows Subsystem for Linux (Beta) since the correct feature would be listed as Windows Subsystem for Linux on Windows 10 Version 1709. Your third solution wouldn't reset the any WSL environment.



lxrun and bash.exe and associated tools are deprecated in the Fall Creators Update.



The only reason I know you are running 1709 is due to the existence of the UbuntuonWindows_79rhkp1fndgsc folder.



I appear to have a %localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc folder, which is apparently the new location for the Linux root, but it is not complete (i.e. doesn't contain a ...\LocalState\rootfs folder).



It isn't supposed to contain that folder.



I don't have a %localappdata%\lxss folder (I'm pretty certain this is where the Linux root was original).



This is the location of the legacy version of WSL. It is no longer located there, and the legacy method used to reset the environment does not work for the current version of WSL on Windows 10 Version 1709+


I specifically said that in my answer.



The following answer only applies to WSL on Windows 10 1703 and 1607. WSL on Windows 10 1709+ can be installed from within the Windows Store UWP application.



As for your actual question...



Unfortunately none of the above have solved the problem. Can anybody suggest a way to person a complete 'factory reset'?



Just run the command:


wslconfig /unregister Ubuntu



Additionally, wslconfig /unregister, unregisters the distribution from WSL so it can be reinstalled or cleaned up.


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.



Once you run that command you will have to reinstall Ubuntu through the Windows Store.



While Linux distributions can be installed through the Windows store, they can't be uninstalled through the store. WSL Config allows distributions to be unregistered/uninstalled.



Manage multiple Linux Distributions in WSL


Command Reference


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...