-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows Update Destroys WSL System #1195
Comments
@ronindesign I understand your frustration. Let me clarify a couple of things for you.
I hope that helps clarify things. Again, sorry for the frustration. |
I got this exact problem as well, but when I reinstalled WSL, it was able to find all of the old software that I installed. |
EDIT: I did have My current solution is:
Example:
Additional Thoughts
|
@benhillis firstly, thanks for the quick response, I appreciate it! Secondly:
EDIT: I was incorrectly looking in the wrong In this file, I have:
If I would have found this and commented out, it would have definitely solved my issue, I'm sure. Sorry about my failure here and the confusion. However, I probably would have been saved a lot of trouble if And in fact, I can reproduce for any not existing command (and probably for any command that returns unsuccessful):
This is natural behavior for Maybe this issue should be changed or a new issue created for this behavior? Had @alexanderwhatley Thanks for the response! For me, |
Suggestions: With Linux, when you run into trouble like this, one solution is to log in as root (if/where allowed, e.g. console) and use the superuser to tweak the user's .bashrc or change the user's passwd or install the zsh package or whatever. One can do that with WSL by using the setdefaultuser option with lxrun. One can then set the default user back to whatever your user is and proceed. The other suggestion is to try the Linux solution before resorting to looking at files in %LOCALAPPDATA%\lxss. Editing files there almost always results in them disappearing from the WSL environment (because extended attributes don't get set properly). Sure, deleting things that way might help rescue something, but trying other solutions (which includes logging in as root) might also solve the problem. Keep a backup of one's home directory and other changes one makes, in case some Insider Preview breaks things. That way if you have to delete everything (yes, including %LOCALAPPDATA%\lxss) and start over, there will be minimal losses. Some teacher of mine a while ago said one should always use fully qualified paths when calling programs in bash scripts. One reason is to speed up the process, so bash doesn't have to look at all the places in the PATH; another is so you get the one you want if there is more than one on the PATH. While one is at it, one can do an existence test on that path, and if the file is not there (for whatever reason) take corrective action or just do nothing... (Murphy was an optimist.) I'm not minimizing the issues cited, just suggesting some additional troubleshooting strategies that might help get past them. |
@rodrymbo Thanks for the insight, I'm sure it will be useful to others as well. Re: lxrun setdefaultuser - I found this but didn't think it would work to set root as default user, since I remember something about Ubuntu not having a root user that could be changed to, and that basically you needed / should use sudo for everything. However, obviously the user exists since Re: disappearing files in WSL - I've definitely ran into issues with files being effected when editing from the outside. For example, I have Re: bash scripts - All good points, I unfortunately have minor real world experience with bash scripts. In terms of absolute path, I assume checking for existence of |
The documentation on Yes, ssh is quite picky (I mean REALLY picky, and rightly so) about permissions and such in the ~/.ssh directory. Files found in /mnt (DrvFS) have all permission bits set (for example) so when ssh checks to make sure no one but the user can read the private key or write to the 'authorized_keys' or 'known_hosts' files, it will/should reject anything linked from DrvFS. So ~/.ssh is not a good candidate for that sort of thing. Add to it that files written to the VolFS filesystem directly from Windows (almost always) become inaccessible in WSL (at least at present) and we end up with lots of roadblocks to keeping the two environments coordinated. Copying files from DrvFS into your home directory (for example) from within WSL works because WSL maintains extended attributes. If one is lazy (which is why scripts were invented) one could copy the files and then change any permissions that need changing, via a script. One could put such a script into, say, As for bash scripts, this is called "Bash on Windows" after all, so one could expect a bit of bash, even on the way to using zsh. :P But don't the points I made, such as using the full path to executables and testing for existence before accessing a file, apply also to zsh scripts? Anyway, every bash book I've seen includes examples of how to test for existence (I like to copy from the example, rather than try to do it from memory) so it isn't hard to come up with a script segment to put into .bashrc. |
A brief description
Windows 10 Insider Preview 14931
C:\WINDOWS\system32>bash.exe
Error: 0x80040154
C:\Users\MyWinUser\AppData\Local\lxss\home\nixuser
C:\WINDOWS\system32>bash.exe
bash: exec: zsh: not found
/bin/zsh
, intentionally (i.e. usingchsh -s /usr/bin/zsh
). However, since WSL was destroyed, ZSH binary doesn't exist (i.e. needs to be reinstalled).This effectively locks up bash since I've no idea how to change the default shell for my username to revert to
/bin/bash
. If ZSH was simply launched via config, e.g. in.bashrc
or.profile
, I could comment this out and let the shell run to install zsh. Instead, I would assume the only place to edit default shell would be in/etc/passwd
, yet still, there I have:nixuser:x:1000:1000:"",,,:/home/nixuser:/bin/bash
I'm not sure if
/etc/passwd
is showing the result of the reinstalled WSL resetting the entry for my user when I provided it in the WSL install prompt on first run, or what, but if this is the case, why is it still looking for zsh on init??Expected results
Actual results (with terminal output if applicable)
C:\WINDOWS\system32>bash.exe
Error: 0x80040154
C:\WINDOWS\system32>bash.exe
bash: exec: zsh: not found
Your Windows build number
14931.1000
Steps / All commands required to reproduce the error from a brand new installation
bash.exe
sudo apt-get -y install zsh
chsh -s /usr/bin/zsh
C:\WINDOWS\system32>bash.exe
Error: 0x80040154
Required packages and commands to install
sudo apt-get -y install zsh
chsh -s /usr/bin/zsh
The text was updated successfully, but these errors were encountered: