WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Cursor and windows blinking when WSL is running

Open sebbelese opened this issue 3 years ago • 23 comments

Windows Version

Microsoft Windows [Version 10.0.19045.2604]

WSL Version

1.1.3.0

Are you using WSL 1 or WSL 2?

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.15.90.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

Start WSL V2

Expected Behavior

Wsl started, mouse cursor normal

Actual Behavior

When I start WSL V2 (not V1), the mouse cursor starts blinking between Loading/Normal states. Some other windows also blink but not all. See the example in the video where task manager and context menu blink:

https://user-images.githubusercontent.com/16559668/223451315-ae6933d1-be42-4902-b35d-c2104fd70965.mp4

It used to work, I do not know what what the change that caused that behaviour. I tried to completely reinstall WSL (the Linux distribs but also WSL itself), but still have the issue.

I understand that this si quite difficult to reproduce.

Diagnostic Logs

WslLogs-2023-03-08_09-14-06.zip

sebbelese avatar Mar 07 '23 14:03 sebbelese

I tried to remove several apps including Nvidia drivers, rancher-desktop, even Office, also tried to clean all possible config files, but the problem still occurred.

My fix for now is to use wsl kernel 5.10.16 which works well.

sebbelese avatar Mar 08 '23 16:03 sebbelese

@hideyukn88, Do you have any advice?

ghost avatar Mar 09 '23 00:03 ghost

@pmartincic, if you are seeing same issue, would you please share log files from /mnt/wslg, and check if there is any core dump is generated at /mnt/wslg/dumps, thanks!

hideyukn88 avatar Mar 09 '23 01:03 hideyukn88

Hello! Could you please provide logs and process dumps to help us better diagnose your issue?

To collect WSL logs and dumps, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1 -Dump

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@hideyukn88, I'm not seeing the same problem. I just wasn't sure where to start with the investigation on this bug. Figured you might have a better idea than I.

ghost avatar Mar 09 '23 01:03 ghost

Hello! Could you please provide logs and process dumps to help us better diagnose your issue?

To collect WSL logs and dumps, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1 -Dump

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

Not sure if they are uploaded at the right place, but these logs are available in my initial comments (I added these afterwards, which may be why the bot signaled it as missing).

sebbelese avatar Mar 09 '23 12:03 sebbelese

@sebbelese, I wonder if this is caused by WSLg, thus I would like to get logs from /mnt/wslg, thanks!

hideyukn88 avatar Mar 09 '23 20:03 hideyukn88

@sebbelese, I wonder if this is caused by WSLg, thus I would like to get logs from /mnt/wslg, thanks!

Sorry for late reply, I was unavailable with no time to break my current setup.

Attached are the .log files located in /mnt/wslg. Is there any other file you need? stderr.log weston.log wlog.log pulseaudio.log

sebbelese avatar Mar 20 '23 11:03 sebbelese

@sebbelese, thanks for providing logs, and yes, this is indeed caused by WSLg. WSLg launches msrdc.exe in background, and it is failing, thus it's repeatedly launched, and that ends up as cursor blinking. There is couple of known issues.

1: group policy prevents msrdc.exe from establishing connection with WSLg. If you can share output from reg QUERY "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /S, it can be identified.

2: Citrix software is installed, then you will need to apply workaround described either https://support.citrix.com/article/CTX107825/how-to-disable-citrix-api-hooks-on-a-perapplication-basis, or https://support.citrix.com/article/CTX463527/ms-quick-assist-crashes-when-used-in-citrix-session.

3: Something else, then please share a few ETL files at %LOCALAPPDATA%\Temp\DiagOutputDir\RdClientAutoTrace.

Finally as workaround, if you are not using Linux GUI application, you can disable it by .wslconfig, please refer https://learn.microsoft.com/en-us/windows/wsl/wsl-config, thanks!

hideyukn88 avatar Mar 21 '23 18:03 hideyukn88

Thanks for your time and answer. Citrix is not installed. Group policy is plausible, since it is a company-owned computer. Output of _reg QUERY "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /S :

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
    fAllowToGetHelp    REG_DWORD    0x1
    fAllowFullControl    REG_DWORD    0x1
    MaxTicketExpiry    REG_DWORD    0x1
    MaxTicketExpiryUnits    REG_DWORD    0x1
    fUseMailto    REG_DWORD    0x1
    fAllowUnsolicited    REG_DWORD    0x1
    fAllowUnsolicitedFullControl    REG_DWORD    0x1
    fDenyTSConnections    REG_DWORD    0x0

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\Client
    fEnableUsbBlockDeviceBySetupClass    REG_DWORD    0x1
    fEnableUsbNoAckIsochWriteToDevice    REG_DWORD    0x50
    fEnableUsbSelectDeviceByInterface    REG_DWORD    0x1

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\Client\UsbBlockDeviceBySetupClasses
    1000    REG_SZ    {3376f4ce-ff8d-40a2-a80f-bb4359d1415c}

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\Client\UsbSelectDeviceByInterfaces
    1000    REG_SZ    {6bdd1fc6-810f-11d0-bec7-08002be2092f}

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services\RAUnsolicit
    FNL-Delegation - Remote 
