I have a computer with Ubuntu + a graphical desktop installed where I often run OpenGL applications just to capture the screen and make videos. I only care about the generated video, but to create the OpenGL context, I need to open a window, so I have a program that I can run from the terminal that opens the window, renders stuff with OpenGL and sends the pixel data to an ffmpeg process to make the video and it works. Now, I want to run this video generator remotely via ssh, but when I run the program remotely, window creation fails. I suppose this has something to do with X assuming I want to get some graphical output in the machine I'm connecting from or something like that, I don't know much about this. I just want it to make the video, I don't care about seeing the window, in theory it should be able to open the window in the remote machine as it always does when I run the script locally. Should I set some environment variable like DISPLAY to make this work remotely?

closed as unclear what you're asking by G-Man, Archemar, Stephen Rauch, Michael Homer, roaima Nov 26 '17 at 21:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • “… this has something to do with X assuming I want to get some graphical output in the machine I'm connecting from …” Well, I’m not clear — is that what you want? – G-Man Nov 25 '17 at 3:39

You need to set the DISPLAY variable to the one where the GUI session (X, Wayland or Mir) is running on the host.

You can use the who command to see which display your GUI session is running on (assuming you're already logged in on the remote host's GUI in another session).

Another solution would be to use VNC or SPICE to connect to the remote host for the full desktop.

  • This is that I was looking for. Running "export DISPLAY=:1" before running my application made it work as expected. – Mei Zhang Dec 26 '17 at 14:06

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