WSL: Can't run Zsh
“apt-get install zsh” is ok oh-my-zsh is ok but when run :
compaudit:105: wait failed: invalid argument
compdef:95: wait failed: invalid argument
_update_zsh_update:1: wait failed: invalid argument
/root/.oh-my-zsh/oh-my-zsh.sh:3: wait failed: invalid argument
Sorry my english!
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 19
- Comments: 42 (7 by maintainers)
Ok, I’ve investigated the zsh failures and I’ve found the culprit. It’s a (somewhat) long read, so bucle up.
Part 1:
wait3()with getrusage not properly implementedAfter installing it with
apt install zsh, here’s what running zsh outputs:Those
compauditandcompdeferrors are thrown becausecompinitis run in/etc/zsh/zshrc. If I start zsh without loading startup files the errors don’t show up anymore:and tracing the execution of those startup files with
zsh -xshow the errors happen in:compaudit’s
getent(line 107):compdef’s
bindkey | read(line 356):Those two lines have in common that a
fork()has to happen: both external and piped commands are not properly exited (notice thejobscommand shows weird results):Other commands, like
zshbuiltins (no fork), work correctly:That said, the culprit seems to be some wait function: looking for the
wait failedstring in the zsh codebase we easily find it:signals.c (line 482):If we look up a little bit we find the call that sets the
pidvariable:At this point I set up a test bench with those 4 calls to see which one fails and why. You can look up the code at the following gist.
Here are the results:
Furthermore, an
straceof each executable shows (only relevant info shown):So it seems all 4 functions end up running the same
wait4()syscall, with the exception that the first version passes astruct rusageto it while the rest set the parameter to NULL.So, to conclude, #BashOnUbuntuOnWindows should properly implement that syscall or ignore the
rusageparameter in a safe way.Meanwhile, we can trick the zsh compilation to use one of the above calls that work correctly. To do so, follow the instructions of this gist.
Note there are several other things that don’t work yet within zsh, like
subshellsprocess substitution and named pipes. I’ll document this on a later post. A normal installation of Oh My Zsh seems to work ok though.First off: @mcornella, excellent write-up. Thanks!
We have this one on our radar and will look into it.
@johnkchiu I got it working by installing newest release of Conemu https://github.com/Maximus5/ConEmu/releases/tag/v16.05.15 and ensuring
Powerlinewas installed.sudo pip install powerline-statushttps://powerline.readthedocs.io/en/latest/installation/linux.html#installation-on-linuxFixed on internal builds. I am not a zsh person so I have note tested everything, but:
Hello guys, With the new update of Windows build 14342, zsh working properly. Oh My Zsh also works. It’s awesome.
Closing this issue out since zsh now works. Feel free to continue the discussion here though!
Sorry for the late replies here.
@cH40z-Lord, I wish I could give more information on the schedule. Unfortunately I can not. Best I can say is to stick on the Insider Fast right to get things as quickly as possible.
@AngeloG, Never tried myzsh before so this will not be a fair test. It did install with no errors but I do not believe the prompt displayed correctly:
➜ ~For fun, I set my theme to random. Some look to work while others fail with errors like:My suggestion on this one would be to start a new issue here (and possibly on our uservoice page) when the zsh fixes go out.
@kameleon83 mcornella , @benhillis is talking about process substitution on #266 (as @aseering points out). Looks like we still have the same bug under zsh
I figured it out. You have to clone
https://github.com/powerline/fontsthen manually double click and install one of the Powerline fonts. After configuring ConEmu, then the symbols will display.I documented the configuration on my wiki.
@russalex that’s a known issue on ohmyzsh. Some themes require loading plugins, which is not done automatically, so random doesn’t really work reliably.
@AngeloG as far as I’ve tested, most of ohmyzsh should work ok, except where process substitution is used. Some plugins may not work as well, but that’s a bigger testing effort that I can’t do right know. If in the future something doesn’t work you can always open an issue on the official repo and I’ll do my best to help.
For what it’s worth, process substitution under bash is being investigated with issue #266 . I don’t know how zsh does process substitution but would assume that they’re related.
It is still in beta. We must send the bug to insider hub. I did not do it. After I use archlinux and not Ubuntu usually so uncertain behavior of it
P.S.: Sorry for my english. I’m french and I translate by google
@lama0900 Hello just write in “.bashrc”
exec zshso and how to run this by default? chsh doesn’t do anything. always have to run zsh as user. strange thing, as root it get’s executed by default