wslg icon indicating copy to clipboard operation
wslg copied to clipboard

After Ubuntu 24.04 upgrade, GUI apps are extremely slow to open

Open amalrajan opened this issue 1 year ago • 36 comments
trafficstars

Windows build number:

10.0.22631.0

Your Distribution version:

Ubuntu 24.04

Your WSL versions:

2.1.5.0

Steps to reproduce:

  1. Run nohup nautilus > /dev/null 2>&1 & OR Windows Start Menu -> Launch nautilus Ubuntu app
  2. It takes 30-40 seconds for nautilus window to show up

If you simply do nautilus in terminal:

amalr@ubuntu ~ nautilus
** Message: 19:52:38.704: Connecting to org.freedesktop.Tracker3.Miner.Files
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen

** (org.gnome.Nautilus:57971): WARNING **: 19:53:29.621: Unable to get contents of the bookmarks file: Error opening file /home/amalr/.gtk-bookmarks: No such file or directory

** (org.gnome.Nautilus:57971): WARNING **: 19:53:29.622: Unable to get contents of the bookmarks file: Error opening file /home/amalr/.gtk-bookmarks: No such file or directory

This applies to any app, not just nautilus.

WSL logs:

WslLogs-2024-05-30_18-12-37.zip

WSL dumps:

No response

Expected behavior:

Before upgrading to Ubuntu 24.04, launching GUI apps were instantaneous.

Actual behavior:

After upgrading to Ubuntu 24.04, launching GUI apps takes 30-40 seconds.

amalrajan avatar May 30 '24 22:05 amalrajan

What I've tried so far:

I tried upgrading mesa libraries as I thought this might be related to a broken version

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade

Now when I run nautilus from terminal, I see that my GPU is being detected Even though, it still takes 40 seconds for the app to show up on my screen

For more context, I am running NVIDIA 555 drivers

amalr@ubuntu ~ nautilus
** Message: 13:39:45.834: Connecting to org.freedesktop.Tracker3.Miner.Files
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: Some incorrect rendering might occur because the selected Vulkan device (Microsoft Direct3D12 (NVIDIA GeForce RTX 3060 Laptop GPU)) doesn't support base Zink requirements: feats.features.logicOp have_EXT_custom_border_color have_EXT_line_rasterization

** (org.gnome.Nautilus:9946): WARNING **: 13:40:40.620: Unable to get contents of the bookmarks file: Error opening file /home/amalr/.gtk-bookmarks: No such file or directory

** (org.gnome.Nautilus:9946): WARNING **: 13:40:40.621: Unable to get contents of the bookmarks file: Error opening file /home/amalr/.gtk-bookmarks: No such file or directory
[1]    9946 segmentation fault  nautilus

amalrajan avatar Jun 01 '24 17:06 amalrajan

same problem image

dolorain avatar Jun 11 '24 02:06 dolorain

Same problem here (Ubuntu 24.04), with evince, thunar, zenity, ... although it seems a certain kind of gui applications that have the problem.

E.g. zenity takes 40 seconds to 1 minute to start with:

$ zenity --info --text ok
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen

but yad is quick, xfce4-terminal is quick, glxgears and glxdemo are quick, google-chrome is quick:

$ google-chrome
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
 wsl --status
Default Distribution: Ubuntu-24.04
Default Version: 2

cvnmlr avatar Jun 19 '24 07:06 cvnmlr

  • I also noticed this problem, but it seems not directly related to https://github.com/ubuntu/WSL . Because,
  1. For the following log, there is an issue marked as Confirmed https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/2066353 .
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
  1. For the following log, there is an issue marked as New https://bugs.launchpad.net/ubuntu/+source/linux-firmware/+bug/2067374 , hardware acceleration does not work on Ubuntu 24.04. Although many similar issues point to NVIDIA drivers, I can also observe this on the integrated graphics card of AMD Ryzen 7840HS.
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen

linghengqian avatar Jun 24 '24 11:06 linghengqian

@linghengqian you might be right. my system just became slow on boot after i updated a clean 24.04. then a few reboots later programs starts slow. even terminal pops up after a minute. if a program somehow starts faster it acts like i opened it first time. for example dark theme set system wide but nautilus opens with light theme and ignores user settings. but DEB version of firefox pops up instantly without any issues.

ViBE-HU avatar Jun 24 '24 12:06 ViBE-HU

I have the same problem: the environment is wsl-nixos. When I try to run kitty: image

Parsifa1 avatar Jun 26 '24 08:06 Parsifa1

