X11/The X Window System¶
What is it?¶
The X Window System (aka X11, aka X) is the primary GUI system for UNIX computers. X allows a program (an X "client") running on a UNIX computer in the cluster to be displayed on a remote computer (running an X "server"1) over the network. To use it, your local computer needs to have X server software installed on it.
SSH provides support for tunnelling X11 over an encrypted connection. You may need to tell SSH that you want that service, by, for example, adding the -X flag to an ssh command in a macOS Terminal.
X11 has been (slowly) being replaced by Wayland. Wayland has been the future for many years, but is now (2024) becoming common. However what is implementing X11 is usually invisible to users. It is mentioned here in case you see references to Wayland where you expect to see X11.
How do you get it?¶
- macOS users need to install XQuartz from xquartz.org.
- Windows users need to use a program like MobaXterm. We have a page describing installing and using MobaXterm.
- Linux laptop or desktop users are already using X as their windowing system.
Example X11 Programs¶
xterm, SAS, RStudio, xclock, thunar.
Configuring SSH To Support X11¶
Copying and Pasting in X¶
Copying and pasting into and out of X11 environments is often more challenging than doing that using native Windows or macOS programs. You may need to use different key combinations and/or modify the settings of your X11 program (XQuartz or MobaXterm).
The historical default meta key used for copying and pasting is the Ctrl key. Windows copied that usage, but macOS users are used to using the Cmd key. Depending on the settings of your X software, you may need to use Ctrl or a different key combination. (And you can often change those settings to something else that you prefer for any reason.)
An additional complication is that X11 was developed in a world where you were expected to have a three-button mouse. You could select, copy and paste using different button combinations. That knowledge will help you understand any references you may come across in documentation or program settings about things like "MIDDLE BUTTON"
X11 Forwarding and Authentication¶
See this excellent article from Teleport (pdf) for quite a lot of good information and diagrams!!! (Saved as a PDF from https://goteleport.com/blog/x11-forwarding/)
Troubleshooting X Connections¶
Authoring Note
This section should include pointers to FAQ items or vice versa. We shouldn't rewrite the same information twice!!!
- When -X ?
-
When -Y ? Probably only on old macOS systems such as 10.13
-
printenv DISPLAY or echo $DISPLAY
-
[user@login31 ~]$ srun --pty --x11 bash srun: error: No DISPLAY variable set, cannot setup x11 forwarding.
-
How do Windows users configure ForwardX11Timeout? - No - this has only ever been an issue for Mac users ? https://jhpce.jhu.edu/help/faq/#x11
help/faq/#x11 slurm/slurm-faq/#x11-related-errors
Algorithm¶
If X11 isn’t working for you, consider taking the following steps, and if you cannot figure out how to resolve the problem, let us know what happened when you followed these steps, so we know what worked and where in the process you reached an error, and exactly what it was.
- Log out of the cluster.
-
If you are on a Mac, test that XQuartz works on that Mac at the very most basic level. No network connections, no SSH, no remote authentication, just local X11 functionality.
- start XQuartz if not already running
- start a new
xterm
window from the Applications menu - start a second test program from that
xterm
likexcalc
- run
xauth list
to (slowly) list previously-added entries to your~/.Xauthority
file. (You can Ctrl+C to cancel thexauth
.) - If you have any problems doing these things then STOP and find a solution. NOTHING WILL WORK IN TERMS OF X11 ON THE CLUSTER if it won't work at this level on your Mac. If you've just installed XQuartz, did you forget to reboot?
-
Log back into the cluster:
ssh -X USER@jhpce01.jhsph.edu
-
On the login node, run
printenv DISPLAY
You should see a string likelocalhost53:0
The first number (here "53") will vary, as it needs to be unique for all currently-logged in users. - If you do not have a DISPLAY variable defined, then you won't be able to run any X11 commands. You need to figure out why this variable is not being set.
- If do you have a DISPLAY variable defined, then:
- try to run a simple X11 program to see if it works:
xclock
should bring up a new clock window on your screen. Close thexlock
window by clicking in the right button in the upper left corner of its window or by typing Ctrl+C in the original terminal. - run
xauth list
to (slowly) list previously-added entries to your ~/.Xauthority file. (You can Ctrl+C to cancel thexauth
but you should probably let it finish to ensure that your ~/.Xauthority file is not corrupt.) - If you are told "xauth: Command not found" then your PATH environment variable is incorrect in an important way.
xauth
is found in JHPCE at/usr/bin/xauth
Your~/.bashrc
file is nonstandard or yourmodule
usage has messed things up. The commandswhich xauth
and/orwhereis xauth
should show you where in the list of directories contained in the PATH environment variable xauth is found. What is the output ofecho $PATH
? - If you have any problems doing these things then STOP and find a solution. NOTHING WILL WORK IN TERMS OF X11 ON A COMPUTE NODE IN THE CLUSTER if it won't work at this level on the login node.
- try to run a simple X11 program to see if it works:
- So now we've established that you have a working X11 environment on the login node.
- Connect to a compute node asking for X11 forwarding support:
srun --pty --x11 bash
- If you receive an error then see the X11-related entries in the SLURM FAQ.
- On the compute node, run
printenv DISPLAY
- If you do not have a DISPLAY variable defined on the compute node, then you won't be able to run any X11 commands on the compute node. You need to figure out why this variable is not being set.
- If you have a DISPLAY variable defined on the compute node, then run a simple X11 program to see if it works:
xclock
should bring up a new clock window on your screen. - Now close the
xclock
and try to run your application again.
-
Note that X reverses the normal conception of client/server operation, which is that the remote computer is the "server". In X11, the "server" is the program receiving the keyboard and mouse inputs and displaying the output of remote "client" programs. ↩