Closed lkytal closed 7 years ago
$HOME of root is /root, not /home/lky, so wcmd can't read outbash_port file. And /root is not in DrvFs (/mnt/x), see also https://github.com/xilun/cbwin/issues/20.
Don't do sudo zsh (why are you running zsh and therefore its child wcmd as root?!)
That's only part of the problem.
You would also need to do
wcmd : cmd
The :
tells wcmd
, wstart
, and wrun
to launch in your %userprofile%
in Windows. Without that parameter, the cbwin utilities will attempt path translation of the "start in" directory, which matters for various programs.
For example, if the pwd
in your linux shell (bash, zsh, FiSH, csh, tcsh, whatever) is
/mnt/c/Windows/System32
,
running wcmd cmd
would launch cmd
in
C:\Windows\System32
Thanks for your reply. The point is that wcmd won't work under root, if I have a xxx.sh script need to run as root, it could not use wcmd.
@lkytal Ummmm, I don't think there is a reason why you would ever need to run a wcmd script with Linux root.
wcmd is not used to run xxx.sh (but xx.exe/xx.bat), and there is no root user in Windows, this root user only works in WSL.
@goreliu Jinx!
It's unfortunate wcmd does not work under root reached with a sudo (at least not without extra configuration), but I'm not sure it is worth to invest much energy in that. @lkytal what is more precisely your scenario where running wcmd as root would be important for you?
As a work-around, you can try to launch outbash with the --outbash-session option, or to elevate with su instead of sudo.
@xilun Elevate with su does work, Thanks. Running wcmd with sudo is not that important to me, but I do feel strange that wcmd behaves differently between root and normal users. Better support towards sudo may make this little interesting project better :smile:
Here's how to fix it:
outbash.exe --outbash-session
so that it will write outbash_port in your home dirsudo ln -s /home/lky/.config /root/.config
to pass outbash_port file to root userThanks a lot poma, this works !
@tomsihap Not sure if you're aware, but this feature was adopted into the driver by Microsoft since 14951, not that Xilun's work isn't excellent!
I'd actually advise testing/using MS interop if you can (that is: for now on Insider builds, and don't need any feature/behavior they don't provide yet). Actually they can do things we cannot without access to their implementation, or at least not with extreme difficulty and hacks. For example stdin forwarding just can't be perfect with an extra layer out of the implementation - like I'm forced to do; while once completely debugged their interop capable pipes will be just fine for that. I don't envision maintaining cbwin forever. (But I'll maintain it at least for people using stable versions of Windows.)
When this feature is supposed to be released in a stable windows build?
Does MS implementation work with interactive apps? (for example wrun ssh ...
doesn't work in cbwin)
The next stable Windows release should be in spring 2017. I can't speak for the MS team, but I think it is likely than interactive apps then work better with their interop and maybe some console updates, than they do on the Anniversary Update with cbwin. For info I've started to play with console modes a little in cbwin (in a separate branch), but for now I did not found anything good enough when running on the Anniversary Update...
Works directly in bash. However, after I launch zsh inside bash, wcmd errors ERR MSG:
wcmd: OUTBASH_PORT environment variable not set, and could not read /home/lky/.config/cbwin/outbash_port wcmd: can't translate a WSL VolFs path to a Win32 one [1] 132 killed wcmd ver