"Mouse and keyboard dead" on X11: frozen display vs stuck grab
xorgx11kdedrmgpu-hangsysrqpython-xlibtriage
When a user reports that clicks and typing do nothing on an X11 desktop, there are two very different causes. A stuck grab (a popup or menu holding the pointer and keyboard grab) leaves the screen live and the X server answering. A GPU/DRM fence hang freezes the screen itself; input "looks" dead because nothing repaints. The first is fixable from a shell; the second needs a reboot. Check which one it is before hunting grabs.
Triage order
- Does X answer at all?
DISPLAY=:N timeout 5 xprop -root _NET_ACTIVE_WINDOW. A hang (exit 124) means the X server is dead or blocked: go to step 2. (Find N withps -C Xorg -o args=.) - Kernel:
journalctl -k --since -1h | grep -E 'blocked for more|hung|Xid|amdgpu|NVRM'andps -eo pid,stat,wchan:30,comm | awk '$2 ~ /D/'. A D-statekworkerincommit_work/drm_atomic_helper_wait_for_fences/dma_fence_default_waitmeans a frozen display, not an input problem. Ask the user: does the clock or cursor move? ps -o etimes,argsfor kwin_x11, plasmashell and Xorg, and the CPU-tick delta over 3 s. Zero ticks = blocked.- Only if X answers, hunt for a grab (below).
The fence-hang case (VictusPop, 2026-09-09)
Hybrid box: NVIDIA RTX 4070 was the primary X screen, AMD 780M drove the panel via PRIME. The panel's atomic commit waited on a render fence that never signaled, so the screen froze. Trigger was circumstantial: Steam had just started a game update plus shader precompile. Xorg kept answering for a few minutes (so grab probes seemed to "work"), then stopped answering every client. Killing Xorg is not a fix: DRM close blocks on the same fence and a new X would hang on the same GPU state. Only a reboot recovers.
Recovery without a password
- logind allows the active seat user to reboot:
busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanRebootreturns"yes", thensystemctl reboot(ask the user first; it kills interactive sessions). - Magic SysRq from the frozen keyboard: with
kernel.sysrq=176(128 reboot + 32 remount-RO + 16 sync), Alt+SysRq+S, Alt+SysRq+U, Alt+SysRq+B works even with X dead. R (unraw) and E/I (signals) are not enabled by that mask. SysRq is PrtSc, may need Fn. - Headless probes that hit a dead X socket block forever;
kill -9them.
The stuck-grab case
Symptom: every click and keystroke ignored, but the desktop repaints normally. Common owner: a plasmashell applet popup (the launcher) or any Qt menu of a hung app. Toggle the launcher over D-Bus:
timeout 4 qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.activateLauncherMenu
Toolbox when xdotool/xinput are not installed but python-xlib is (wrap everything in timeout):
- Prove a grab exists: root.grab_pointer(...) / root.grab_keyboard(...) returning AlreadyGrabbed means another client holds it (ungrab immediately on Success).
- Find the owner: map the unmapped keysym XF86LogGrabInfo (0x1008FE25) to a spare keycode with change_keyboard_mapping, fire it with Xlib.ext.xtest.fake_input, unmap, then read the Xorg log section "Printing all currently active device grabs" (lists client pids).
- _NET_CLIENT_LIST_STACKING plus get_input_focus() show the focused popup; check ps -o stat,wchan of its owner.
Gotchas
- A first diagnosis of "stuck grab" was wrong on 2026-09-09; the fence hang was visible in the kernel log the whole time. Always do step 1 and 2 first.
xtest.fake_inputalso triggers KDE global shortcuts, which is handy for testing.
See also
- NVIDIA hybrid graphics on a Pop!_OS laptop (system76-power modes, PRIME)
- Powering off an HDMI monitor kills the KDE X11 session (hybrid-GPU laptop)
- Automating KDE Plasma 5 from a shell (qdbus, global shortcuts, taskbar pins, idle inhibit)
Linked from
- Automating KDE Plasma 5 from a shell (qdbus, global shortcuts, taskbar pins, idle inhibit)
- Driving a desktop from a headless agent shell (DISPLAY, clipboard, sudo hand-off)
- NVIDIA hybrid graphics on a Pop!_OS laptop (system76-power modes, PRIME)
- Powering off an HDMI monitor kills the KDE X11 session (hybrid-GPU laptop)
- Trackmania (2020) on Linux via Steam and Proton, plus the TICK TAS tool
- VictusPop, Justin's desktop (hardware, OS, boot, quirks)