-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Windows Version
Microsoft Windows [Version 10.0.26120.5751]
WSL Version
2.6.1.0
Are you using WSL 1 or WSL 2?
- WSL 2
- WSL 1
Kernel Version
6.6.87.2-1
Distro Version
Fedora release 42 (Adams)
Other Software
No response
Repro Steps
Environment
This is a confirmed regression, tested on two machines with the identical Windows build.
Working Environment
WSL Version: 2.5.10.0
Windows Version: 10.0.26120.5751
Failing Environment
WSL Version: 2.6.1.0
Windows Version: 10.0.26120.5751
Problem Description
On WSL version 2.6.1.0, the WSL2 VM instance shuts down approximately 15-20 seconds after the last terminal window is closed, even when a systemd service is in a stable active (running) state.
This behavior does not occur on the older WSL version 2.5.10.0 on the exact same Windows build, where the instance correctly remains active.
Steps to Reproduce
Ensure you are running WSL version 2.6.1.0 or later on a system with systemd=true enabled in /etc/wsl.conf.
Create a minimal systemd system service file at /etc/systemd/system/keep-alive.service:
[Unit]
Description=Test service to keep WSL active
[Service]
ExecStart=/bin/sleep infinity
[Install]
WantedBy=multi-user.target
Enable and start the service: sudo systemctl enable --now keep-alive.service.
Verify the service is active and stable: sudo systemctl status keep-alive.service.
Close all open WSL terminal windows.
Open a new PowerShell terminal and monitor the output of wsl -l -v.
Expected Behavior
The WSL instance should remain in the Running state indefinitely, as long as the keep-alive.service is active. This is the behavior seen in WSL version 2.5.10.0.
Actual Behavior
The WSL instance changes from the Running state to the Stopped state within 15-20 seconds after the last terminal is closed.
Additional Context
This is a confirmed regression. I reproduced this issue by upgrading a machine from the working v2.5.10.0 to the failing v2.6.1.0. The issue appeared immediately after the upgrade.
Troubleshooting has confirmed this is not a user configuration issue. There is no .wslconfig file in use, and /etc/wsl.conf is standard. The issue occurs with any systemd system service, not just a specific one.
Expected Behavior
I'd expect the same behavior on 2.6.1.0 as seen in 2.5.10.0, which is a running and active systemd service prevents WSL2 from shutting down the instance even after all running terminals are closed.
Actual Behavior
On 2.6.1.10 after about 20 seconds, WSL2 shuts down the instance after the last terminal is closed even though there is a running and active systemd service.
Diagnostic Logs
No response