Try setting the GALLIUM_DRIVER environment variable to "d3d12" as a workaround.

radsaq avatar Jul 11 '24 02:07 radsaq

export GALLIUM_DRIVER=d3d12 does not change the behavior for me, still wait for about 45 seconds

cvnmlr avatar Jul 12 '24 07:07 cvnmlr

Same problem, nautilus and gnome-terminal take 30 seconds to start, and nautilus is loaded with the wrong theme.

dheera avatar Jul 19 '24 07:07 dheera

amalrajan what kernel version are you running?

Since you don't have a custom kernel defined in your .wslconfig, this may be a completely separate issue, or Microsoft may have backported some of the new security.

I am using https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling and when I upgraded to 6.10 any application that uses the GPU (Firefox, Kitty) started taking around 30 seconds to load. I finally tracked it down to the fact that when they were trying to get access to the GPU they were throwing exceptions. I rolled back to kernel 6.9.9 and the problem went away.

I don't have definitive proof that my problem was related to the new security that has been added in 6.10 or I would post it. All I can say for certain is that only apps that use the GPU were affected, and only rolling back the kernel solved my problem.

runningnak3d avatar Jul 26 '24 03:07 runningnak3d

same windows11 home version and 2404

NanoNM avatar Jul 31 '24 07:07 NanoNM

Same symptoms for me, slow with 24.04, fast with 22.04. I also noticed that running under root in 24.04 was fast.

awanka avatar Aug 30 '24 00:08 awanka

amalrajan what kernel version are you running?

Since you don't have a custom kernel defined in your .wslconfig, this may be a completely separate issue, or Microsoft may have backported some of the new security.

I am using https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling and when I upgraded to 6.10 any application that uses the GPU (Firefox, Kitty) started taking around 30 seconds to load. I finally tracked it down to the fact that when they were trying to get access to the GPU they were throwing exceptions. I rolled back to kernel 6.9.9 and the problem went away.

I don't have definitive proof that my problem was related to the new security that has been added in 6.10 or I would post it. All I can say for certain is that only apps that use the GPU were affected, and only rolling back the kernel solved my problem.

the default kernel. I believe it was 5.15.153.1-microsoft-standard-WSL2 across all vanilla installations

amalrajan avatar Aug 30 '24 01:08 amalrajan

Please see what I've reported here #1244 as what your experiencing sounds exactly the same

avlec avatar Sep 11 '24 22:09 avlec

amalrajan你运行的是哪个内核版本?

由于您的 .wslconfig 中没有定义自定义内核,这可能是一个完全独立的问题,或者微软可能已经反向移植了一些新的安全性。

我正在使用https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling,当我升级到 6.10 时,任何使用 GPU 的应用程序(Firefox、Kitty)都开始需要大约 30 秒才能加载。我最终发现,当他们试图访问 GPU 时,他们会抛出异常。我回滚到内核 6.9.9,问题就消失了。

我没有确凿的证据证明我的问题与 6.10 中新增的安全功能有关,否则我会发布它。我唯一能肯定的是,只有使用 GPU 的应用程序才会受到影响,只有回滚内核才能解决我的问题。

image

6.9.9 invalid

dolorain avatar Sep 26 '24 03:09 dolorain

I meet the same problem and I realized that I can't resize the application window

Edge-coordinates avatar Oct 08 '24 12:10 Edge-coordinates

> Please see what I've reported here #1244 as what your experiencing sounds exactly the same

@avlec yes, looks like it, from your report I got to Cannot use GUI apps/tools as Wayland socket doesn't exist in XDG_RUNTIME_DIR, which led me to trying: ln -s /mnt/wslg/runtime-dir/wayland-0* /run/user/$(id -u)/ which works for me to get all gui apps to start quickly now (for all users in my ubuntu 24.04 wsl).

cvnmlr avatar Oct 08 '24 13:10 cvnmlr

> Please see what I've reported here #1244 as what your experiencing sounds exactly the same

@avlec yes, looks like it, from your report I got to Cannot use GUI apps/tools as Wayland socket doesn't exist in XDG_RUNTIME_DIR, which led me to trying: ln -s /mnt/wslg/runtime-dir/wayland-0* /run/user/$(id -u)/ which works for me to get all gui apps to start quickly now (for all users in my ubuntu 24.04 wsl).

does this workaround help on X sessions too?

ViBE-HU avatar Oct 08 '24 16:10 ViBE-HU

