wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Glitches in GUI applications

Open azegas opened this issue 2 years ago • 100 comments

Windows build number:

10.0.22631.0

Your Distribution version:

22.04

Your WSL versions:

WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.2715

Steps to reproduce:

  1. activate wsl on windows
  2. install ubuntu distro either from MS store or from terminal by wsl --install or wsl --install ubuntu
  3. update ubuntu distro sudo apt update && upgrade
  4. install emacs, vlc or nautilus
  5. launch one of those, I get this behavior as described in the screenshots

WSL logs:

stderr.log weston.log pulseaudio.log

WSL dumps:

No response

Expected behavior:

WSL should run gui applications without the glitches.

Actual behavior:

I had wsl working just fine until yesterday! Everything I am about to eplain about was working fine yesterday.

Yesterday I have installed another ubuntu version on my wsl, alongside fully working wsl version(was testing out different emacs versions). So I had 2x ubuntu versions + the default docker wsl's.

This strange gui glitch started to happen when I launch emacs gui application. If I launch it in the terminal - all is good. emacs gui with glitches: emacs

emacs over terminal: emacs_terminal

When I move the emacs gui screen - the glitch dissapears. When I stop moving it - it reappears.

I thought okay I can not work like this, I need to start fresh. I then unregistered both ubuntu distros and went to "add remove programs" to uninstall those ubuntu versions.

I installed ubuntu from terminal by wls --install ubuntu or wsl --install or from ms store, restarts...- same problem.

I then disabled WSL feature. Restarts... installed wsl again, did wsl --set-default-version 2 - same problem.

I then tried to install another GUI application - nautilus and VLC - same probelm with those: nautilus vlc

I then thought thanks god its not related with emacs, its a gui bug in general with all linux applications over wsl. Nothing similar happens on my windows apps.

That helped me to narrow the problem down. Insead of googling "emacs gui glitches in wsl", I started to google for "wsl gui glitches".

I then found out about wslg and that it is responsible for launching gui applications over wsl.

I then installed mobaxterm since I guess it does not use wslg, but uses xserver. I then tried to launch emacs with it:

x server off - emacs launched in terminal mode:

xserver_off

x server on - emacs launched in gui mode:

xserver_on

Finally emacs has no glitches!!!

I dont really want to reset my windows to make wsl not glitch anymore, can you help me find a way what to update/remove/reinstall to make these glitches go away?

Thank you!

p.s. this is everything I have installed right now that I know regarding wsl, hope that helps:

versions

azegas avatar Nov 25 '23 05:11 azegas

Addition with some videos:

Sometimes it works:

https://github.com/microsoft/wslg/assets/78803192/98f11bb5-a0d6-4760-8f49-4840dca11719

Sometimes it does not work:

https://github.com/microsoft/wslg/assets/78803192/729bae6c-db4b-4771-8698-3743e79ce57a

azegas avatar Nov 25 '23 05:11 azegas

I have exactly the same problem.

This is gedit:

image

vielhuber avatar Nov 25 '23 05:11 vielhuber

Downgrading to 2.0.4 seems to be an option:

https://github.com/microsoft/wslg/issues/1130

vielhuber avatar Nov 25 '23 06:11 vielhuber

Downgrading to 2.0.4 seems to be an option:

#1130

Amazing @vielhuber, that sounds promsing. good detective work!

How would one go about with downgrading wsl? Did you succeed? Is the glitching gone for you?

azegas avatar Nov 25 '23 07:11 azegas

I tried:

  • Updated nvidia drivers (via "GeForce Experience")
  • sudo apt update
  • sudo apt upgrade
  • wsl --shutdown via PowerShell (Admin)

Then it worked until a restart.

Identified that after boot I manually once always need to run wsl --shutdown, then reopen wsl and it works from then on until the next restart.

I can't downgrade at the moment and am waiting for an official fix (see https://github.com/microsoft/wslg/issues/1130).

vielhuber avatar Nov 25 '23 07:11 vielhuber

Will wait for an official fix then also.

Untl then I will run my wsl gui applications over https://mobaxterm.mobatek.net/ . Give it a try, it's cool!

azegas avatar Nov 25 '23 07:11 azegas

