microsoft / wslg

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

GUI Applications Launch in Ubuntu but not Gentoo #1235

Open peppapig450 opened 2 months ago

peppapig450 commented 2 months ago

Windows build number:

Windows 11 Insider Build 26040

Your Distribution version:

Gentoo

Your WSL versions:

WSL version: 2.2.3.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.26040.1000

Steps to reproduce:

Run any GUI application on Gentoo and you get Error: Can't open display: :0

The same thing works perfectly on Ubuntu.

WSL logs:

stderr.log weston.log

I can provide the log files for the working Ubuntu too.

WSL dumps:

No response

Expected behavior:

image

Actual behavior:

image

I had issues logging into the Gentoo vm and getting systemd to work with the user account and I bypassed this by logging in like this

wsl -u root doas -u nick /bin/bash

and then running doas systemctl restart user@1000 , maybe it is somehow related to this ?

Also worth noting that the X0 socket in /tmp is not being generated as well image

peppapig450 commented 2 months ago

~~On a whim I installed sway to draw in xwayland as a dependency and it fixed the problem. Maybe add a note that in order for wslg to work xwayland must be installed on the distro.~~

It turns out that wayland apps like sway are able to run just fine, but X11 apps are not still throwing the cannot display error.

viruscamp commented 2 months ago

Please paste outputs of command below:

env | grep -E "XDG|DISPLAY|PULSE"
ls -l $XDG_RUNTIME_DIR /tmp/.X11-unix/

ls -l /mnt/wslg/PulseServer /mnt/wslg/.X11-unix/ /mnt/wslg/runtime-dir/

findmnt /tmp
findmnt /tmp/.X11-unix
findmnt /run/user/$(id -u)
findmnt $XDG_RUNTIME_DIR
peppapig450 commented 2 months ago
env | grep -E "XDG|DISPLAY|PULSE"
WAYLAND_DISPLAY=wayland-0
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000/
PULSE_SERVER=unix:/mnt/wslg/PulseServer

/run/user/1000/:
total 0
srw-rw-rw- 1 nick nick   0 Apr 25 01:56 bus
drwxr-xr-x 6 nick nick 160 Apr 25 01:56 systemd

/tmp/.X11-unix/:
total 0

ls -l /mnt/wslg/PulseServer /mnt/wslg/.X11-unix/ /mnt/wslg/runtime-dir/
srwxrwxrwx 1 nick nick   0 Apr 25 01:56 /mnt/wslg/PulseServer

/mnt/wslg/.X11-unix/:
total 0
srwxrwxrwx 1 nick nick 0 Apr 25 01:56 X0

/mnt/wslg/runtime-dir/:
total 0
drwx------ 3 nick nick 60 Apr 25 01:56 dbus-1
drwx------ 2 nick nick 80 Apr 25 01:56 pulse
srwxrwxrwx 1 nick nick  0 Apr 25 01:56 wayland-0
-rw-rw---- 1 nick nick  0 Apr 25 01:56 wayland-0.lock

findmnt /tmp
TARGET
     SOURCE
           FSTYPE OPTIONS
/tmp tmpfs tmpfs  rw,nosuid,nodev,nr_inodes=1048576

findmnt /tmp/.X11-unix
TARGET         SOURCE           FSTYPE OPTIONS
/tmp/.X11-unix none[/.X11-unix] tmpfs  ro,relatime

findmnt /run/user/$(id -u)
TARGET         SOURCE
                     FSTYPE OPTIONS
/run/user/1000 tmpfs tmpfs  rw,nosuid,nodev,relatime,size=813760k,nr_inodes=203440,mode=700,uid=1000,gid=1000

findmnt $XDG_RUNTIME_DIR
TARGET         SOURCE
                     FSTYPE OPTIONS
/run/user/1000 tmpfs tmpfs  rw,nosuid,nodev,relatime,size=813760k,nr_inodes=203440,mode=700,uid=1000,gid=1000
viruscamp commented 2 months ago

You can follow the instructions: https://github.com/viruscamp/wslg-links

peppapig450 commented 2 months ago

I knew it was a systemd thing but I wasn't sure what. Thank you, I'll try that when I get home

MangoFizz commented 2 months ago

@viruscamp it worked like a charm, thank you! No idea why it suddenly stopped working in the first place.