Giter VIP home page Giter VIP logo

Comments (14)

poma avatar poma commented on July 20, 2024 6

Here's how to fix it:

  1. Run outbash.exe --outbash-session so that it will write outbash_port in your home dir
  2. Run sudo ln -s /home/lky/.config /root/.config to pass outbash_port file to root user

from cbwin.

xilun avatar xilun commented on July 20, 2024 2

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.)

from cbwin.

goreliu avatar goreliu commented on July 20, 2024 1

$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 #20.

from cbwin.

goreliu avatar goreliu commented on July 20, 2024 1

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.

from cbwin.

fpqc avatar fpqc commented on July 20, 2024 1

@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!

from cbwin.

fpqc avatar fpqc commented on July 20, 2024

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

from cbwin.

lkytal avatar lkytal commented on July 20, 2024

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.

from cbwin.

fpqc avatar fpqc commented on July 20, 2024

@lkytal Ummmm, I don't think there is a reason why you would ever need to run a wcmd script with Linux root.

from cbwin.

fpqc avatar fpqc commented on July 20, 2024

@goreliu Jinx!

from cbwin.

xilun avatar xilun commented on July 20, 2024

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.

from cbwin.

lkytal avatar lkytal commented on July 20, 2024

@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 😄

from cbwin.

tomsihap avatar tomsihap commented on July 20, 2024

Thanks a lot poma, this works !

from cbwin.

poma avatar poma commented on July 20, 2024

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)

from cbwin.

xilun avatar xilun commented on July 20, 2024

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...

from cbwin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.