@ViBE-HU read the issue I linked. It sounds like it might work from the viruscamp's repo with the workarounds. If you try please post here or on the other thread with your successes or failures.

avlec avatar Oct 08 '24 17:10 avlec

I am C++/Qt-QML developer recently started using WSL2 with Win-11 23H2.

The fix given by virus camp addressed in https://github.com/microsoft/wslg/issues/1244 seems to work. Simply followed the steps at https://github.com/viruscamp/wslg-links

Now only thing is still that 'Zink' error exists: Image

But no worries, work gets done, able to open the nautilus in very few secs instead of waiting it for a minute ! applies for other GUI apps ! cc: @avlec @viruscamp - Thanks a lot!

VjayMathad avatar Oct 18 '24 06:10 VjayMathad

+1, it seems to cure some symptoms only, as the ZINK Error is still present, so I do believer, there needs to be a more general fix to the issue.

LambdaScorpii avatar Oct 21 '24 13:10 LambdaScorpii

Hello,

  • this solution: issuecomment-2421556238
  • and installing the latest graphics drivers from Oibaf PPA

solved all issues for me.

To do this, first follow the steps at https://github.com/viruscamp/wslg-links, and then follow these steps:

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade
Screenshot

czirok avatar Oct 31 '24 07:10 czirok

Should this become an OS patch?

leimao avatar Dec 14 '24 03:12 leimao

Upgrading mesa drivers by using oibaf PPA as suggested in https://github.com/microsoft/wslg/issues/1250#issuecomment-2449206124 changes the WSL to use llvmpipe to render graphics instead of D3D12. According to this issue, this can be observed by running glxinfo -B, and reduction in rendering frame rate.

If this happens, you need to remove the oibaf PPA and revert the affected/upgraded packages to their original versions from the official Ubuntu repositories.

The current solution that worked for me is to solve Wayland issues by following viruscamp steps. To solve MESA, ZLINK, and glx warnings when opening X11 apps, add export GALLIUM_DRIVER=d3d12 to .bashrc file (https://github.com/microsoft/wslg/issues/1250#issuecomment-2221863781).

mhmalmir avatar Jan 17 '25 16:01 mhmalmir

FYI: My current workaround is to plug my monitor into my iGPU. Everything works smoothly in Wayland with no starting delays for apps.

I only use my GPU for machine learning, not for graphics, so if you fall into that camp this workaround can work for you.

dheera avatar Jan 17 '25 22:01 dheera

Same issue here. It looks like this issue has been persisting since 24.04 came out in May 2024, but no official maintainer or no one from Microsoft has acknowledged this issue. It unfortunately also looks like this project (WSLg) has gone a bit stale, which would be a huge shame. @hideyukn88, any way to get your attention on this?

patrikhuber avatar Jan 31 '25 16:01 patrikhuber

export GALLIUM_DRIVER=d3d12 makes the MESA/ZINK/glx errors go away for me, but gedit still takes half a minute to launch, every time, not just the first time.

patrikhuber avatar Jan 31 '25 16:01 patrikhuber

The problem was completely solved for me after simply updating and upgrading apt

sudo apt update 
sudo apt upgrade 

gciaberi avatar Feb 09 '25 08:02 gciaberi

The problem was completely solved for me after simply updating and upgrading apt

  • @gciaberi I tested this on Ubuntu 24.04.1 LTS https://apps.microsoft.com/detail/9NZ3KLHXDJP5 and I would say that I still have to wait about 3 minutes for gnome-text-editor to open.
sudo dpkg-reconfigure locales
sudo apt update && sudo apt upgrade -y
sudo apt install language-pack-gnome-zh-hans-base -y
sudo apt install gnome-text-editor gimp vlc nautilus x11-apps -y
gnome-text-editor ~/.bashrc
  • Image
  • As we can imagine, everyone using WSLg on Ubuntu WSL is still locked to Ubuntu 22.04.

linghengqian avatar Feb 20 '25 13:02 linghengqian

My problem is fixed (on 24.04 'vanilla' install) using this little script (extracted from this link and related links): $ cat fixgui.sh ln -s /mnt/wslg/runtime-dir/wayland-0* /run/user/`id -u`/

For gnote I have to make an exception for some reason, but also works: $ cat gnote export GSK_RENDERER=cairo export GDK_BACKEND=x11 /usr/bin/gnote

For some reason executing fixgui.sh does not work instantly, but after a minute or two, but then I do not experience the slowness anymore (see my experience/post up the trail in this page).

cvnmlr avatar Feb 20 '25 13:02 cvnmlr