0

I work on WSL with an Ubuntu terminal. I have a problem with the display opening. I'm new to this stuff and would need help.

I downloaded Xming, run through XLaunch and in the part "Specify parameter settings" select "No Access Control". I executed export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0. Then I executed export DISPLAY=:0 and xeyes but I still have the error message: Error: Can't open display: :0.

I tried to find a solution on the internet but could not solve the problem. Thank you very much for your help.

tmg
  • 1
  • 1
  • 1
  • Welcome to Super User. As a heads-up, there are a number of questions here that already cover a number of troubleshooting techniques for this. [This one](https://superuser.com/q/1617298/1210833), for instance, mentions making sure your firewall rules are updated for the X Server. Make sure you go through the existing questions that mention "WSL" and "DISPLAY" first and have tried those. Thanks! – NotTheDr01ds Dec 29 '21 at 15:36
  • Also, much simpler (and works for most people) is `export DISPLAY=${hostname}.local:0.0`. This uses mDNS per [this post](https://www.reddit.com/r/bashonubuntuonwindows/comments/rdzjic/psa_stop_using_complicated_display_pipelines/?utm_source=share&utm_medium=web2x&context=3). You'll still need to make sure all of the other stuff (firewall rules, etc.) are in place, though. – NotTheDr01ds Dec 29 '21 at 15:38
  • WSL1 or WSL2 ? (so I can update your tag).. There is a real difference. With WSL1, you can use the 127.0.0.1 loopback and there is no need for the other crap. For instance, `export DISPLAY=127.0.0.1:0.0` in your bashrc or profile and you are done. With WSL2, you have an assigned virtual IP I think.. (I run WSL1 and could be wrong). Also, you can skip the scripted crap and figure out the IP you are trying to export to and type the actual IP addr in by hand until you get it working. Then backtrack to what *isn't* working to get that IP (or hostname) into your exported DISPLAY variable. – Señor CMasMas Dec 29 '21 at 18:51
  • Thank you very much for your help. I am on WSL2. Thanks to your comments I managed to find the right information. For the future readers this page helped me a lot: https://stackoverflow.com/questions/61110603/how-to-set-up-working-x11-forwarding-on-wsl2 – tmg Jan 01 '22 at 18:04

0 Answers0