microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.22k stars 305 forks source link

GUI windows open and close immediately #1132

Open D3vil0p3r opened 1 year ago

D3vil0p3r commented 1 year ago

Windows build number:

Microsoft Windows [Version 10.0.22621.2428]

Your Distribution version:

Arch Linux rolling with systemd

Your WSL versions:

WSL version: 1.2.5.0 Kernel version: 5.15.90.1 WSLg version: 1.0.51 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.2428

Steps to reproduce:

sudo pacman -S gnome-keyring libsecret

Try several times:

secret-tool store --label='test' spaghetti pomodoro

Password: <type any char and press ENTER>

if no GUI popup window open for 1 second and close but Password just hangs, CTRL+C and retry. When you retry, it can happen that GUI popup window of secret-tool appears for 1 second and then closes automatically: image

Same behavior if I use gedit or xfce4-terminal.

Why is it closing automatically?

WSL logs:

weston.log pulseaudio.log stderr.log

Additional logs:

journalctl -xe

Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: calling the PromptReady method on /org/gnome/keyring/Prompt/p4@:1.28
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: acquired name: org.gnome.keyring.PrivatePrompter
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gdk: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: returned from the PromptReady method on /org/gnome/keyring/Prompt/p4@:1.28
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: received PerformPrompt call from callback /org/gnome/keyring/Prompt/p4@:1.28
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: receiving secret exchange: [sx-aes-1]\npublic=OBjwCWtFEIQIVJfMO0U3+grI4i/CzI4Zaysr2MB3fEi8yo8RSjcg>
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: deriving shared transport key
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: deriving transport key
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: starting password prompt for callback /org/gnome/keyring/Prompt/p4@:1.28
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gdk: gdk_seat_grab: assertion 'GDK_IS_SEAT (seat)' failed
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: gdk_seat_grab: assertion 'GDK_IS_SEAT (seat)' failed
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: unknown grab status: 5
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: unknown grab status: 5
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: Gcr: could not grab keyboard: unknown
Nov 03 00:07:57 DESKTOP-LV4580H gcr-prompter[1636]: could not grab keyboard: unknown

WSL dumps:

/mnt/wslg/dumps folder empty.

Expected behavior:

The GUI popup window must not close automatically.

Actual behavior:

GUI popup window opens and closes automatically after one second.

D3vil0p3r commented 1 year ago

I got the cause. It is very weird but... I have several .desktop files in /usr/share/applications. Some of these are the cause of my issue. According to my tests, if in /usr/share/applications directory there is JUST ONE .desktop file with the content of Exec= field between 242 and 256 characters in length (boundary included), GUI apps like gedit don't work (not appearing or open and close immediately).

As example, edit one of your .desktop files and add the following after Exec=:

testesttesttesttestshell-rocket "if command -v osr-osrframework-cli &> /dev/null;then osr-osrframework-cli -h;$SHELL;else echo \\"osr-osrframework-cli is not installed. I'm retrieving it for you...\\";sudo pacman -S osrframework;osr-osrframework-cli -h;$SHELL;fi;"

that are 256 chars, and run gedit or xfce4-terminal. Their GUI won't work. Now add the following after Exec= on the same .desktop file:

testesttesttesttestshell-rocket "if command -v osr-osrframework-cli &> /dev/null;then osr-osrframework-cli -h;$SHELL;else echo \\"osr-osrframework-cli is not installed. I'm retrieving it for you...\\";sudo pacman -S osrframework;osr-osrframework-cli -h;$SHELL;fi;"

that are 264 chars, and run gedit or xfce4-terminal. Their GUI will work as expected.

Summarizing, if I have .desktop files outside that boundary above, the GUI apps appear as expected.

I'm using Arch Linux WSL rolling but I guess you can reproduce it in any systemd environment. Why do we get this behavior?