Skip to content

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

Authoringnote

The SSH document points to this one for ALL of the information needed to use X11. So this section needs to be complete. Pointing to the MobaXterm document of course, for Windows users.

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

Authoringnote

This section should include pointers to FAQ items or vice versa. We shouldn't rewrite the same information twice!!!

  • When -X ?
  • When -Y ?

  • 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 ?

Is ForwardX11Timeout 0 better in 2024 than specifying a particular time in hours?

http://jhpce-old.jhu.edu/question/my-x11-forwarding-stops-working-after-20-minutes/

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 what it is.

  1. Log out of the cluster.

  2. Log back in: ssh -X USER@jhpce03.jhsph.edu

  3. On the login node, run printenv DISPLAY You should see a string like localhost53:0 The first number (here "53" will vary, as it needs to be unique for all currently-logged in users.

  4. 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.
  5. If you have a DISPLAY variable defined, then:
  6. try to run a simple X11 program to see if it works: xclock should bring up a new clock window on your screen.
  7. You should be able to find a program named xauth in your path (try commands which xauth and/or whereis xauth). What output does xauth list produce?
  8. Close the xlock window by clicking in the right button in the upper left corner of its window.
  9. So now we've established that you have a working X11 environment on the login node.
  10. Connect to a compute node asking for X11 forwarding support (you can use additional options if needed): srun --pty --x11 bash
  11. On the compute node, run printenv DISPLAY.
  12. 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.
  13. 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.
  14. If you receive an error then see the X11-related entries in the SLURM FAQ.
  15. Now close the xclock and try to run your application again.

  1. 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.