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)

Most upvoted comments

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

C:\Windows\System32>wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

C:\Windows\System32>wsl --version
WSL version: 0.70.4.0
Kernel version: 5.15.68.1
WSLg version: 1.0.45
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.674

C:\Windows\System32>powercfg -requests
DISPLAY:
[PROCESS] \Device\HarddiskVolume3\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_0.70.4.0_x64__8wekyb3d8bbwe\msrdc.exe
RAIL Power Request

SYSTEM:
[PROCESS] \Device\HarddiskVolume3\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_0.70.4.0_x64__8wekyb3d8bbwe\msrdc.exe
RAIL Power Request

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

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

[wsl2]
guiApplications=false

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:

Microsoft Windows [Version 10.0.22621.674]
(c) Microsoft Corporation. All rights reserved.

C:\Users\imran>wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

C:\Users\imran>wsl --version
WSL version: 0.70.4.0
Kernel version: 5.15.68.1
WSLg version: 1.0.45
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.674

C:\Users\imran>powercfg -requests
DISPLAY:
None.

SYSTEM:
None.

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

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!

@cpbotha, thanks for info, this is the result of temporary workaround since WSLg doesn’t have real DPMS (Display Power Management Signaling), thus WSLg keeps screen turned on as long as application updates the screen, and most of case, this works just fine since well-behave application stops updating screen when there is no interaction from user, but certain legacy application, like Emacs, might not. And the reason for placing that “temporary workaround” is due to avoid screen being turned off while playing video on WSLg (for example on Firefox Browser or VLC), so we understand there is pros/cons. we are welcoming feedback on this, please let us know, thanks!

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:

powercfg -requestsoverride PROCESS msrdc.exe DISPLAY SYSTEM

@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.

wsl --version
WSL version: 0.48.2.0
Kernel version: 5.10.60.1
WSLg version: 1.0.29
Windows version: 10.0.22000.282

While Emacs is running via XWayland via WSLg weston, powercfg /requests reports the following:

DISPLAY:
[PROCESS] \Device\HarddiskVolume3\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.48.2.0_x64__8wekyb3d8bbwe\msrdc.exe
RAIL Power Request

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 gives

PS C:\WINDOWS\system32> powercfg -requests
DISPLAY:
[PROCESS] \Device\HarddiskVolume4\Windows\System32\mstsc.exe
RAIL Power Request

SYSTEM:
[PROCESS] \Device\HarddiskVolume4\Windows\System32\mstsc.exe
RAIL Power Request

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

zero wslg windows open