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

Graphics apps don't work #362

Open mgateno opened 3 years ago

mgateno commented 3 years ago

Environment

Windows build number: Microsoft Windows [Version 10.0.22000.65]
Your Distribution version: Ubuntu Release:        20.04
Your WSLg version: 1.0.24 6/27/2021

Steps to reproduce

Just tried to execute any installed graphic app and it hangs. Nothing happens.

WSL logs:

marco@NC-0720:/mnt/wslg$ more versions.txt WSLg ( x86_64 ): 1.0.24+Branch.main.Sha.b42023b5fed7567955f4c6c36123a5cf22e9292a Mariner: VERSION="1.0.20210224" FreeRDP: b05321cd4e6a862aef76163a69db4e1910245736 weston: ed4f3bbbf5efbd5bde880704bc03497f2446c3f2 pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5 mesa: marco@NC-0720:/mnt/wslg$

Expected behavior

I used to have a full gnome install and used a windows xserver to create a GUI. I uninstalled gnome and dependencies and the xserver from windows. I updated WSL and installed the WLSg, then updated all packages.

Actual behavior

When I try to run any linux GUI app it just hangs and does nothing.

marcatredhat commented 3 years ago

I have the same issue on a fresh install of Fedora Remix. Either the app hangs or I get a dbus error: VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2) [000055a65169f8d0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused [000055a6516d8290] dbus interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally without any error message [000055a6516d8290] main interface error: no suitable interface module [000055a651557b50] main libvlc error: interface "dbus,none" initialization failed

hideyukn88 commented 3 years ago

@mgateno, thanks for reporting the issue. if you have previous installation of another X server solution, would you please go through the steps at below wiki if it helps?

https://github.com/microsoft/wslg/wiki/Diagnosing-%22cannot-open-display%22-type-issues-with-WSLg

hideyukn88 commented 3 years ago

@marcatredhat, have you tried another Linux distro? such as Ubuntu? Does the issue only happens with Fedora Remix? thanks!

mgateno commented 3 years ago

I am able to make it work by fixing the DISPLAY env variable as well as the symbolic link for the .X11-unix dir however after a time it reverts itself back to the previous state (DISPLAY echoes IP address for my computer and symbolic link is replaced by an actual subdirectory under /tmp.

Also another situation is that windows cannot be resized. See result of trying to resize a window Screenshot 2021-07-16 131356

onomatopellan commented 3 years ago

@mgateno Try running code in Wayland with code --enable-features=UseOzonePlatform --ozone-platform=wayland or without gpu with code --disable-gpu. If it works then it's same issue as #273

crramirez commented 3 years ago

I have the same issue on a fresh install of Fedora Remix. Either the app hangs or I get a dbus error: VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2) [000055a65169f8d0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused [000055a6516d8290] dbus interface error: Failed to connect to the D-Bus session daemon: /usr/bin/dbus-launch terminated abnormally without any error message [000055a6516d8290] main interface error: no suitable interface module [000055a651557b50] main libvlc error: interface "dbus,none" initialization failed

Hello @marcatredhat,

I tried to reproduce the issue and for me, it is working so let's review some things:

  1. After starting Fedora Remix for the first time, I followed these instructions to install VLC: https://www.fosslinux.com/689/how-to-install-vlc-media-player-on-fedora-24.htm#:~:text=Step%201.%20Launch%20the%20Fedora%20Software%20Center.%20Step,following%20command%20and%20press%20enter%20to%20install%20VLC.
  2. Be sure that you are in the latest version of Fedora Remix: cat /etc/os-release .... FEDORA_REMIX_VERSION=34.5.6
  3. Check the DISPLAY ... echo $DISPLAY should be :0
  4. If you see some discrepancies in step 2 or 3, run upgrade.sh. Then be sure that you have the latest image for the next time checking updates in Store.
  5. To get rid of dbus errors (that don't stop you from running vlc) install dbus-x11: sudo dnf install dbus-x11
  6. After any changes, close Fedora Remix and start again.
  7. VLC should run now from the Start Menu shortcut.

Tell me how it is going

Regards, Carlos

crramirez commented 3 years ago

I am able to make it work by fixing the DISPLAY env variable as well as the symbolic link for the .X11-unix dir however after a time it reverts itself back to the previous state (DISPLAY echoes IP address for my computer and symbolic link is replaced by an actual subdirectory under /tmp.

Also another situation is that windows cannot be resized. See result of trying to resize a window Screenshot 2021-07-16 131356

@mgateno look into your /etc/profile.d a script called wsl integration or something similar, it would be the one which changes the variables.

mgateno commented 3 years ago

I am able to make it work by fixing the DISPLAY env variable as well as the symbolic link for the .X11-unix dir however after a time it reverts itself back to the previous state (DISPLAY echoes IP address for my computer and symbolic link is replaced by an actual subdirectory under /tmp. Also another situation is that windows cannot be resized. See result of trying to resize a window Screenshot 2021-07-16 131356

@mgateno look into your /etc/profile.d a script called wsl integration or something similar, it would be the one which changes the variables.

No such script..

marco@NC-0720:/etc/profile.d$ ls -la total 72 drwxr-xr-x 2 root root 4096 Jun 13 09:24 . drwxr-xr-x 143 root root 12288 Jul 17 09:47 .. -rw-r--r-- 1 root root 96 Dec 5 2019 01-locale-fix.sh -rw-r--r-- 1 root root 1557 Feb 17 2020 Z97-byobu.sh -rwxr-xr-x 1 root root 3417 Jan 18 10:40 Z99-cloud-locale-test.sh -rwxr-xr-x 1 root root 873 Jan 18 10:40 Z99-cloudinit-warnings.sh -rw-r--r-- 1 root root 833 Feb 2 03:21 apps-bin-path.sh -rw-r--r-- 1 root root 729 Feb 2 2020 bash_completion.sh -rw-r--r-- 1 root root 1003 Aug 13 2019 cedilla-portuguese.sh -rw-r--r-- 1 root root 1107 Nov 3 2019 gawk.csh -rw-r--r-- 1 root root 757 Nov 3 2019 gawk.sh -rw-r--r-- 1 root root 349 Oct 28 2020 im-config_wayland.sh -rwxr-xr-x 1 root root 898 Sep 23 2020 update-motd.sh -rw-r--r-- 1 root root 1368 Jun 11 2020 vte-2.91.sh -rw-r--r-- 1 root root 966 Jun 11 2020 vte.csh -rw-r--r-- 1 root root 954 Mar 26 2020 xdg_dirs_desktop_session.sh marco@NC-0720:/etc/profile.d$

crramirez commented 3 years ago

And anything strange in your .bashrc?

mgateno commented 3 years ago

@mgateno Try running code in Wayland with code --enable-features=UseOzonePlatform --ozone-platform=wayland or without gpu with code --disable-gpu. If it works then it's same issue as #273

I was able to make it work using the '--disable-gpu´ switch, so it seems that it is the same issue. However it did not run at all with the Wayland option

marco@NC-0720:\~$ code --enable-features=UseOzonePlatform --ozone-platform=wayland To use Visual Studio Code with the Windows Subsystem for Linux, please install Visual Studio Code in Windows and uninstall the Linux version in WSL. You can then use the code command in a WSL terminal just as you would in a normal command prompt. Do you want to continue anyway? [y/N] y To no longer see this prompt, start Visual Studio Code with the environment variable DONT_PROMPT_WSL_INSTALL defined. Warning: 'enable-features' is not in the list of known options, but still passed to Electron/Chromium. Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium. marco@NC-0720:\~$

mgateno commented 3 years ago

And anything strange in your .bashrc?

I found a statement that has to do with the DISPLAY env var, however nothing on the sym link. Maybe one thing leads to the other?

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

I'm making the change and see how it behaves

crramirez commented 3 years ago

Maybe. I don't know which processes change this sym link

mgateno commented 3 years ago

@onomatopellan @crramirez I think I found the file in question as far as the symlink

/etc/init.d/x11-common. I just don't know enough how to change it. (I added the TXT extension in order to upload it to GH x11-common.txt

crramirez commented 3 years ago

It is a service. It shouldn't be executed if you don't explicily call it via sudo service x11-common start or /etc/init.d/x11-common start

mgateno commented 3 years ago

Interesting.. however it is written to do exactly what's happening. Could it be triggered by something else? can the very process of launching an app trigger it?

crramirez commented 3 years ago

You can rename it and see what happens

mgateno commented 3 years ago

I renamed it but the symlink still got updated, so that wasn't it. Curious why some apps appear to launch as a remote desktop and others don't? The remote desktop apps appear to be more prone to failures and crashes

mgateno commented 3 years ago

I've been reading up on this and it seems that /tmp/.X11-unix is where X11 writes its socket file to communicate with the client. In my case, I previously had installed a full gnome desktop which I ran with an XServer Windows app. I uninstalled all of that (as far as I can tell).

I can remove and replace the /tmp/.x11-unix dir with the link to /mnt/wslg/.X11-unix, however it gets erased and written back again to "default"

I have looked all around but cannot pinpoint the proecess/config file responsible.

crramirez commented 3 years ago

OK for me it was not clear if you installed a bunch of GUI apps from gnome or the full gnome-desktop. In the last comment, you said full gnome-desktop. Specifically, gnome-desktop requires systemD to work. Did you install SystemD? It doesn't behave well with WSLG at least you have the latest update for the script that you used.

Regards

mgateno commented 3 years ago

I do have systemd installed and running

marco@NC-0720:\~$ ps -ef|grep systemd root 1 0 0 08:40 ? 00:00:00 /lib/systemd/systemd --unit=basic.target root 46 1 0 08:40 ? 00:00:00 /lib/systemd/systemd-journald root 64 1 0 08:40 ? 00:00:00 /lib/systemd/systemd-udevd systemd+ 69 1 0 08:40 ? 00:00:00 /lib/systemd/systemd-networkd message+ 252 1 0 08:40 ? 00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only root 364 1 0 08:40 ? 00:00:00 /lib/systemd/systemd-logind marco 371 1 0 08:40 ? 00:00:00 /lib/systemd/systemd --user marco 390 371 0 08:40 ? 00:00:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only marco 1056 380 0 08:47 pts/0 00:00:00 grep --color=auto systemd marco@NC-0720:~$

see attached list of all installed packages. installed.txt

crramirez commented 3 years ago

I recommend you to check: https://github.com/diddledan/one-script-wsl2-systemd he managed to run systemd alongside WSLg

mgateno commented 3 years ago

I actually don't need to run full gnome or xserver. Can't I just uninstall systemd? I've been wanting to "fix" this as a learning experience but I really don't have anything that I must keep in my WSL environment right now. Probably better to delete and start over?