Skip to content

lightdm starts X before slow-initializing GPUs register their DRM device, leaving external displays unconfigured (race condition on cold boot) #441

Description

@Negraldi

Summary

On systems where a GPU takes a long time to initialize (e.g. NVIDIA 580-open driver with GSP firmware, ~22 seconds), lightdm.service starts the X server before the GPU's DRM device is registered. X then configures only the already-present GPU (the Intel iGPU), and outputs attached to the late-arriving GPU (all external monitors in my case) are never properly configured. The result on every cold boot is that only the laptop panel works; a warm systemctl restart lightdm works fine because the GPU is already initialized.

Environment

  • LightDM 1.30.0 (package 1.30.0-0ubuntu14)
  • Pop!_OS 24.04 LTS (Ubuntu 24.04 base), kernel 7.0.11-76070011-generic
  • Hybrid laptop: Intel UHD (CometLake-H GT2) + NVIDIA RTX 2080 Super Mobile
  • NVIDIA driver: nvidia-driver-580-open 580.173.02 (open kernel modules + GSP firmware)
  • External monitors connected through the NVIDIA GPU (USB-C dock, DP MST)
  • Session: Xfce (X11), system76-power graphics nvidia (discrete mode), proper
    OutputClass configs in place (Driver "nvidia", PrimaryGPU "Yes", ModulePath set)

Evidence (journal, cold boot)

23:55:58 kernel: [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
23:56:09 systemd[1]: Starting lightdm.service - Light Display Manager...
23:56:09 systemd[1]: Started lightdm.service - Light Display Manager.
23:56:20 kernel: [drm] [nvidia-drm] Failed to get dynamic displays during device registration.
23:56:20 kernel: [drm] Initialized nvidia-drm 0.0.0 for 0000:01:00.0 on minor 1
23:56:30 kernel: nvidia 0000:01:00.0: [drm] fb1: nvidia-drmdrmfb frame buffer device

X starts at 23:56:09; the NVIDIA DRM device only exists from 23:56:20. Xorg's log shows
the NVIDIA card being hotplugged ~6s after server start, getting claimed by
modesetting as a GPU screen (modeset(G0)) instead of the nvidia driver
(the OutputClass ModulePath is not applied at that point), ending in
(EE) modeset(G0): Failed to create pixmap and a single-provider X screen.

Steps to reproduce

  1. Hybrid Intel+NVIDIA laptop, NVIDIA open driver (slow GSP init), external monitors on the NVIDIA GPU.
  2. LightDM as display manager, X11 session.
  3. Cold boot.
  4. Only the iGPU panel is configured; external displays stay off. xrandr --listproviders shows 1 provider.
  5. sudo systemctl restart lightdm (GPU now initialized) → everything works, 2 providers.

Expected behavior

LightDM (or its systemd unit) should offer a way to wait for GPU/DRM devices to be ready
before launching the X server — e.g. a config option listing DRM devices to wait for, or
ordering against dev-dri-cardN.device — so that slow-probing GPUs are present when the
server performs initial output configuration.

Workaround

A systemd drop-in delaying lightdm until a DRM card bound to the nvidia driver exists:

# /etc/systemd/system/lightdm.service.d/wait-nvidia.conf
[Service]
ExecStartPre=/bin/sh -c 'for i in $(seq 1 60); do for d in /sys/class/drm/card*/device/driver; do [ "$(basename $(readlink -f $d))" = "nvidia" ] && exit 0; done; sleep 0.5; done; exit 0'

This fully fixes the issue, which confirms the race. It would be great to have a supported
mechanism instead of a hand-rolled drop-in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions