luxzg / WSL2-fixes

Fix-up scripts for WSL2, mainly networking related
198 stars 23 forks source link

Enable systemd and wsl will automatically shut down when not in use #6

Closed c0febean closed 1 year ago

c0febean commented 1 year ago

Hi.

Thank you very much for your guidance! Your article is very important to me and has helped me a lot.

Also, I have a problem after I finished the configuration. When I don't have systemd enabled,

wsl can always run in the background, but after enabling it, as long as no wsl window is opened, the service will shut down in less than a minute, even if ssh is connected at the time.

I have seen Microsoft mention the VM mechanism in the documentation, but this seems to be inconsistent with the documentation description when I don't have systemd enabled. https://learn.microsoft.com/en-my/windows/wsl/faq#can-i-use-wsl-for-production-scenarios--

Have you encountered such a problem in the process of using, or how to solve this problem ,please solve the problem

Thanks

(Translated from deepl)

The-Monkey-King commented 1 year ago

This is by design and not a defect of this code. See: https://github.com/DamionGans/ubuntu-wsl2-systemd-script for a possible way to have WSL instance running in the background. I suggest this issue be closed.