Stop X windows using GPU


We have some servers that have a GPU (or several) for computational purposes. The servers have an integrated display device (usually ASPEED or similar). We often have graphical desktops installed, as we want remote desktop access to run CAD programs etc.

This can lead to issues. For example, if we have a server with a NVIDIA RTX A5000 and it’s own motherboard display, you can install Rocky 8 or 9 (but not 10, as it’s Wayland only and you want to use xrdp). If it doesn’t install the nvidia drivers by default then on reboot the standard gdm launcher pops up on the onboard display and you can log into it. When the Nvidia repository is set up and the standard Nvidia drivers are installed a reboot shows the boot sequence at the start, then disappears. The issue is that the graphical launcher is displaying on the GPU instead, which we don’t want.

One way to stop this is to look in /etc/X11/xorg.conf.d/. There may be a file 10-nvidia.conf (or similar) present. This has been installed by the Nvidia package, sometimes even for GPUs that don’t have display outputs! On one system the problem was fixed by editing this file to:

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "no"
    Option "SLI" "Auto"
    Option "BaseMosaic" "on"
EndSection

The critical change is adding Option "PrimaryGPU" "no" (or changing it to no). This then tells the system to use the other display device as the primary display, and can also stop parasitic gdm processes taking up an (admittedly trivial) amount of resources on the GPU.

For multi-gpu systems you can write more complex conf snippets to point it to the right card, target cards by pci slot, etc.

Another way to deal with this scenario is to install the “headless” or “compute only” version of the drivers, which shouldn’t have this issue. This will install less libraries, which may or may not be and issue depending on what the GPU is used for.