系统更新后重启,键盘长按重复输入功能失效求助
Hey there, let's work through this keyboard repeat issue you're dealing with. From what you've already tested—ruling out hardware, user accounts, and desktop environments, plus knowing it works on a live image—it's clear this is a system-level setting or package issue specific to your installed OS. Here are actionable steps to fix it:
1. Verify and Enable Auto-Repeat in Xorg
First, check if auto-repeat is disabled system-wide. Open any terminal (even the tty session via Strg+Alt+F1) and run:
xset q | grep "auto repeat"
If the output shows auto repeat: off, that's the root cause. Turn it back on immediately with:
xset r on
Then tweak the repeat delay (time before keys start repeating) and rate (speed of repeats) to your preference. For example:
xset r rate 200 50
(200ms delay, 50 repeats per second—adjust the numbers if you want faster/slower behavior)
2. Make Settings Persistent Across Reboots
The xset command resets after a restart, so we need to save these settings permanently. Create an Xorg configuration file:
sudo nano /etc/X11/xorg.conf.d/90-keyboard-repeat.conf
Paste this content into the file:
Section "InputClass" Identifier "keyboard-repeat" MatchIsKeyboard "yes" Option "AutoRepeat" "200 50" EndSection
Save and exit (press Ctrl+O, hit Enter, then Ctrl+X), then reboot to confirm the setting sticks.
3. Fix Repeat Behavior for TTY Sessions
If the issue also affects your tty (Strg+Alt+F1) sessions, we need to adjust console-specific settings. First check current rates:
kbdrate -s
Set your preferred delay and rate with:
sudo kbdrate -d 200 -r 50
To make this persistent, create a systemd service:
- Create the service file:
sudo nano /etc/systemd/system/kbdrate.service
- Add this content:
[Unit] Description=Set persistent keyboard repeat rate for consoles [Service] Type=oneshot ExecStart=/usr/bin/kbdrate -d 200 -r 50 RemainAfterExit=yes [Install] WantedBy=multi-user.target
- Enable and start the service:
sudo systemctl enable --now kbdrate.service
4. Reinstall Input-Related Packages (Post-Update Fix)
Since this started after a system update, it's possible an input handling package got corrupted. Reinstall the relevant packages for your distro:
- For Debian/Ubuntu-based systems:
sudo apt reinstall xserver-xorg-input-libinput xserver-xorg-input-evdev keyboard-configuration
- For Fedora/RHEL-based systems:
sudo dnf reinstall xorg-x11-drv-libinput xorg-x11-drv-evdev system-config-keyboard
- For Arch-based systems:
sudo pacman -S --noconfirm xorg-xinput libinput keyboard-config
5. Check System Logs for Clues
If none of the above works, dig into system logs to find errors related to input devices. Run:
journalctl -b | grep -i "keyboard\|input"
Look for entries about failed input drivers or misconfigured settings—this might point to a deeper issue we missed.
内容的提问来源于stack exchange,提问作者Tobias Gaertner