```assistance    REG_SZ    FNL-Delegation - Remote assistance

sebbelese avatar Mar 21 '23 19:03 sebbelese

@sebbelese, thanks for info, but it looks none of those policies interfere with WSLg, would you please share a few ETL files from %LOCALAPPDATA%\Temp\DiagOutputDir\RdClientAutoTrace, thanks!

hideyukn88 avatar Mar 21 '23 22:03 hideyukn88

Here are some RdClientAutoTrace.zip

sebbelese avatar Mar 22 '23 06:03 sebbelese

@sebbelese, thanks for sharing the log, just to sanity check, would you please shutdown WSL by wsl --shutdown, and restart, then do you still see below message at /mnt/wslg/weston.log? thanks!

WARNING
WARNING
WARNING: multiple monitor is not supported in non HiDef RAIL mode
WARNING
WARNING

hideyukn88 avatar Mar 22 '23 18:03 hideyukn88

@sebbelese, also please share output from reg QUERY "HKCU\Software\Microsoft\Terminal Server Client" and reg QUERY "HKLM\Software\Microsoft\Terminal Server Client", my current suspicion is that your corporate policy disables some remote desktop features, thanks!

hideyukn88 avatar Mar 22 '23 21:03 hideyukn88

Hi @hideyukn88 ,

Thanks for continuing to investigate.

Yes, I see the warning:

[12:27:04.798] disp_monitor_sanity_check_layout:---INPUT---
[12:27:04.798]  rdpMonitor[0]: x:0, y:0, width:2560, height:1440, is_primary:1
[12:27:04.798]  rdpMonitor[0]: physicalWidth:0, physicalHeight:0, orientation:0
[12:27:04.798]  rdpMonitor[0]: desktopScaleFactor:0, deviceScaleFactor:0
[12:27:04.798]  rdpMonitor[0]: scale:1, client scale :1.00
[12:27:04.798] HiDef-RAIL is required for RAIL.
[12:27:04.798] unable to checkDescriptor for 0x55d9c9f577e0
[12:27:05.154] xf_peer_adjust_monitor_layout:
[12:27:05.154]   DesktopWidth:2560, DesktopHeight:1440
[12:27:05.154]   UseMultimon:0
[12:27:05.154]   ForceMultimon:0
[12:27:05.154]   MonitorCount:3
[12:27:05.154]   HasMonitorAttributes:1
[12:27:05.154]   HiDefRemoteApp:0
[12:27:05.154]
WARNING
WARNING
WARNING: multiple monitor is not supported in non HiDef RAIL mode
WARNING
WARNING
[12:27:05.154] disp_monitor_sanity_check_layout:---INPUT---
[12:27:05.154]  rdpMonitor[0]: x:0, y:0, width:2560, height:1440, is_primary:1
[12:27:05.154]  rdpMonitor[0]: physicalWidth:0, physicalHeight:0, orientation:0
[12:27:05.154]  rdpMonitor[0]: desktopScaleFactor:0, deviceScaleFactor:0
[12:27:05.154]  rdpMonitor[0]: scale:1, client scale :1.00
[12:27:05.154] HiDef-RAIL is required for RAIL.
[12:27:05.154] unable to checkDescriptor for 0x55d9c9f577e0

Output of reg QUERY "HKCU\Software\Microsoft\Terminal Server Client"

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client
    EnableAdvancedRemoteFXRemoteAppSupport    REG_DWORD    0x0

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\hwtest
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\LocalDevices
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers

Output of reg QUERY "HKLM\Software\Microsoft\Terminal Server Client"

HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\Default
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\IME Mapping Table
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\TrustedGateways

sebbelese avatar Mar 23 '23 11:03 sebbelese

@sebbelese, below registry key setting is disabling the feature WSL/WSLg depneds on, if this key is removed or set the value to 1, then msrdc.exe will properly start up and no more cursor blinking. I guess this is set by your corporate policy? thanks!

HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client EnableAdvancedRemoteFXRemoteAppSupport REG_DWORD 0x0

hideyukn88 avatar Mar 23 '23 16:03 hideyukn88

Changing this setting to 1 fixes the issue, and allows to run Linux GUI apps. I will check with my company IT why it was disabled.

Maybe some clear warning or error should be useful in this case. I am not sure if I should close the issue, I leave it into your hands.

Thanks for taking the time to look into this problem!

sebbelese avatar Mar 23 '23 18:03 sebbelese

I just wanted to share that I also experienced the same problem, but in my case it was caused by Citrix.

I followed the workaround provided by @hideyukn88 in this article (https://support.citrix.com/article/CTX107825/how-to-disable-citrix-api-hooks-on-a-perapplication-basis), and I excluded msrdc.exe.

Since then, the blinking has stopped. Thanks guys!

metix avatar Apr 14 '23 17:04 metix

I just wanted to share that I also experienced the same problem, but in my case it was caused by Citrix.

I followed the workaround provided by @hideyukn88 in this article (https://support.citrix.com/article/CTX107825/how-to-disable-citrix-api-hooks-on-a-perapplication-basis), and I excluded msrdc.exe.

Since then, the blinking has stopped. Thanks guys!

Ah, finally, thank you. -- to add a bit of convenience here the .reg file for the two switches:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\CtxHook]
"ExcludedImageNames"="msrdc.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Citrix\CtxHook]
"ExcludedImageNames"="msrdc.exe"

tobiaswaggoner avatar Jul 14 '23 08:07 tobiaswaggoner

same problem, this reg key seemed to have resolved it. For me it happens every time I open up my WSL terminal in a citrix environment on win 10 22h2

jku-sr avatar Jul 28 '23 13:07 jku-sr