You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Windows 11 WSL2 completely shuts down when inactive #10157
Версия 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?
WSL 2
WSL 1
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
Open terminal with WSL2
Close terminal and wait ~1 min.
Open terminal again and run 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.
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".
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".
Andrii Zontov (@LWJerri) You could have left this issue open so that Microsoft could've also commented about the problem :)
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'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.
Activity
LWJerri commentedon Jun 2, 2023
I don't have
.wslconfigand myws.conf:aki-k commentedon Jun 6, 2023
Andrii Zontov (@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".
LWJerri commentedon Jun 6, 2023
Hello! Yeap, this solved my problem, thanks!
aki-k commentedon Jun 6, 2023
Andrii Zontov (@LWJerri) You could have left this issue open so that Microsoft could've also commented about the problem :)
LWJerri commentedon Jun 6, 2023
I think it's something out of the realm of impossible, but okay, let's try it.
aki-k commentedon Jun 6, 2023
btw; you can check with
when the Windows-side processes close down
aki-k commentedon Jun 16, 2023
Found a fix for this problem: #10138 (comment)
zhl-HFUT commentedon Oct 17, 2023
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".
aki-k commentedon Oct 17, 2023
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.
aki-k commentedon Oct 18, 2023
I think what's happening is that when you run "dbus-launch true" in WSL 2 instance, it starts the user dbus-daemon