0

I can't run gnuplot x11 terminal from Ubuntu 20.04 from Microsoft Store. I installed Ubuntu from Microsoft Store, then I installed VcXsrv. Then I run Xlaunch (VcXsrv) - choose display settings multiple windows, Start no client (I also tried with parameter -ac), then I choose Clipboard, Primary selection and native opengpl and finish. Then I run Ubuntu from Microsoft Store on terminal write export DISPLAY=localhost:0.0 then gnuplot then set terminal x11 and I get error Terminal type is now 'x11' Options are ' nopersist enhanced' gnuplot> gnuplot: unable to open display 'localhost:0.0' gnuplot: X11 aborted. Why? enter image description here

I try to do this like here but it doesn't work Gnuplot display on Bash on Ubuntu on Windows 10

Jakub
  • 103

2 Answers2

2

You don't specify, but it sounds like you are running WSL2. The post you linked to was from over 4 years ago when only WSL1 existed. They are quite different.

While WSL1 shared the same network as the Windows host, WSL2 uses a virtual network that is NAT'd behind the Windows host, inside part of the Hyper-V subsystem.

As a result, attempting to connect to localhost won't work, since localhost isn't the Windows host.

Instead, use:

export DISPLAY="$(hostname).local:0.0"

That uses the mDNS name of the Windows host to obtain the correct IP, which usually works. If not, there are more complicated export DISPLAY strings that can be tried.

NotTheDr01ds
  • 17,888
0

Thank you so much. It works, I also got an error:

gnuplot> plot sin(x)
Authorization required, but no authorization protocol specified

gnuplot: unable to open display 'DESKTOP-U0BQ8NT.local:0.0' gnuplot: X11 aborted.

Something like that https://superuser.com/questions/1174563/when-trying-to-connect-remote-clients-to-cygwin-x-i-get-authorization-required

but I turn on turn on "Disable access control" setting and it works right now.

Jakub
  • 103