GUI launching slow
Environment
Windows build number: 10.0.22000.100
Your Distribution version: Ubuntu 20.04
Your WSLg version:1.0.24
Steps to reproduce
- enter the normal Linux terminal
- run any GUI app like gedit
WSL logs:
Expected behavior
Opening performance same as launching from windows search or from the command "wslg APP"(in this case gedit)
Actual behavior
Opening is about minutes and more, instead ,launching from windows takes few seconds.
@LoreBadTime, thanks for reporting the issue. May I ask the slowness only happens at first launch of Linux GUI app? We do aware of the slowness caused by fontconfig initialization since WSLg uses Windows fonts as well and it has to access via /mnt/c which is slower filesystem, but this only happens at first time after WSL VM started. Thanks!
Hi there,no this happens also after few launches,the main issue is that launching directly from Linux causes a slow launch(even 10 minutes), launching from Windows instead is fast;this happens,in my case,every time a app is launching
@LoreBadTime, if I understand correctly, the slowness occurs at your end by launching, for example, xclock from xterm (= launching any Linux GUI app from Linux terminal), is this correct? So far I haven't been able to observe the slowness. Would you please run app under strace if it shows some clue? Thanks!
straceout.txt this is the strace output,idk how much is happening,but maybe the program is stuck in some kind of loop?
I have this problem too - gedit or any other graphical app consistently takes minutes to run. On last timing it took 8m 50s. Assume some stuff is sitting waiting to timeout?
I've previously had GWSL (https://opticos.github.io/gwsl/) installed and I'm wondering if there is some leftover config that is still trying to connect to a nonexistent server? Just a thought. I don't know where the config would be though, so would appreciate any pointers.
I found my answer in #26 - $DISPLAY was set to 172.24.96.1:0.0. After setting it to :0 apps start quickly.
For reference this gets left in .bashrc and .profile even after uninstalling GWSL so I guess this (for me) is a GWSL uninstall bug
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 #GWSL
export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') #GWSL
I can confirm with @halfninja that this is a GWSL bug.
GWSL cannot detect when it is uninstalled so it cannot automatically remove its changes. However, there is a builtin button to "clean up" its changes to .profile and .bashrc.
I also came across this issue after I try to visualize the xfce4 desktop through VcXsrc. My method to resolve this issue is commenting out the below 2 lines and then restarting WSL2. Then it becomes normal.
export DISPLAY=xx.xx.xx.xx:0 export LIBGL_ALWAYS_INDIRECT=1
Thanks for reminding me, I'd also had vcXsrv and had manually set a DISPLAY in my .bashrc to get around weirdness - getting rid of it after upgrading to Windows 11 and removing vcXsrv fixed everything!
To me, the solutions written above do not solve the problem.
The apps launch but the GUI is frighteningly slow, and reacts with MINUTE delays to clicks, opening menus, etc. (after it loads).
I have tried deleting the GWSL export lines from .bashrc and .profile, but nothing has changed.
What am I missing?
@f-liva That sounds like a different problem from what's described here (which is just about launch time, not sluggish behaviour once launched) so I'd raise a new issue.
Was this ever solved? I'm running Ubuntu under WSL on a brand new Windows 11 Dell laptop, and launching GEDIT (which I have routinely been doing for years) takes tens of seconds each time. Notes :
- My DISPLAY variable is set to :0.
- There is no ~/.xinitrc file.
- strace shows the delay happens after "poll([{fd=11, events=POLLIN}], 1, 25000"
- Remove the WSLg preview app
- Reboot
- Update WSL from the terminal
- Reinstall distro having the problem
- Check to make sure it's on WSL2, and change it if it's not
Then, see if you're still running into those problems.
Andrew - many thanks for that rapid reply.
Forgive me if I ask for some additional information. I'm merely a developer of numerical libraries and console applications (with Tcl/Tk graphics) that run on Windows, Unix and macOS, and amazingly ignorant of systems management on any of the platforms.
- Remove the WSLg preview app - do I type "sudo apt remove WSLg" in the WSL terminal window?
- Reboot - I assume this means the Windows 11 host, not just restarting the WSL session?
- Update WSL from the terminal - does this mean type "wsl --update" in the WSL terminal?
- Reinstall distro having the problem - I'm unclear on what exactly I need to do. And will it delete all my $HOME... files?
- Check to make sure it's on WSL2, and change it if it's not - does this meant type "wsl -l -v" into Powershell?
Sorry if this is trying your patience.
p.s. I can't get anywhere even with Step 1. I don't know things like whether "WSLg preview app" is something in addition to WSL or a variant of WSL.
I am also disheartened. What I did when I got my last Dell laptop a decade ago was install VirtualBox and create a VM running Ubuntu. It just worked. This time, with my shining new Dell laptop running Windows 11 Pro, all three of my attempts to set up an Ubuntu VM have either failed or fallen short:
- The Hyper-V one takes literally dozens of start/connect cycles before eventually it boots. There must be some race condition going on.
- VirtualBox never gets as far as installing Ubuntu - it just hangs.
- WSL almost hits the spot but gedit is unusable because of the loading time and I have to resort to using nano (or might revisit emacs) .
Andrew - many thanks for that rapid reply.
Forgive me if I ask for some additional information. I'm merely a developer of numerical libraries and console applications (with Tcl/Tk graphics) that run on Windows, Unix and macOS, and amazingly ignorant of systems management on any of the platforms.
- Remove the WSLg preview app - do I type "sudo apt remove WSLg" in the WSL terminal window?
- Reboot - I assume this means the Windows 11 host, not just restarting the WSL session?
- Update WSL from the terminal - does this mean type "wsl --update" in the WSL terminal?
- Reinstall distro having the problem - I'm unclear on what exactly I need to do. And will it delete all my $HOME... files?
- Check to make sure it's on WSL2, and change it if it's not - does this meant type "wsl -l -v" into Powershell?
Sorry if this is trying your patience.
- It would be an app installed on the Windows side of things, the preview isn't needed anymore unless you want strange bugs.
- Yes.
- Yes.
- If you need your home files, install a new instance of the distro first to transfer things over and replicate like you had things before uninstalling the broken one.
- Yes.
p.s. I can't get anywhere even with Step 1. I don't know things like whether "WSLg preview app" is something in addition to WSL or a variant of WSL.
I am also disheartened. What I did when I got my last Dell laptop a decade ago was install VirtualBox and create a VM running Ubuntu. It just worked. This time, with my shining new Dell laptop running Windows 11 Pro, all three of my attempts to set up an Ubuntu VM have either failed or fallen short:
- The Hyper-V one takes literally dozens of start/connect cycles before eventually it boots. There must be some race condition going on.
- VirtualBox never gets as far as installing Ubuntu - it just hangs.
- WSL almost hits the spot but gedit is unusable because of the loading time and I have to resort to using nano (or might revisit emacs) .
There are some incompatibilities with VirtualBox when some of the requirements for WSL are turned on.
- See this: https://learn.microsoft.com/en-us/windows/wsl/faq#will-i-be-able-to-run-wsl-2-and-other-3rd-party-virtualization-tools-such-as-vmware--or-virtualbox-
Your advice is much appreciated. There is nothing called WSLg installed on the Windows 11 side - and I tried searching for the string "WSLg" in the list. This presumably eliminates Steps 1 and 2. I tried "wsl --update" and it said I had the latest version. The current VM is WSL2 so presumably a reinstall will be the same.
I'll check out the link. I had tried disabling Hyper-V to test VirtualBox but to no avail.
I'm wondering if it's all to do with Windows 11 update 24H2. Another symptom I'm getting is very slow loading of some newly GCC-compiled C programs, all on the Windows side.
I'm glad my ancient Windows 10 Dell Precision M4700 is still running, VirtualBox and all...
Your advice is much appreciated. There is nothing called WSLg installed on the Windows 11 side - and I tried searching for the string "WSLg" in the list. This presumably eliminates Steps 1 and 2. I tried "wsl --update" and it said I had the latest version. The current VM is WSL2 so presumably a reinstall will be the same.
I'll check out the link. I had tried disabling Hyper-V to test VirtualBox but to no avail.
I'm wondering if it's all to do with Windows 11 update 24H2. Another symptom I'm getting is very slow loading of some newly GCC-compiled C programs, all on the Windows side.
I'm glad my ancient Windows 10 Dell Precision M4700 is still running, VirtualBox and all...
Luckily I work in IT, and I can certainly tell you that what you're experiencing is a CPU slowdown everywhere in the OS, not caused by WSL, or Hyper-V.
I'd recommend restoring to a version of Windows 11 before the 24H2 update, as there have been numerous performance issues I've seen when I've had users upgrade to that version.
I followed most of the suggestions mentioned here but the problem persists. I did notice that for gEdit, when I try to run it normally, it takes about 30 - 60 seconds to open, but when I run it using sudo it opens immediately.
As a total newbie to the Linux world, I can't make sense of it.
I decided to give WSL2 a try and immediately ran into this issue. Running a GUI app as user was slow. As root it launched instantly. strace showed "poll([{fd=11, events=POLLIN}], 1, 25000"
After some time of poking around I was finally able to fix it by uninstalling xdg-desktop-portal-gtk and xdg-desktop-portal.
sudo apt remove xdg-desktop-portal xdg-desktop-portal-gtk
Now GUI apps launch immediately as user.
For whatever reason, without having changed anything since my previous reply, I can now run gedit normally, with no perceptible startup delay. If the problem returns I shall no doubt try uninstalling xdg-desktop-portal-gtk and xdg-desktop-portal as TeeHunter13 has suggested.
In recent times I have been using WSL as my Linux VM very successfully, while my Hyper-V VM continues not to work properly, requiring dozens of restarts before eventually booting. For what I do, I think WSL has won.
I decided to give WSL2 a try and immediately ran into this issue. Running a GUI app as user was slow. As root it launched instantly. strace showed "poll([{fd=11, events=POLLIN}], 1, 25000"
After some time of poking around I was finally able to fix it by uninstalling xdg-desktop-portal-gtk and xdg-desktop-portal.
sudo apt remove xdg-desktop-portal xdg-desktop-portal-gtk
Now GUI apps launch immediately as user.
Hi, doing this worked for me, gedit launches instantly without being root!