You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux下Minecraft及其他应用键盘输入粘滞/卡顿问题排查求助

Linux下Minecraft及其他应用键盘输入粘滞/卡顿问题排查求助

各位大佬好,我最近在Linux下遇到了一个非常头疼的键盘输入问题,实在不知道该往哪个方向查了,想请大家给点思路。

TLDR

键盘输入会突然锁死,在玩Minecraft时(尤其是用WASD移动的时候)最明显;换过Ubuntu到Fedora系统、去掉了USB hub、换了不同键盘,问题还是存在;附上了xev的输出日志,求排查方向。

详细问题描述

我是在玩Minecraft Java版时最先发现这个问题的:按下的键盘键会出现软件层面的“粘滞”——物理按键已经松开了,但系统好像以为我还按着,完全没反应。这时候鼠标是正常工作的,唯一能触发的键盘操作只有Ctrl+Alt+F(n)切换到其他控制台;切回桌面后,要等一段时间键盘才会恢复响应。

后来发现这个问题不光在Minecraft里出现,刚才在Firefox写内容时也中招了:文本框里输入完全没反应,鼠标能正常选中文本、切换窗口,甚至按Super键能唤起Activities,但Firefox里的输入要等2分钟才慢慢显示出来,最后只能用鼠标把写了一半的内容复制到文本编辑器继续。

而且这个问题是随机出现的,但Minecraft全屏时发作更频繁,持续时间也更长。

硬件与当前环境

硬件配置

  • Dell Precision 3650
  • Intel i7-11700K
  • 32GB DDR4内存
  • EVGA GeForce GTX 970 OC显卡

当前系统环境

  • Fedora Linux 39 (Workstation Edition)
  • 内核版本:Linux 6.6.6-200fc39.x86_64
  • GNOME 45.2,使用X11会话
  • 试过的键盘:E-Element Z-88 USB键盘、Motospeed K-82 USB键盘
  • 试过的鼠标:Logitech G502、Anker光学垂直鼠标
  • USB连接方式:之前是Anker A7515 USB hub → Sabrent USB-SW30 USB切换器 → 主板后置USB;也试过直接把键鼠连到主板前置USB端口

已经尝试过的排查步骤

  • 更换不同的USB端口(前置/后置)
  • 对比直连主板USB vs 通过hub/切换器连接的情况
  • 切换Minecraft全屏/窗口化模式
  • 从Ubuntu 22.04(X11)换成Fedora 39(X11),系统都是最新更新的状态

还没尝试切换到Wayland会话,打算之后试试,但不确定是不是X11专属问题。

xev监控的日志对比

我用xev工具监控了键盘输入,发现了正常和异常状态下的输出差异:

正常状态下的xev输出(Minecraft中按键)

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12770871, (2305,800), root:(2305,1054),
state 0x10, keycode 39 (keysym 0x73, s), same_screen YES,
XLookupString gives 1 bytes: (73) "s"
XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12771159, (2373,791), root:(2373,1045),
state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
XLookupString gives 1 bytes: (77) "w"
XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12771159, (2373,791), root:(2373,1045),
state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
XLookupString gives 1 bytes: (77) "w"
XmbLookupString gives 1 bytes: (77) "w"
XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12771207, (2373,791), root:(2373,1045),
state 0x10, keycode 25 (keysym 0x77, w), same_screen YES,
XLookupString gives 1 bytes: (77) "w"
XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12772551, (2409,793), root:(2409,1047),
state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12772551, (2409,793), root:(2409,1047),
state 0x10, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12772623, (2409,793), root:(2409,1047),
state 0x14, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12772623, (2409,793), root:(2409,1047),
state 0x14, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False

问题发作时的xev输出(按下W键为例)

KeyPress event, serial 30, synthetic NO, window 0x4c0000b,
root 0x1ef, subw 0x0, time 12717159, (31,636), root:(31,890),
state 0x14, keycode 25 (keysym 0x77, w), same_screen YES,
XLookupString gives 1 bytes: (17) ""
XmbLookupString gives 1 bytes: (17) ""
XFilterEvent returns: False

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
keys:  4294967279 0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
keys:  4294967279 0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyGrab, detail NotifyNonlinear

FocusIn event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
keys:  2   0   0   2   32  0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

FocusOut event, serial 30, synthetic NO, window 0x4c0000b,
mode NotifyGrab, detail NotifyNonlinear

可以看到异常时会反复出现FocusOut/FocusIn和KeymapNotify事件,而且W键对应的keys矩阵里一直有32的标记,直到问题自行恢复。

现在实在不知道该继续排查哪些地方了,除了切换Wayland之外,有没有大佬能指点下,比如查看哪些系统日志、检查显卡/键盘驱动,或者用其他工具来定位问题根源?

备注:内容来源于stack exchange,提问作者monkadelic_d

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 12:23:01