4.2. Graphics and Displays
Graphics support has two distinct parts: the kernel must bind a driver to
the display controller and expose connectors and modes, and user space must
use that interface to render and present images. On modern Debian systems
the kernel driver is a DRM/KMS driver such as i915, amdgpu, nouveau,
or, in this virtual machine, cirrus. Mesa provides the OpenGL and Vulkan
implementations, while Xorg or a Wayland compositor provides the display
protocol and window management.
4.2.1. Kernel Drivers, Firmware, and Hardware Acceleration
Start with the hardware and the driver the kernel actually bound. lspci -k
prints each device together with the driver in use and the modules that
could handle it:
| Option | Description |
|---|---|
-k |
Show kernel drivers and modules associated with each device. |
-nn |
Show numeric vendor and device identifiers as well as names. |
-s [[domain:]bus:]slot[.function] |
Restrict output to one device address. |
$ lspci -k -s 00:02.0
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
Subsystem: Red Hat, Inc. QEMU Virtual Machine
Kernel driver in use: cirrus
Kernel modules: cirrusfb, cirrus
The Kernel driver in use line is the important one: a module listed under
Kernel modules is only a candidate that may not be loaded. Kernel messages
confirm when the driver initialized the device and created its framebuffer.
The journalctl options -k and -b limit the journal to kernel messages
from the current boot; grep then selects the lines naming the driver:
$ sudo journalctl --no-pager -k -b | grep -i cirrus
Nov 17 04:19:57 trixie kernel: cirrus 0000:00:02.0: vgaarb: deactivate vga console
Nov 17 04:19:57 trixie kernel: [drm] Initialized cirrus 2.0.0 for 0000:00:02.0 on minor 0
Nov 17 04:19:57 trixie kernel: fbcon: cirrusdrmfb (fb0) is primary device
Nov 17 04:19:57 trixie kernel: cirrus 0000:00:02.0: [drm] fb0: cirrusdrmfb frame buffer device
This establishes that the kernel bound the driver to the emulated adapter
and produced a framebuffer. It does not establish that user space renders
with hardware acceleration. Mesa reports the renderer that user space
selected; glxinfo -B prints a compact summary, and the display variables
follow from the X11 access discussion in Section 4.1.3:
$ DISPLAY=:0 glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa (0xffffffff)
Device: llvmpipe (LLVM 19.1.7, 256 bits) (0xffffffff)
Version: 25.0.7
Accelerated: no
Video memory: 967MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 19.1.7, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 25.0.7-2+deb13u1
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 25.0.7-2+deb13u1
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 25.0.7-2+deb13u1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Selected output; the report continues with buffer and texture memory
statistics. direct rendering: Yes means the client can render into buffers
it accesses directly; it does not mean a GPU is accelerating the work.
llvmpipe is Mesa's software rasterizer, and Accelerated: no is the
decisive line. The guest has no hardware GPU, so software rendering is
expected. A physical workstation that reports llvmpipe while it has a
supported AMD, Intel, or NVIDIA GPU indicates that Mesa selected the
software fallback, often because the kernel driver, firmware, or device
permissions are missing.
Firmware is a separate dependency from the kernel driver. Many GPUs and
Wi-Fi adapters require binary firmware files under /lib/firmware before
the driver can initialize the device. Debian splits those files between the
main component, which contains free firmware, and non-free-firmware,
which contains the rest. The example guest enables only main, so a free
firmware package has a candidate while common hardware firmware does not:
$ apt-cache policy firmware-linux-free firmware-amd-graphics firmware-iwlwifi
firmware-linux-free:
Installed: (none)
Candidate: 20241210-2
Version table:
20241210-2 500
500 https://deb.debian.org/debian trixie/main amd64 Packages
firmware-amd-graphics:
Installed: (none)
Candidate: (none)
Version table:
firmware-iwlwifi:
Installed: (none)
Candidate: (none)
Version table:
An empty Candidate means the package is not available from any enabled
component, not that Debian lacks the package. On a machine whose AMD GPU or
Intel Wi-Fi adapter needs that firmware, add non-free-firmware to the
Components: line of the active source file -
/etc/apt/sources.list.d/debian.sources on a default Debian 13 installation
- run apt update, and install the package that matches the identified
device, for example firmware-amd-graphics or firmware-iwlwifi. Then
rebuild the initramfs if the driver is needed before the root filesystem is
mounted. The example guest has no such hardware and the component was not
enabled there, so this procedure is described from the packaging rather
than shown. Chapter 6 covers source
configuration and Chapter 7 covers firmware packages
and the initramfs.
When hardware misbehaves, search the kernel log for the driver name
alongside firmware rather than assuming a black screen is a compositor
bug:
$ sudo dmesg | grep -i firmware
[ 3.726564] systemd[1]: systemd-hibernate-clear.service - Clear Stale Hibernate Storage Info skipped, unmet condition check ConditionPathExists=/sys/firmware/efi/efivars/HibernateLocation-8cf2644b-4b0b-428f-9387-6d876050dc67
The only match on this guest is a systemd boot message about a skipped
service whose condition path contains the string firmware; it is not a
driver report at all. Read such a search for driver messages: on hardware
that needs a missing file, the driver itself names the exact file it could
not load, and that line is the actionable one.
4.2.2. Multiple Displays, Scaling, and Input Devices
xrandr queries and changes the RandR output configuration of a running X
server. On the example machine the server exposed one connected output
named VGA-1:
$ DISPLAY=:0 xrandr --query
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2044 x 1024
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1024x768 60.00*+
1360x768 60.02
1280x800 59.81 59.91
1280x768 59.87 59.99
1280x720 60.00
800x600 60.32 56.25
848x480 60.00
640x480 59.94
The * marks the current mode and + the preferred mode. primary marks
the output that anchors the screen origin. The mode list comes from the
driver and the monitor's EDID data or, for a virtual display, from the
emulated device. --listmonitors gives a shorter view of the logical
monitor layout:
$ DISPLAY=:0 xrandr --listmonitors
Monitors: 1
0: +*VGA-1 1024/271x768/203+0+0 VGA-1
The fields after the name are the monitor's size in millimeters, its
position, and the backing output. A laptop with an internal panel and an
external projector normally shows two outputs and two monitors; a dock or
adapter may add more. The number of outputs is not the same as the number
of logical monitors, because several outputs can be combined into one
monitor with --setmonitor.
The most common local change is selecting a mode. The command changes the output immediately and prints nothing:
$ DISPLAY=:0 xrandr --output VGA-1 --mode 800x600
Verify the result with a separate query; the pipeline's head stage limits
the listing to its first two lines:
$ DISPLAY=:0 xrandr --query | head -2
Screen 0: minimum 320 x 200, current 800 x 600, maximum 2044 x 1024
VGA-1 connected primary 800x600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
Restore the previous mode with the same option and a different value, which is also silent, and confirm it:
$ DISPLAY=:0 xrandr --output VGA-1 --mode 1024x768
$ DISPLAY=:0 xrandr --query | head -2
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2044 x 1024
VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
The change lasts until the X server exits or another client changes the
configuration; it is not persistent. Desktop environments save display
settings in their own per-user configuration and reapply them at login, and
a minimal X session can reapply xrandr commands from a startup script that
runs after the server is ready.
xrandr option |
Description |
|---|---|
--query |
Print outputs, connected state, current modes, and available modes. |
--listmonitors |
Print logical monitors and their geometry. |
--output NAME |
Select the output that later options modify. |
--mode NAME |
Set the output's mode. |
--primary |
Make the output the primary monitor. |
--pos XxY |
Place the output at a position in the shared screen coordinate space. |
--left-of, --right-of, --above, --below |
Place the output relative to another output. |
--same-as |
Mirror another output. |
--scale XxY |
Scale the output's framebuffer; the result may be blurry and is not compositor fractional scaling. |
--off |
Disable the output. |
A two-output layout composes these options. The following commands are
illustrative for a laptop that was not present on the example machine; they
were not executed here. Run them inside the X11 session, one at a time,
after reading the actual output names and modes from xrandr --query:
$ xrandr --output eDP-1 --mode 1920x1080 --primary
$ xrandr --output HDMI-1 --mode 1920x1080 --right-of eDP-1
A wrong mode or a disconnected output can leave a blank screen; keep a text
console available and be prepared to run xrandr --output NAME --auto or to
remove the offending startup command. On Wayland, the compositor's display
settings or a compositor-specific tool manages outputs; xrandr only
affects XWayland's view and is not the general Wayland configuration
interface.
Scaling is more than changing the mode. X11's --scale multiplies the
framebuffer and fits it to the output, which can make text and images
blurry. Toolkit variables such as GDK_SCALE and QT_SCALE_FACTOR affect
only applications that honor them. Wayland compositors expose per-output
scale factors, including fractional scaling, and render at the appropriate
resolution themselves. Change scale in the desktop's display settings first;
use xrandr only when the session is X11 and the desktop setting is
insufficient.
Input devices are queried with xinput. The short listing shows the master
pointer and keyboard, their slave devices, and the virtual devices the
hypervisor provides:
$ DISPLAY=:0 xinput list --short
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ VirtualPS/2 VMware VMMouse id=8 [slave pointer (2)]
⎜ ↳ VirtualPS/2 VMware VMMouse id=9 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=7 [slave keyboard (3)]
The identifiers are assigned at runtime and change after a reconnect. The
Virtual core devices are the X server's aggregates, and the VMMouse
entries exist because this is a virtual machine. A physical laptop
normally shows a libinput touchpad, a keyboard, a power button, and possibly
a video bus device.
xinput form |
Description |
|---|---|
list |
Detailed list of master and slave devices. |
list --short |
One line per device, with ID and class. |
list-props ID |
Show properties and current values for one device. |
set-prop ID PROPERTY VALUE |
Change a property for the current session. |
test ID |
Print events from a device; useful for checking buttons and axes. |
list-props and set-prop change XInput properties, not desktop settings.
A touchpad's tap-to-click, natural scrolling, and acceleration are normally
managed by the desktop's input settings through libinput. On Wayland,
xinput does not manage the compositor's devices; use the desktop's
settings panel or the compositor's own configuration.
4.2.3. Diagnosing Failed Graphical Sessions
Graphical failures are easiest to diagnose as a chain. A client needs a display name and a reachable socket; the socket must belong to a running server or compositor; the server must have initialized its outputs and driver; the kernel driver must have bound the device; and the device must have its firmware. A failure at one layer usually prevents the later layers from being tested at all.
A deliberately wrong display number produces a clean client-side failure:
$ DISPLAY=:99 xrandr --query
Can't open display :99
The exit status was 1. This message means the client could not connect to a
server at display :99; it does not mean the graphics driver is broken. The
server might not be running, the socket might be elsewhere, or the client
might lack the authority cookie. Inside the affected session, inspect the
DISPLAY and XDG_SESSION_TYPE variables and the contents of
/tmp/.X11-unix; a shell started over SSH reports its own environment, not
the desktop's, so read the session's environment through
loginctl show-session when the shell is not the session.
The X server's own log records module and driver failures. The example machine's log contained a missing vendor module and a fallback:
$ sudo grep -E "\(EE\)|\(WW\)" /var/log/Xorg.0.log | head -10
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[113369.642] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[113369.663] (WW) Warning, couldn't open module cirrus
[113369.663] (EE) Failed to load module "cirrus" (module does not exist, 0)
[113369.665] (WW) Falling back to old probe method for fbdev
The (EE) line is an error, but the server continued: the kernel cirrus
driver still provided the framebuffer, and Xorg fell back to its generic
probing path. A missing optional Xorg driver module is therefore not always
fatal; the fallback lacks acceleration, which matches the llvmpipe result
in Section 4.2.1. A fatal error usually appears later in the log, followed
by the server exiting, so read the last lines rather than only the first
warning.
Figure 4.2. Conceptual diagnosis order for a graphical session. The first unreachable or uninitialized layer determines the next check; a later check cannot repair an earlier failure.
| Symptom | First check | Layer to investigate |
|---|---|---|
Can't open display |
echo $DISPLAY, ls /tmp/.X11-unix, loginctl list-sessions |
Client environment, socket, or X authority |
| Greeter restarts or returns to login | systemctl status lightdm, journalctl -u lightdm -b |
Display manager, PAM, session file, or session startup |
| Login succeeds, then immediately returns | the session's ~/.xsession-errors, journalctl --user |
Session manager or a failing desktop service |
| Black screen with a text cursor | switch to a text VT, xrandr --query, compositor log |
Output mode, compositor, or driver |
| Wrong resolution or no external output | xrandr --query, xrandr --listmonitors |
Output detection, cable, mode, or configuration |
| Desktop works but 3D is slow | glxinfo -B, and kernel messages for DRM and firmware |
Mesa, kernel driver, firmware, or permissions |
| Xorg log says a module failed to load | read the surrounding log lines | Optional Xorg driver versus kernel driver |
journalctl -u lightdm -b reads the current boot's display manager log and
is the correct first source when the greeter fails; the greeter started
successfully here, so no such failure transcript is shown. For a user
session, journalctl --user reads the user service manager's journal from
inside that session, and the display manager's journal records its attempt
to start the session. Chapter 8 covers the journal
in detail.
If the graphical session is unusable, switch to a text virtual console with
Ctrl+Alt+F3 (or another function key not occupied by the desktop), log
in, and inspect the services.
Warning: Restarting the display manager ends the current graphical session and can close unsaved applications, and on a remote machine it can remove the only working access path. Confirm a console or SSH recovery route first; only then run
sudo systemctl restart lightdm.
That restart is the documented recovery action; the example machine kept
its greeter running, so the restart itself was not exercised. When a display
manager starts but the session fails, the session file is a useful boundary:
check that the Exec program exists, that its type matches an installed
server or compositor, and that the user's home directory allows the session
to write its configuration. A session file with Exec=startxfce4 --wayland
fails when the Wayland components are missing, even though the same
desktop's X11 session works, and the error appears in the display manager's
log rather than in the application's own output.