Installing and configuring a graphical display server

The graphical stack: what an X server actually does, how X and Wayland differ, and the parts of it a system administrator is expected to configure or debug.

Lesson 1 of 3 in objective 106. User interfaces and desktops, part of LPIC-1 Exam 102-500.

The X inversion: the server is the machine with the screen. In order: Your application (the X CLIENT — it may be on another host), then DISPLAY=host:0 (which server to draw on. :0 is this machine), then The X server (runs where the screen, keyboard and mouse are), then What you see. Your application the X CLIENT — it may be on another host DISPLAY=host:0 which server to draw on. :0 is this machine The X server runs where the screen, keyboard and mouse are What you see
The X inversion: the server is the machine with the screen.

The client-server idea, which is the opposite way round from expectations

In X, the SERVER is the machine with the screen, keyboard and mouse, and the CLIENTS are the applications — even when they are on the same machine. That inversion is deliberate and it is what allows an application running on a remote host to draw on your local display: the DISPLAY variable names which server to draw on, spelled host:display.screen, and :0 means the first display on this machine.

X.Org is the implementation in use. Configuration is /etc/X11/xorg.conf if it exists, though modern systems autodetect nearly everything and use snippets in /etc/X11/xorg.conf.d/ for the few overrides needed. The log is /var/log/Xorg.0.log, and it is the right first place to look when the display does not come up.

Wayland is the replacement, and its structural difference is worth stating: it merges the display server and the window manager into one compositor, and there is no built-in network transparency, so a remote application does not simply set DISPLAY. On Wayland, X applications run through an X compatibility layer.

The pieces around it

A window manager draws the frames and decides where windows go; a desktop environment is a window manager plus a whole set of applications and settings. xhost and xauth control who may connect to a display — xhost by host, which is blunt, and xauth by a cookie file in ~/.Xauthority, which is what ssh -X uses when it forwards a display. xdpyinfo reports what the server is capable of.

The keyboard belongs to the server too, which is why changing its layout is not a shell setting. setxkbmap de talks to the XKB extension of the RUNNING server and switches the layout immediately — the first non-option argument is taken as the layout, so setxkbmap -layout de is the same instruction written out. Because it changes a running server, it lasts exactly as long as that server does. Making the layout survive a restart is a different file: an XkbLayout option in an InputClass section under /etc/X11/xorg.conf.d/, or localectl set-x11-keymap de on a systemd host, which writes that snippet for you. Keep localectl's two keymaps apart — the X11 one is this, and the console one is what loadkeys sets for a text terminal.

Which of the two access controls each name belongs to. Left column, The name you meet; right column, The mechanism it belongs to. xauth, ~/.Xauthority, XAUTHORITY and ssh -X all point at Cookie-based access control (A token in a file the server checks, and what a forwarded display rests on). xhost +host points at Host-based access control (Blunt, and best avoided). The name you meet The mechanism it belongs to xauth ~/.Xauthority XAUTHORITY ssh -X Cookie-based access control A token in a file the server checks, and what a forwarded display rests on xhost +host Host-based access control Blunt, and best avoided
Which of the two access controls each name belongs to.

Pointing a client at a display

DISPLAY is an ordinary environment variable, so it is set the ordinary way and it has to be EXPORTED: export DISPLAY=:0 sets it for this shell and for everything the shell starts, which is the point, because the thing that needs to read it is the application you are about to launch. Setting it without export changes the shell and nothing it runs. Quoting makes no difference — export DISPLAY=":0" and export DISPLAY=:0 are the same — because there is nothing in the value for the shell to split on.

The value is host:display.screen, and the two shorter spellings mean the same thing on a single-screen machine: :0 is display 0 with the screen left implied, :0.0 says screen 0 explicitly. An empty host means this machine. So a cron job or a script run from a console that needs to put a window on the logged-in desktop sets DISPLAY first — and, because the server also checks the cookie, usually XAUTHORITY with it.

A DISPLAY value in full, one part at a time. zeus:0.0 — part 1, zeus: the host to draw on. Empty means this machine; part 2, 0: display number, counted from 0; part 3, 0: screen number, which the shorter :0 leaves implied. 1 zeus : 2 0 . 3 0 1 the host to draw on. Empty means this machine 2 display number, counted from 0 3 screen number, which the shorter :0 leaves implied
A DISPLAY value in full, one part at a time.
xtermxterm: Xt error: Can't open display: DISPLAY=:0xtermxterm: Xt error: Can't open display: set in the shell, never passed to the childexport DISPLAY=:0xterma window opens on the local display
Why the variable has to be exported, not merely set.

Worth carrying in

export DISPLAY=:0
Which X server a client draws on. host:display.screen is the full form; it must be exported to reach the application.
~/.Xauthority
The cookie file xauth manages and the server checks. XAUTHORITY names a different one.
/etc/X11/xorg.conf
X configuration, when present. Snippets go in xorg.conf.d/.
/var/log/Xorg.0.log
What the X server did and why it failed.
xhost +host
Host-based access control. Blunt, and best avoided.
xauth
Cookie-based access control; what ssh -X forwarding uses.
setxkbmap de
Keyboard layout of the RUNNING server; gone with it. localectl set-x11-keymap is the persistent form.
Wayland
Compositor replacing the X server; no network transparency of its own.

What the exam does with this

Objective
106. User interfaces and desktops
Share of the exam
6.67% (the whole objective)
Questions in this lesson
10
Signed for by a person
0

Partly checked. None of the 10 questions here has been read against the cited source by a person. 10 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.

Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

Drill this lesson

A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.

Practise Installing and configuring a graphical display server

Questions in this lesson

Practise Installing and configuring a graphical display server

The rest of objective 106