Skip to content
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

Doc Idea: when you need to restart LxssManager service #634

Closed
davidnoor opened this issue Jul 6, 2016 · 11 comments
Closed

Doc Idea: when you need to restart LxssManager service #634

davidnoor opened this issue Jul 6, 2016 · 11 comments

Comments

@davidnoor
Copy link

Hey there,

First of all, I'm really impressed by this project! I do quite a bit of cross platform development; I'm a developer on a Linux-only server product with clients that support multiple platforms, and being able to work without a VM is amazing.

I just ran into an issue that might be helpful for your docs, if it's not already in there somewhere. I was trying hard to get my changes to /etc/security/limits.conf and /etc/pam.d/common-session to "take effect". I thought if I exited all of my shells and a new init would get launched, that would be similar to rebooting in Linux; but it doesn't quite seem to work that way. After a little searching I found the "LxssManager" Windows service running, and stopped and restarted it. It could be really useful to doc when that step is necessary.

@jackchammons
Copy link
Contributor

jackchammons commented Jul 6, 2016

Thanks David! We love to hear that Bash on Windows is appreciated.

Closing all bash terminals will force init to be run on the open of any subsequent terminals. The service, on the other hand, will continue to run for some time after the last terminal is closed.

To check if the service is running use the following CMD command in an console:
sc query LxssManager

To restart it use:
sc stop LxssManager
Then:
sc start LxssManager

I'll check if there is a good place in the docs to put this.

@davidnoor
Copy link
Author

Thanks Jack! I wonder if you/your team given any thought to making shutdown/reboot from “inside” the subsystem trigger a restart of that service. Right now I believe reboot/shutdown inside bash fails. Considering a typical workflow of changing rc.d scripts and restarting to test it out, mapping reboot to a restart of that service would probably make the most sense and be the least surprising for a lot of Linux users.

-David

p.s. I live/work in Redmond, so if you guys ever do a focus group or other event, I’d love to participate.

On Jul 6, 2016, at 11:32 AM, Jack Hammons [email protected] wrote:

Thanks David! We love to hear that Bash on Windows is appreciated.

You are correct when you say that closing all of the open bash terminals does not necessarily stop the service.

To check if the service is running use the following CMD command in an console:
sc query LxssManager

To restart it use:
sc stop LxssManager
Then:
sc start LxssManager

I'll check if there is a good place in the docs to put this.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #634 (comment), or mute the thread https://github.com/notifications/unsubscribe/AA2f_q63kgB4A2qfrmucSFpJzA-UxkfBks5qS_TAgaJpZM4JFwf7.

@benhillis
Copy link
Member

@davidnoor Your original assumption that closing all of your bash.exe instances will cause a new init to be launched is correct. You should not have to restart the service. However when I say "init" I mean our private WSL init that does not touch either the /etc/security/limits.conf or /etc/pam.d/common-session file.

Could you share a specific repro of the original issue you were seeing?

@davidnoor
Copy link
Author

@benhillis I can go through the exact steps later this week and try to recreate it. But from my rough memory: my goal was to set the hard and softlimit for nofiles up to 8192 from the 2048 default. I had set up the linux subsystem to use user "dnoor" by default. I edited /etc/security/limits.conf and added the appropriate lines to give dnoor a hard and soft "nofile" limit of 8192, and then edited /etc/pam.d/common-session to add "session required pam-limits.so".

I closed all my bash windows, and then created a new one. ulimit -n still showed 2048. I tried this again a couple of times, and I also went to Windows task manager and made sure all the "bash" and "Init" processes were dead. I almost gave up, but then thought "I wonder if there's a windows service that acts like a cache of some things that happen when the subsystem starts up", saw the LxssManager service, and then stop/started it. I opened up a new bash window, ran ulimit -n, and it reported 8192.

@benhillis
Copy link
Member

@davidnoor - I suspect something else you're running is using the setrlimit system call to set these values. I checked the source of our init process and it doesn't do this so it must be something else you're running.

@davidnoor
Copy link
Author

Ok, fascinating. I’ll try to repro with a “clean” environment when I get a chance.

-David

On Jul 8, 2016, at 10:12 AM, Ben Hillis [email protected] wrote:

@davidnoor https://github.com/davidnoor - I suspect something else you're running is using the setrlimit system call to set these values. I checked the source of our init process and it doesn't do this so it must be something else you're running.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #634 (comment), or mute the thread https://github.com/notifications/unsubscribe/AA2f_iz_h1y7kzdUCWmUR7GUlQiBJqMAks5qToT-gaJpZM4JFwf7.

@benhillis
Copy link
Member

@davidnoor Thanks!

@kdbotts
Copy link

kdbotts commented Oct 19, 2017

I am a long time (20 years) Cygwin user. I am extremely fluent under Unix, Linux and Windows. I intend to keep Cygwin, but I thought I would try out WSL. I installed it on Win10FallCreatorsLatest1709. Immediately, when I start a Cygwin bash, it has my WSL home dir, instead of what I use as my Cygwin home dir. I have the HOME envar pointed to my cygwin home dir. Even in the crippled Cygwin bash (crippled, because it did not start in the right home dir, and did not run .profile or .bashrc or anything) the HOME envar still has the value of my Cygwin home dir. Apparently, somehow, WSL is making even a Cygwin bash start in the wrong home dir. I think it also masks other things, like, the WSL /etc in place of the Cygwin /etc. I do not know what all. I managed to uninstall WSL, and things are back to normal now. I am doing all this on a VM clone of another machine, so I can blow it away if necessary, and will if WSL or anything else messes up my Cygwin. I would like to have WSL, for optional-occasional use, because I am about to start using DockerForWindows in HyperV mode, and stuff like that. I would like, for instance, to be able to run native Linux Docker, as well as DockerForWindows, on the same host, but I understand that running Docker of any kind under Cygwin will not work. The upshot is: Is it possible to use Cygwin and WSL side by side on the same Win10 host? Has anybody else tried to do this? And what the heck is WSL doing to intercept the normal behavior of any Linux-like thing, which is, start a login shell in the value of the HOME envar?

Reply

@therealkenc
Copy link
Collaborator

This one died strangely with "I’ll try to repro with a “clean” environment when I get a chance".

@Jeff-Tian
Copy link

To check if the service is running use the following CMD command in an console:
sc query LxssManager

To restart it use:
sc stop LxssManager
Then:
sc start LxssManager

I met Access Denied error when trying to stop it. What can I do? It is not responsive even I restarted the windows.

image

@Wayc0des-Land
Copy link

To check if the service is running use the following CMD command in an console:
sc query LxssManager
To restart it use:
sc stop LxssManager
Then:
sc start LxssManager

I met Access Denied error when trying to stop it. What can I do? It is not responsive even I restarted the windows.

image

Use CMD and right click (Run As Administrator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants