Fix black screen: Wait for udev to settle before starting plasmalogin

Summary

Delay plasmalogin.service startup until pending udev events have settled.

This avoids a boot-time race where the greeter KWin starts while DRM devices are still being initialized or reordered. On affected systems this can leave the login screen black.

The wait is intentionally non-fatal and bounded:

ExecStartPre=-udevadm settle --timeout=10

So if udevadm is unavailable, fails, or times out, plasmalogin still starts.

Problem

On Arch Linux / Asahi Linux on Apple Silicon, plasmalogin can start before the final Apple DRM device is ready. In that case, the greeter KWin may bind to an early/changing DRM setup and then fail.

Relevant log from the failing boot:

kwin_wayland[660]: No backend specified, automatically choosing drm
kwin_wayland[660]: Accepting client connections on sockets: QList("wayland-0")
kwin_wayland[660]: Could not find edid for connector DrmConnector(id=37, gpu="/dev/dri/card0", name="Unknown-1", connection="Connected",
countMode=1)
kwin_wayland[660]: Failed to open drm device /dev/dri/card2
kernel: [drm] Initialized apple 1.0.0 for soc:display-subsystem on minor 2
kernel: apple-drm soc:display-subsystem: [drm] fb0: appledrmfb frame buffer device
kwin_wayland[660]: Primary gpu has been removed! Quitting...
kwin_wayland[660]: atomic commit failed: No such device
systemd[629]: plasma-login-kwin_wayland.service: Main process exited, code=exited, status=1/FAILURE
systemd[629]: plasma-login-kwin_wayland.service: Failed with result 'exit-code'.

The key part is that kwin_wayland starts before apple-drm has completed registration, then exits with:

Primary gpu has been removed! Quitting...

This results in a black login screen.

Testing

I tested the following local systemd drop-in via /etc/systemd/system/plasmalogin.service.d/override.conf:

[Service]
ExecStartPre=-udevadm settle --timeout=10

This reliably fixes the black screen on the affected machine. (After running sudo systemctl daemon-reload and restart)

I also tested a variant with only a fixed sleep earlier, but udevadm settle is preferable because it waits for actual pending udev work instead of adding an unconditional delay.

Relation to Existing Bugs / MRs

This appears related to the broader class of startup races discussed in:

I also tested !90:

That MR switches the greeter KWin service to kwin_wayland_wrapper, which can restart KWin after crashes. It did not fix this issue on the affected system. The reason appears to be that this problem is better handled by avoiding the early startup race in the first place, rather than relying on immediate KWin restarts after DRM has changed underneath it.

Why Non-Fatal?

The leading - is intentional:

ExecStartPre=-udevadm settle --timeout=10

If udevadm fails or times out, the login manager should still attempt to start. The wait improves boot robustness on affected systems without making udevadm a hard runtime gate for showing a login screen.

Edited by Matthias Kurz

Merge request reports

Loading