wslg: Displays do not go to sleep when WSLg is enabled after unlocking Windows lock screen using modifier key (such as left-ctrl)
Environment
Windows build number: Version 10.0.22000.100
Your Distribution version: Gentoo 17.1 Hardened
Your WSLg version: 1.0.24
Steps to reproduce
Just have WSLg running
C:\WINDOWS\system32>powercfg /requests
DISPLAY:
[PROCESS] \Device\HarddiskVolume4\Windows\System32\mstsc.exe
RAIL Power Request
Expected behavior
Screen should go to sleep after 15 minutes
Actual behavior
Display never goes to sleep when WSL is running
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 20
- Comments: 70 (21 by maintainers)
As a temporary workaround, running the following command sets an override that causes Windows to ignore the power requests from WSLg:
powercfg /requestsoverride PROCESS mstsc.exe DISPLAY SYSTEM
Hi @hideyukn88
I’ve been having this issue for too long and finally found this issue. Updated wsl to the latest version but my windows 11 is still not sleeping nor turning off the display. here’s the cmd output
for now I just set up a hotkey to manually put my computer to sleep but hopefully there will be a solution to this. thanks
I just installed Windows 11 and then WSLg, and also found that my computer no longer sleeps. Disabling WSLg by putting
in .wslconfig got my computer sleeping again (but no WSLg of course).
Hi all, WSL 0.70.0 is just released from Store, and this include the update of MSRDC, please update it by
wsl --update
, and if the problem still persists, please let us know by reopening this issue, thanks!Like @idrisakmal, I’m experiencing the same issue:
The fix for msrdc behavior mentioned at https://github.com/microsoft/wslg/issues/380#issuecomment-1179625631, went to MSRDC version 1.2.3573 or newer, WSL will soon be updated with MSRDC version 1.2.3575, thanks!
@DavidZidar, you are right, apparently Windows is sending the key to unlock lock screen, and if left-ctrl key is used to trigger lock screen, somehow key release event is not sent to Linux side, thus Linux side thinks key is remain pressed and never enter idle state, I confirm I can encounter same issue on my local machine. This is wrong, and I will look into the fix. To work around this, you can use other key such as “space” key (or any non-modifier key) to trigger lock screen instead of left-ctrl (or any modifier key). By using non-modifier key, Windows is sending key release event correctly. Would you please verify if non-modifier key is used, you won’t encounter this issue? Thank you very much for your help!
If it’s a temporary workaround with known issues, make it a toggle? This has been happening for many months now so I don’t think it makes sense to call this temporary.
@superpi15 thanks, I worked it around by running this on an elevated command prompt:
@justinbowes, @wowczarczyk, thanks for checking. If GUID remains same, then my theory is not what’s happening at your end. At this point, collecting core dump of weston process following https://github.com/microsoft/wslg/issues/380#issuecomment-1179421029 would greatly help. Also as backup, I’m working on the change to weston compositor to not take power reference until any GUI application start up, https://github.com/microsoft/weston-mirror/pull/128. This allows WSL users who only works on console based applications won’t be bothered by this, thanks!
I have this issue. After a spot of troubleshooting, the initial cause is clear enough.
I have Docker Desktop installed and running in WSL2 mode. I have a RAIL Power Request for both DISPLAY and SYSTEM as long as Docker Desktop is running (which does not have any X UI, as far as I know). As soon as I shut down Docker Desktop, the requests are no longer active.
It’s not clear to me whether this is a Docker Desktop issue, a WSLg issue, or someone’s idea of intended behavior.
Same thing here as well:
`C:\Windows\System32>powercfg /requests DISPLAY: [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [PROCESS] \Device\HarddiskVolume4\Program Files (x86)\Microsoft\Edge\Application\msedge.exe Video Wake Lock
SYSTEM: [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [PROCESS] \Device\HarddiskVolume4\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\msrdc.exe RAIL Power Request [DRIVER] Legacy Kernel Caller`
Another behavior I see is that if I manually put the machine to sleep it will wake itself up about a minute later with the above wake locks in powercfg. The behavior is not consistent. Sometimes the machine will stay asleep, other times it will wake itself up.
@hideyukn88 Unfortunately I shut down WSL so my monitor could go back to sleep (and it did). I think I should be able to reproduce it though, I’ll give it a try over the weekend. Thanks for the instructions and feedback.
I am seeing WSLg apps blocking the screen saver / display off as well.
While Emacs is running via XWayland via WSLg weston,
powercfg /requests
reports the following:In practice, this means my displays stay on indefinitely, whilst I would prefer for screen saver and later automatic display power off to happen.
If I exit Emacs and wait a few minutes,
powercfg /requests
reports NO more blockers.I’ve started seeing similar behavior within the last week or so. (If it seems like this is a different bug, let me know and I’d be happy to file separately). My computer seems to not go to sleep if WSL is running at all, even if I’ve never started a WSLg app. If I run
wsl --shutdown
, then everything seems to get cleaned up. I dumped logs at https://gist.github.com/ebroder/7143b922985281cd817a535d938cab31 but can grab more if helpful.Also have this issue,
powercfg -requests
in an elevated powershell prompt giveszero wslg windows open