6

I'm using Cygwin to control my RPi over ssh,

ssh pi@192.168.0.18

however if I try to launch an application (using Geany as an example):

sudo geany

I get the response: Geany: Cannot open display. I'm not sure what's going on here, so I'd be very grateful to receive any tips!

More (hopefully useful) information

  • If I run the command on the Pi, everything works as expected.
  • If I launch Xwin server and run: export DISPLAY=:0.0 ssh -Y pi@192.168.0.1 sudo geany the window is forwarded to my laptop just as expected.
  • Running a java executable over ssh (JavaFX application built with maven) also works as expected (the application is displayed).

Just to be sure - I would like the application window to open on the Pi, not the laptop I'm using to ssh into it.

Edit

Not all applications return the same error - for example BlueJ throws a Java exception:

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

Scratch returns:

squeak: could not find any display driver

Chromium-browser:

[2260:2260:0616/200257.886341:ERROR:browser_main_loop.cc(495)] Failed to put Xlib into threaded mode. 

2260:2260:0616/200257.899631:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display:
5
  • Does it work without sudo? Do not export DISPLAY. It should be set automatically if you set it up correctly. – Jakuje Jun 16 '17 at 20:00
  • Are you sure you're running export DISPLAY=:0.0 AFTER you've established an SSH connection with the RPi – Joe Jun 16 '17 at 20:03
  • @Jakuje I have the same behaviour without sudo. – AdamBH Jun 16 '17 at 20:12
  • @Veroxi Ah that did it! Fantastic thank-you so much. What's the correct way to close this thread? – AdamBH Jun 16 '17 at 20:12
  • I'd keep the question up so others can see this if they have the same issue, and put [SOLVED] in the title of the post – Joe Jun 16 '17 at 20:26
6

This can be solved by running export DISPLAY=:0.0 after you've established an SSH connection with the Raspberry Pi.

2
  • 2
    I still cannot get it to work. Everytime I try it returns Cannot open display: 0.0. I tried with 0.0 and 0 through 3, none works. Is there any other value I can try ? – Arthur Attout Apr 9 '19 at 19:27
  • Note: Don't forget to configure (via raspi-config) to set the desktop mode to auto-logon. Otherwise this won't work. – Brad Mar 19 '20 at 1:22
1

I do that all the time with cygwinx. I do ssh -Y pi@192.168.1.60 I edit files on the pi by opening a gvim window, for example.

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