0

I have successfully used the screen utility to run my time consuming scripts when I am working on a server via ssh. However lately I have been running into a problem, I have found my script terminated mid-process with the following message on the screen log

 : cannot connect to X server localhost:10.0

What could be the issue here? If it makes any difference I was connecting from OSX with XQuartz running, and ssh -Y to connect to a remote server running Ubuntu 16.04 LTS.

2
  • Why are you using the -Y option to ssh? Are you using the ssh connection to do anything other than run scripts within a remote screen session? If your script needs to launch X11 clients, you probably don't want to execute it within a (potentially) detached screen session. Dec 9, 2016 at 12:58
  • @user4556274 It's out of habit actually; the script generates pdf plots and saves them. While I was developing the script, I wanted to manually investigate the plots generated, thus having X-forwarding. As it is, the script should not launch any X11 clients
    – posdef
    Dec 9, 2016 at 13:00

1 Answer 1

3

The -Y is your issue. The script you're running is trying to connect to a display and is, for whatever reason, connecting to the one forwarded over your ssh session instead of the local one. When the ssh session dies (ie. you disconnect) the display goes away and the script fails. Remove the -Y and everything will work as expected.

3
  • Likely, but I am fairly certain that did not cause problems before. I am under the impression that the crux of the issue might be that if I am not using my mac the energy saving settings might be terminating the connection and thus killing the screen session.
    – posdef
    Dec 9, 2016 at 14:20
  • Even if it is sleep settings the fact that you have multiple displays available to the script over-complicates things. Try it without the -Y and see what happens.
    – David King
    Dec 9, 2016 at 14:21
  • Will do, will return to this when I've tested this out
    – posdef
    Dec 9, 2016 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .