我遇到了一个奇怪的问题,我无法理解。
我的机器运行的是 Ubuntu 22.04,带有 KDE Plasma 桌面 5.27.10。
每当我插入外围设备(键盘、鼠标、麦克风)时,键盘都会冻结一分钟或更长时间。更令人困惑的是,这种冻结分为两个阶段。
首先,按键由 xev 注册,但除此之外,没有由任何程序注册。光标移动并单击,无论是通过鼠标还是使用键盘控制(我有一个可编程键盘,我在其上将按键设置为该功能)。
在第二阶段,xev 不再注册按键,但光标仍然会移动(随键盘和鼠标移动)。但是,鼠标键会反转 - 左键变为右键,右键变为左键。这不是任意的疯狂;我有一个左手鼠标,并且“左手模式”(可切换两个键)已打开。我怀疑发生的原因是此非默认设置暂时不适用。
在任一阶段,如果我切换到另一个终端(我不确定正确的术语是什么;按下 ctrl-alt-F(2-12) 时打开的控制台),键盘键就会正常注册,例如,我可以登录并与控制台交互。
这种冻结相当长。我从未测量过,它似乎有些变化,并且大部分时间至少持续一分钟。当它结束时,似乎至少有一些击键被记录下来;至少,如果我在冻结期间尝试按 Alt-Tab 键,冻结结束时会有一个窗口切换,但似乎并不是所有之前的击键都是在那一刻级联输入的。
自从我买了这台电脑(新的,一年前)以来,情况就是如此。两种不同的键盘型号都是这种情况。
任何帮助,将不胜感激。
编辑:根据@waltinator的建议,我附加了日志journalctl
。我删除了日期和计算机名称以更好地适应长行。这个和其中一条评论让我意识到当我连接(通过USB)外部硬盘时不会发生这种冻结。
断开键盘(ZSA Technology Labs Moonlander Mark I)。一开始就断开了,2 秒后重新连接。键盘在 21:15:50 左右恢复工作:
21:14:31 kernel: usb 3-2: USB disconnect, device number 5
21:14:31 acpid[1155]: input device has been disconnected, fd 15
21:14:31 acpid[1155]: input device has been disconnected, fd 24
21:14:31 acpid[1155]: input device has been disconnected, fd 25
21:14:31 acpid[1155]: input device has been disconnected, fd 26
21:14:33 kernel: usb 3-2: new full-speed USB device number 6 using xhci_hcd
21:14:34 kernel: usb 3-2: New USB device found, idVendor=3297, idProduct=1969, bcdDevice= 0.01
21:14:34 kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
21:14:34 kernel: usb 3-2: Product: Moonlander Mark I
21:14:34 kernel: usb 3-2: Manufacturer: ZSA Technology Labs
21:14:34 kernel: input: ZSA Technology Labs Moonlander Mark I as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.0/0003:3297:1969.0012/input/input40
21:14:34 kernel: hid-generic 0003:3297:1969.0012: input,hidraw0: USB HID v1.11 Keyboard [ZSA Technology Labs Moonlander Mark I] on usb-0000:0d:00.3-2/input0
21:14:34 kernel: hid-generic 0003:3297:1969.0013: hiddev0,hidraw1: USB HID v1.11 Device [ZSA Technology Labs Moonlander Mark I] on usb-0000:0d:00.3-2/input1
21:14:34 kernel: input: ZSA Technology Labs Moonlander Mark I as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.2/0003:3297:1969.0014/input/input41
21:14:34 kernel: hid-generic 0003:3297:1969.0014: input,hidraw2: USB HID v1.11 Mouse [ZSA Technology Labs Moonlander Mark I] on usb-0000:0d:00.3-2/input2
21:14:34 kernel: input: ZSA Technology Labs Moonlander Mark I System Control as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.3/0003:3297:1969.0015/input/input42
21:14:34 mtp-probe[142405]: checking bus 3, device 6: "/sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2"
21:14:34 mtp-probe[142405]: bus: 3, device: 6 was not an MTP device
21:14:34 kernel: input: ZSA Technology Labs Moonlander Mark I Consumer Control as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.3/0003:3297:1969.0015/input/input43
21:14:34 kernel: input: ZSA Technology Labs Moonlander Mark I Keyboard as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2/3-2:1.3/0003:3297:1969.0015/input/input44
21:14:34 kernel: hid-generic 0003:3297:1969.0015: input,hidraw3: USB HID v1.11 Keyboard [ZSA Technology Labs Moonlander Mark I] on usb-0000:0d:00.3-2/input3
21:14:34 systemd-logind[1189]: Watching system buttons on /dev/input/event2 (ZSA Technology Labs Moonlander Mark I)
21:14:34 systemd-logind[1189]: Watching system buttons on /dev/input/event6 (ZSA Technology Labs Moonlander Mark I Keyboard)
21:14:34 systemd-logind[1189]: Watching system buttons on /dev/input/event5 (ZSA Technology Labs Moonlander Mark I Consumer Control)
21:14:34 systemd-logind[1189]: Watching system buttons on /dev/input/event4 (ZSA Technology Labs Moonlander Mark I System Control)
21:14:34 mtp-probe[142439]: checking bus 3, device 6: "/sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-2"
21:14:34 mtp-probe[142439]: bus: 3, device: 6 was not an MTP device
21:15:01 CRON[145959]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
21:15:01 CRON[145960]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
21:15:01 CRON[145959]: pam_unix(cron:session): session closed for user root
21:15:32 kcminit[146022]: Initializing "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_mouse.so"
21:15:32 kcminit[146022]: Initializing "/usr/lib/x86_64-linux-gnu/qt5/plugins/plasma/kcms/systemsettings/kcm_touchpad.so"
21:15:32 kcminit[146022]: kcm_touchpad: Using X11 backend
在这里我断开了麦克风(金士顿 HyperX Quadcast,通过 USB 连接)。键盘在大约 21:20:12 恢复功能:
21:18:57 plasmashell[3349]: org.kde.plasma.pulseaudio: No object for name "alsa_input.usb-Kingston_HyperX_Quadcast_4110-00.3.analog-stereo"
21:18:57 plasmashell[3349]: file:///usr/share/plasma/plasmoids/org.kde.plasma.volume/contents/ui/ListItemBase.qml:119: TypeError: Value is undefined and could not be converted to an object
21:18:57 plasmashell[3349]: org.kde.plasma.pulseaudio: No object for name "alsa_output.usb-Kingston_HyperX_Quadcast_4110-00.3.analog-stereo"
21:18:57 plasmashell[3349]: org.kde.plasma.pulseaudio: No object for name "alsa_input.usb-Kingston_HyperX_Quadcast_4110-00.3.analog-stereo"
21:18:57 plasmashell[3349]: file:///usr/share/plasma/plasmoids/org.kde.plasma.volume/contents/ui/ListItemBase.qml:119: TypeError: Value is undefined and could not be converted to an object
21:18:57 acpid[1155]: input device has been disconnected, fd 9
21:19:01 kernel: usb 3-3: new full-speed USB device number 7 using xhci_hcd
21:19:01 kernel: usb 3-3: New USB device found, idVendor=0951, idProduct=16df, bcdDevice= 1.00
21:19:01 kernel: usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
21:19:01 kernel: usb 3-3: Product: HyperX Quadcast
21:19:01 kernel: usb 3-3: Manufacturer: Kingston
21:19:01 kernel: usb 3-3: SerialNumber: 4110
21:19:01 kernel: input: Kingston HyperX Quadcast Consumer Control as /devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-3/3-3:1.3/0003:0951:16DF.0016/input/input45
21:19:01 mtp-probe[146608]: checking bus 3, device 7: "/sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-3"
21:19:01 mtp-probe[146608]: bus: 3, device: 7 was not an MTP device
21:19:01 kernel: hid-generic 0003:0951:16DF.0016: input,hiddev2,hidraw6: USB HID v1.00 Device [Kingston HyperX Quadcast] on usb-0000:0d:00.3-3/input3
21:19:01 systemd[2871]: Reached target Sound Card.
21:19:01 mtp-probe[146629]: checking bus 3, device 7: "/sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb3/3-3"
21:19:01 mtp-probe[146629]: bus: 3, device: 7 was not an MTP device
21:19:01 wireplumber[2881]: The decibel volume range for element 'Speaker' (-4000 dB - -900 dB) has negative maximum. Disabling the decibel range.
21:19:01 wireplumber[2881]: The decibel volume range for element 'Speaker' (-4000 dB - -900 dB) has negative maximum. Disabling the decibel range.
21:19:01 wireplumber[2881]: The decibel volume range for element 'Speaker' (-4000 dB - -900 dB) has negative maximum. Disabling the decibel range.
21:19:01 wireplumber[2881]: The decibel volume range for element 'Speaker' (-4000 dB - -900 dB) has negative maximum. Disabling the decibel range.
答案1
在事件发生后的 5 分钟内,终端命令sudo journalctl --since="-5 minutes"
将显示涵盖该事件的系统日志。阅读man journalctl
。每条日志消息都以时间戳、发出日志条目的主机、进程名称、发出[]
者的 PID 和冒号 ( :
) 开头。冒号后的所有内容都是来自程序员的消息,旨在帮助用户了解程序的行为。阅读man logger
。
您可能需要交换空间。查看free
是否有交换空间。
使用交换空间来控制当程序分配了所有实际内存并需要更多内存时会发生什么。在所有可释放的缓存(某些缓存块“正在使用”,无法释放)释放后,系统进入内存不足状态。在内存不足的情况下,使用交换,某些任务的内存被写入磁盘,释放以供重用,然后在任务运行时返回到内存(交换)。如果没有交换,系统可能会冻结,可怕的 OOM-Killer(内核中硬编码的伪进程)运行,并选择一个进程来杀死,以释放内存。OOM-Killer 以不方便的选择而闻名。
系统休眠需要 RAM 大小的连续交换区域。
读man mkswap fallocate filefrag swapon fstab
。