The exact issue here. @arvydasg could you try the downgrading suggestion?

salarmehr avatar Nov 27 '23 06:11 salarmehr

Surprisingly the issue does not repeat anymore. Will try it if it happens again.

azegas avatar Nov 27 '23 07:11 azegas

Same issue here. Windows 11 with following WSL info

WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.2715

I did an update in Intel Drivers update and Windows Update simultaneously so not sure what broke it. However, I tried the following:

-In .wslgconfig I added

[system-distro-env] ;disable GPU in system-distro LIBGL_ALWAYS_SOFTWARE=1

-Restarted wsl. Worked. -Restarted laptop, the fix still works.

Maybe other people try this and post their feedback.

nikosandreou avatar Nov 27 '23 10:11 nikosandreou

¡Worked for me!

MarcosRguez avatar Nov 27 '23 21:11 MarcosRguez

Same issue here. Windows 11 with following WSL issue

WSL version: 2.0.9.0 Kernel version: 5.15.133.1-1 WSLg version: 1.0.59 MSRDC version: 1.2.4677 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22631.2715

I did an update in Intel Drivers update and Windows Update simultaneously so not sure what broke it. However, I tried the following:

-In .wslgconfig I added

[system-distro-env] ;disable GPU in system-distro LIBGL_ALWAYS_SOFTWARE=1

-Restarted wsl. Worked. -Restarted laptop, the fix still works.

Maybe other people try this and post their feedback.

Worked For Me! Thanks!

bluejoyq avatar Nov 28 '23 05:11 bluejoyq

Same issue unfortunatelly with latest installation in wsl 2 (Ubuntu)

And it's still not fixed..

joeyoropesa-dev avatar Nov 29 '23 19:11 joeyoropesa-dev

I had a similar problem. I installed Kali in WSL then I installed x11-apps just for a simple test.
When I launched xeyes and xcalc it was glitching out. All I had to do to fix it was restart Windows 11.

PS C:\Users\benargee>wsl -v
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2715

Benargee avatar Nov 30 '23 02:11 Benargee

I had a similar problem. I installed Kali in WSL then I installed x11-apps just for a simple test.
When I launched xeyes and xcalc it was glitching out. All I had to do to fix it was restart Windows 11.

PS C:\Users\benargee>wsl -v
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2715

Well that didn't helped me... Probably it's an bug in the code since I'm not the only person who have these issues so I hope that WSLg developers will look into this case and at least try to fix it from their side.

joeyoropesa-dev avatar Nov 30 '23 06:11 joeyoropesa-dev

-In .wslgconfig I added [system-distro-env] ;disable GPU in system-distro LIBGL_ALWAYS_SOFTWARE=1 -Restarted wsl. Worked. -Restarted laptop, the fix still works.

This does not work for me after pc restart. Is the path in %USERPROFILE%/.wslgconfig (not %USERPROFILE%/.wslconfig)?

vielhuber avatar Dec 01 '23 14:12 vielhuber

-In .wslgconfig I added [system-distro-env] ;disable GPU in system-distro LIBGL_ALWAYS_SOFTWARE=1 -Restarted wsl. Worked. -Restarted laptop, the fix still works.

This does not work for me after pc restart. Is the path in %USERPROFILE%/.wslgconfig (not %USERPROFILE%/.wslconfig)?

It is .wslgconfig

nikosandreou avatar Dec 01 '23 14:12 nikosandreou

[system-distro-env] ;disable GPU in system-distro LIBGL_ALWAYS_SOFTWARE=1

Thanks it worked on windows 11 pro 22H2 with Ubuntu. For the one wondering you can create the file .wslgconfig directly in you home folder on windows and copy bluejoyq solution (type %USERPROFILE% as a path in explorer if you dont know where it is). Strangely the solution did not work for my OpenSUSE environment (15.5)

clavnico avatar Dec 01 '23 14:12 clavnico

FYI I had to put the .wslgconfig file in C:\ProgramData\Microsoft\WSL. The WSL folder didn't exist so I had to create it manually.

palapapa avatar Dec 02 '23 20:12 palapapa

