6

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

ssh [email protected]

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 [email protected] 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
    Commented Jun 16, 2017 at 20:00
  • Are you sure you're running export DISPLAY=:0.0 AFTER you've established an SSH connection with the RPi
    – Joe
    Commented Jun 16, 2017 at 20:03
  • @Jakuje I have the same behaviour without sudo.
    – AdamBH
    Commented Jun 16, 2017 at 20:12
  • @Veroxi Ah that did it! Fantastic thank-you so much. What's the correct way to close this thread?
    – AdamBH
    Commented Jun 16, 2017 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
    Commented Jun 16, 2017 at 20:26

2 Answers 2

7

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 ? Commented Apr 9, 2019 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
    Commented Mar 19, 2020 at 1:22
1

I do that all the time with cygwinx. I do ssh -Y [email protected] 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.