genie icon indicating copy to clipboard operation
genie copied to clipboard

WSLg Apps not opening Error: no DISPLAY environment variable specified

Open TylerJaacks opened this issue 3 years ago • 3 comments

Windows version (build number): 22000.376

Linux distribution: Ubuntu Windows Store

Genie version: 1.44

Describe the bug

  • Safely within bottle. ➜ ~ firefox Error: no DISPLAY environment variable specified

Confirm that you are running inside the bottle: ➜ ~ genie -b inside

To Reproduce Steps to reproduce the behavior:

  1. sudo apt-get install firefox
  2. firefox
  3. See error

Expected behavior Firefox opens.

I confirm that I have read the ENTIRE supplied readme file and checked for relevant information on the repository wiki before raising this issue, and that if the solution to this issue is found in either location, it will be closed without further comment:

  • [x] Yes.

TylerJaacks avatar Dec 31 '21 23:12 TylerJaacks

Try sudo systemctl enable wslg-xwayland.socket

letrhee avatar Jan 12 '22 03:01 letrhee

Not useful, there're several player in this issue:

  1. wslg-xwayland.socket / wslg-xwayland.socket: Create a socket at /tmp/.X11-unix
  2. tmpfiles.d/wslg.conf (check both under /etc and /usr/lib): Link /tmp/.X11-unix to /mnt/wslg/.X11-unix
  3. systemd's own /usr/lib/tmpfiles.d/x11.conf: Remove all file under /tmp/.X11-unix
  4. WSL's own bind mounting from /tmp/.X11-unix to /mnt/wslg/.X11-unix

For me, 4 is conflicting with 1 2 3, as wslg-xwayland will overwrite the original socket, wslg.conf will do a symlink, systemd will delete tmp folder, all of these will kill the original X11 socket. There're several working cases:

  1. Disable 134 & Use 2 only: DISPLAY variable will be set correctly
  2. Disable 234 & Use 1 only: DISPLAY variable will be empty, but manually setting it to :0 would still make wslg working
  3. Disable 123 & Use 4 only: the original, non-genie case, OFC working

So I chose to disable 134: I killed 4 by umounting /tmp/.X11-unix before genie, and killed 1 by masking wslg-xwayland*, and make sure there's /etc/tmpfiles.d/wslg.conf

NyaMisty avatar Aug 09 '22 10:08 NyaMisty

In theory, 1 should not exist alongside 2 on a clean genie installation; 2 was intended as a replacement for one. 2 also shouldn't clash with 3, because systemd-tmpfiles consolidates the various .confs before acting on them.

Not sure about 4. I see a symlink there pre-genie, not a bind mount.

cerebrate avatar Sep 23 '22 18:09 cerebrate