How can I run X11 applications inside GNU screen?
If I log in to the login nodes with ssh -XA user@hostname as supposed when wanting to run X applications, and then try to start an X application inside a screen session, why does this not work?
(This applies also for trying to do PNG output in R, since it depends on X11)
When starting a screen session, your DISPLAY environment can sometimes change from the one that you had when you logged in.
To solve this problem, you simply have to set the DISPLAY variable inside the screen session, to the same value that you have outside it.
So, outside the screen session, do:
echo $DISPLAY
You might see something like:
localhost:45.0
Then, inside your screen session, set your DISPLAY env variable to that same value using the export command, like so:
export DISPLAY=localhost:45.0
(NOTE: The actual number above might be different for you, and should be changed accordingly!)