17

I have recently installed Bash for Windows 10 (yay!). I need it to run my processing software called 'Seismic Unix' which installed fine. However, when I ran the command attached, it gave this error "Cannot connect to display!". This command is supposed to display an image on the screen, and I think the Bash cannot access my laptop screen in order to display the results.

A screenshot of the error "Cannot connect to display!"

screenshot

Here is the command:

suplane | suximage title="My first test" &

I look forward to hearing from you, and thank you in advance.

6
  • Welcome to SE. It appears you are looking for Windows support. This forum is for user running Ubuntu and having specific issues or questions about Ubuntu. You'll have to look at one of our other forums such as superuser.com for support for Windows 10. Sep 10, 2016 at 16:22
  • When I installed Bash inside Windows 10 I was informed it IS indeed Ubuntu command line inside Windows 10 (developed by Canonical). They have even given me an Ubuntu email address, but I forgot to write it down, so I came here.
    – maezawi
    Sep 10, 2016 at 16:30
  • 2
    @L.D.James it has been decided in meta that WSL is on topic here
    – Zanna
    Sep 10, 2016 at 16:58
  • 1
    @Zanna Thanks for the heads up! By the way, what is WSL? Sep 10, 2016 at 21:37
  • 1
    @L.D.James Windows Subsystem for Linux which is apparently the "proper" name for "Ubuntu on windows"/ "bash on windows"
    – Zanna
    Sep 10, 2016 at 21:40

2 Answers 2

22

You need to install an "X server" to provide that graphical interface which is yet not there on a typical Ubuntu subsystem on windows 10.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop.

You can install Xming a good X server for Windows. Just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

After installation you’ll need to set the DISPLAY environment variable to point at the X server already running on your system.

First run the following command in the Bash environment to set the DISPLAY variable:

export DISPLAY=:0

and then run your graphical application. In this case

suplane | suximage title="My first test" &

Some part is taken from howtogeek

6
  • Thank you, souravc! I will test your solution and will share results. Is Xming something similar to Xcode? Xcode is required when we try to install the same software on Mac OS.
    – maezawi
    Sep 11, 2016 at 18:20
  • No, Xcode is basically an IDE containing a suite of software development tools and OpenGL support in Apple whereas Xming is an X server for Windows. The Xming counterpart in Mac is XQuartz.
    – sourav c.
    Sep 12, 2016 at 3:22
  • 1
    Glad to hear that. Now you can accept the answer. It will indicate your problem is solved and you are satisfied with the answer. See how to accept answer and What should I do when someone answers my question
    – sourav c.
    Sep 12, 2016 at 11:11
  • Another great option is MobaXterm, by default it starts an embedded X server (at least from version 10.2).
    – alessmar
    May 10, 2017 at 10:43
  • Is it worrisome that Xming hasn't been updated in a decade? Jun 5, 2018 at 18:31
1

The current best solution I have found is to download MobaXterm and use the local bash terminal through mobaXterm and all of the graphics forwarding is handled by the windows side, currently WSL doesnt handle and GUI stuff.

I was using a mac at work and a windows machine at home, I set up WSL and was trying to work with jupyter notebooks but having the same issue "Cannot connect to X server" when launching images through matplotlib even if I had the cygwin X server running the WSL was not aware of it. After a bit of digging I saw a thread recommending mobaXterm, works a treat now.

1
  • Interesting, can you please provide more details on how did you configure MobaXterm? and how is all the graphics forwarding handled by the windows side? I just set up WSL and Xming, but I also have a Mac at work and a Windows machine at work. What do you do - forward X from Windows to Mac? if so, can you please provide more details? Thanks!
    – DARKGuy
    Sep 16, 2019 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.