So I was having this problem as well, nothing above worked so, identifying the problem in wslg, I disabled it by adding in C:\Users\youruser\ .wslconfig [wsl2] guiApplications=false as suggested in https://github.com/microsoft/wslg/discussions/523 and restarted.

Then I used MobaXterm as X server, exported its display destination in the $DISPLAY variable and all solved.

BiruBear avatar Dec 03 '23 14:12 BiruBear

Same problem. It is intermittent. I have updated NVIDIA and Intel drivers, but that had no effect. The problem still arises, seemingly at random.

analytic-garden avatar Dec 03 '23 19:12 analytic-garden

Same problem. After windows launch stopping wsl and restarting it helps for the day

olliollio avatar Dec 04 '23 08:12 olliollio

When I installed xfce4, I encountered this issue. There was no problem before this.

llanc avatar Dec 04 '23 09:12 llanc

The same happened to me today. Used wsl --shutdown and it worked for now.

HenriqueCA avatar Dec 04 '23 12:12 HenriqueCA

I just ran into this as well on a fresh install of WSL2. wsl --v output:

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2715

Running on a Vega 56 GPU, and didn't experience it on the older version of WSL2 I had installed previously. Updating the AMD drivers didn't resolve it. Following the suggestion in the thread to add the LIBGL_ALWAYS_SOFTWARE=1 to .wslgconfig seems to fix it for me.

What are the implications of setting the LIBGL_ALWAYS_SOFTWARE variable? Just want to make a note if it can (or should) be removed from the configuration if a fix is released.

rjackson6 avatar Dec 05 '23 05:12 rjackson6

I just ran into this as well on a fresh install of WSL2. wsl --v output:

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.2715

Running on a Vega 56 GPU, and didn't experience it on the older version of WSL2 I had installed previously. Updating the AMD drivers didn't resolve it. Following the suggestion in the thread to add the LIBGL_ALWAYS_SOFTWARE=1 to .wslgconfig seems to fix it for me.

What are the implications of setting the LIBGL_ALWAYS_SOFTWARE variable? Just want to make a note if it can (or should) be removed from the configuration if a fix is released.

Well, GPU acceleration in WSLg has been a bit questionable. You can read this:

https://github.com/microsoft/wslg/issues/469

However, there are apps that may expect the GPU acceleration to be on so in case something crashes, you may have to turn it on. From my side, since I do mostly development in WSLg, having it on or off, doesn't bother me. I had it on for a couple of apps that were 'nice-to-use/have', but since this bug, I turned it off. I may turn it on if they fix the bug, but leaving it off won't hurt my daily programming life in WSLg.

nikosandreou avatar Dec 05 '23 10:12 nikosandreou

Unlike seemingly everyone else here ... I don't have this issue when wsl starts up. But if I shut wsl down and restart it only then do I start seeing the issue, until I reboot my computer. I figure I must be doing something wrong when I shut it down and restart it.

dtramer avatar Dec 05 '23 16:12 dtramer

Have same issue

PS C:\Users\*****> wsl --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2715

Benja1972 avatar Dec 06 '23 12:12 Benja1972

Same issue here with latest WSL image

Version WSL : 2.0.14.0
Version du noyau : 5.15.133.1-1
Version WSLg : 1.0.59
Version MSRDC : 1.2.4677
Version direct3D : 1.611.1-81528511
Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Version de Windows : 10.0.19045.3758

Cyterafle avatar Dec 07 '23 16:12 Cyterafle

Same issue running the Quartus installer image My versions for everything are the same as above, except for windows version which is slightly updated

WSL version: 2.0.14.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22635.2850

I've noticed that if I drag and move the window around, it briefly returns the normal expected screen. Not sure how much that helps. If I can be of any other help please let me know.

Spencillian avatar Dec 11 '23 22:12 Spencillian

This reddit post solved it for me.

  • In the Windows directory C:\Users\<username> (also accessible by pasting %USERPROFILE% in the address bar in Explorer), create a file named .wslconfig
  • Open the file and paste the following:
    [wsl2]
    guiApplications = true
    
  • Restart WSL.

I can now run GUI apps without any glitches. Not sure if the issue will reoccur, though

birdue avatar Dec 13 '23 18:12 birdue