I am having trouble with graphical applications and WSL. I have Ubuntu 20.04.3 with X11 installed; but am getting the following issue when I try to test with xeyes (the same happens with any other graphical application I use).
xeyes
Error: Can't open display: localhost:0.0
I have been reading up online about similar problems but have not yet found a solution. I am using a VcXsrv X Server (and have tried Xming too previously).
I have tried changing the display using all of the following independently:
export DISPLAY=0.0
export DISPLAY=localhost:0
export DISPLAY=127.0.0.1:0
export DISPLAY=127.0.0.1:0.0
export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0
export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0
None of which are working.
I have checked to make sure the X server is being allowed through the firewall and it is.
I also went into /etc/ssh/sshd_config and changed the following:
X11Forwarding yes
I did try
~/.profile, which returned -bash: /.profile: No such file or directory
I have also set up a PuTTY configuration with X11 forwarding enabled.
Finally, I tried the following:
export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0
Once again, this did not work. However, it did change the IP to a different one from all the previous attempts and then threw the following error:
Authorization required, but no authorization protocol specified
Error: Can't open display:
I am not sure if this is progress or not, maybe now all that is standing in my way is this authorisation.
I have seen people online saying to run:
vcxsrv -ac
to change the access controls of the X Server, but then others say not to do it because it can compromise security. I am only running this locally but don’t really know what I am doing so have not done it.
I know this problem is quite common from the amount of forums I have been on, so am not expecting someone to instant fix this for me. But I would appreciate if someone could point me in the right direction based on any of the information I have provided, because it seems I have covered most if not all of the solutions that I can find on other forums.
Thanks in advance 🙂