-
Notifications
You must be signed in to change notification settings - Fork 827
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
[Bug]: Windows 11 WSL2 completely shuts down when inactive #10157
Comments
I don't have
|
@LWJerri This is an intentional design decision by Microsoft. The time is actually just 8 seconds when the instance gets shut down. You can work around this issue by enabling systemd with https://github.com/DamionGans/ubuntu-wsl2-systemd-script instead of the solution provided by Microsoft. For Ubuntu 22.04 you also need the patch from DamionGans/ubuntu-wsl2-systemd-script#36 (comment) (the patch goes to the end of enter-systemd-namespace. You should also change basic.target to multi-user.target in both enter-systemd-namespace and start-systemd-namespace before running "bash ubuntu-wsl2-systemd-script.sh". |
Hello! Yeap, this solved my problem, thanks! |
@LWJerri You could have left this issue open so that Microsoft could've also commented about the problem :) |
I think it's something out of the realm of impossible, but okay, let's try it. |
btw; you can check with
when the Windows-side processes close down |
This is intentional. If you daemonize some tasks they can keep it running. As long as some number of relay init processes live because they have children the vm should continue to run. |
Found a fix for this problem: #10138 (comment) |
You helped me a lot today! I can see you under this relevant question, and it feels like you have a good understanding of WSL2. I'm really curious how you discovered the command "dbus-launch true". |
I don't really remember how I found it, but it had something to do with other peoples' solutions to start a process in WSL 2 to keep the instance alive. |
I think what's happening is that when you run "dbus-launch true" in WSL 2 instance, it starts the user dbus-daemon |
Windows Version
Microsoft Windows [Version 10.0.23471.1000]
WSL Version
Версия WSL: 1.2.5.0 Версия ядра: 5.15.90.1 Версия WSLg: 1.0.51 Версия MSRDC: 1.2.3770 Версия Direct3D: 1.608.2-61064218 Версия DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Версия Windows: 10.0.23471.1000
Are you using WSL 1 or WSL 2?
Kernel Version
Linux version 5.15.90.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Fri Jan 27 02:56:13 UTC 2023
Distro Version
Release: 22.04
Other Software
Docker version 24.0.2, build cb74dfc
Repro Steps
htop
and see fresh uptime.Expected Behavior
WSL should not shut down after some time of inactivity, I did not have this until a complete reinstallation of Windows.
Actual Behavior
WSL turns off completely.
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: