ubuntu-wsl2-systemd-script icon indicating copy to clipboard operation
ubuntu-wsl2-systemd-script copied to clipboard

wslg is broken with script

Open mirogl opened this issue 4 years ago • 6 comments

Hi, I had the same problem like described in https://github.com/microsoft/wslg/issues/238

xclock Error: Can't open display: :0

and the only solution for me was https://github.com/microsoft/wslg/issues/238#issuecomment-847804992

export DISPLAY=:0 sudo rm -rf /tmp/.X11-unix ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

Then it works. Is this really related to your script ?

thanks for your feedback.

Miro

mirogl avatar Oct 20 '21 20:10 mirogl

There's a systemd service called systemd-tmpfiles-setup.service that removes the /tmp/.X11-unix link to /mnt/wslg/.X11-unix.

aki-k avatar Oct 22 '21 13:10 aki-k

Is totally related with this script, i created a clean ubuntu install with WSL, then tested xclock (x11-apps) to test GUI Apps until this everything OK. After install this script for snapd availability, the GUI apps throws the Error: Can't open display: :0

kuriel-dev avatar Oct 24 '21 13:10 kuriel-dev

Is totally related with this script, i created a clean ubuntu install with WSL, then tested xclock (x11-apps) to test GUI Apps until this everything OK. After install this script for snapd availability, the GUI apps throws the Error: Can't open display: :0

Hi, like written by aki-k this is a cleanupscript by systemd - so you can modify them or try the following, which works for me:

can you please try to add the following line at the end of your $HOME/.profile ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

than shutdown wsl with wsl.exe --shutdown

Does it work after starting WSL again ?

Thanks Miro

mirogl avatar Oct 24 '21 14:10 mirogl

Is totally related with this script, i created a clean ubuntu install with WSL, then tested xclock (x11-apps) to test GUI Apps until this everything OK. After install this script for snapd availability, the GUI apps throws the Error: Can't open display: :0

Hi, like written by aki-k this is a cleanupscript by systemd - so you can modify them or try the following, which works for me:

can you please try to add the following line at the end of your $HOME/.profile ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

than shutdown wsl with wsl.exe --shutdown

Does it work after starting WSL again ?

Thanks Miro

OK,works

xulei890817 avatar Oct 28 '21 14:10 xulei890817

Is totally related with this script, i created a clean ubuntu install with WSL, then tested xclock (x11-apps) to test GUI Apps until this everything OK. After install this script for snapd availability, the GUI apps throws the Error: Can't open display: :0

Hi, like written by aki-k this is a cleanupscript by systemd - so you can modify them or try the following, which works for me:

can you please try to add the following line at the end of your $HOME/.profile ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

than shutdown wsl with wsl.exe --shutdown

Does it work after starting WSL again ?

Thanks Miro

Is this possible without x11?

ghost avatar Jan 07 '22 09:01 ghost

Is totally related with this script, i created a clean ubuntu install with WSL, then tested xclock (x11-apps) to test GUI Apps until this everything OK. After install this script for snapd availability, the GUI apps throws the Error: Can't open display: :0

Hi, like written by aki-k this is a cleanupscript by systemd - so you can modify them or try the following, which works for me:

can you please try to add the following line at the end of your $HOME/.profile ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix

than shutdown wsl with wsl.exe --shutdown

Does it work after starting WSL again ?

Thanks Miro

You also need to comment out this line in /usr/lib/tmpfiles.d/x11.conf : #D! /tmp/.X11-unix 1777 root root 10d

Otherwise the wrong link will be recreated upon restart with root permissions and you won't be able to create your link

amarkovytch avatar Mar 29 '22 15:03 amarkovytch