Unresponsive Key (keycode 248) on Linux: Troubleshooting with xev

Abstract: Resolve unresponsive keyboard keys on Linux by using xev to diagnose whether the issue stems from kernel driver failures or X server configuration errors.

Created: 2026-09-20 by

When a keyboard key fails to register in X11 applications, the xev utility is the primary diagnostic tool. If you observe no output for a specific key, such as one reporting keycode 248 in examples, it indicates that the kernel or X server is not receiving the hardware scan code. This guide explains how to use xev to confirm input loss and resolve the underlying driver or configuration issues.

Understanding Keycode 248 in Diagnostics

Keycode values are not universal constants; they are dynamic identifiers assigned by the X server based on the current keyboard layout and hardware detection. In many online examples, keycode 248 is used merely as a placeholder for "the key that isn't working." It does not correspond to a specific physical key across all systems. When troubleshooting, you must identify the actual keycode generated by your system during the diagnostic phase. The X Window System translates physical key presses into keycodes before passing them to applications. If an application like a terminal emulator or browser does not respond to a key, the issue lies either before the X server (kernel/driver) or within the X server's mapping logic. Using xev allows you to isolate where this chain breaks.

Running xev to Diagnose Input Loss

To determine if the operating system is seeing the key press, follow these steps:
  1. Install xev: Ensure the package is installed. On Debian/Ubuntu systems, run sudo apt install xev. On Fedora, use sudo dnf install xev.
  2. Launch the Utility: Open a terminal and execute xev. A small window titled "Event Tester" will appear.
  3. Focus the Window: Click inside the xev window to ensure it has focus. The terminal should display log entries as you interact with the keyboard.
  4. Press the Problematic Key: Press the key that is unresponsive in other applications. Observe the terminal output closely.
If the key is functioning correctly at the hardware level, you will see events like KeyPress followed by KeyRelease, along with a specific keycode number. For example:
KeyRelease event, serial 37, synthetic NO, window 0x...
    root 0x..., subw 0x0, time 1234567, (-10,10), root:(100,100),
    state 0x0, keycode 248 (keysym 0xffe5, Shift_L), same_screen YES,
In this hypothetical output, keycode 248 maps to the Shift_L symbol. However, if you press the key and see absolutely nothing in the terminal, the problem is deeper than a simple software mapping error.

Interpreting Empty Output

When xev produces no output for a specific key, it means the X server never received the event. This typically points to three potential causes:
  • Kernel Driver Issue: The Linux kernel may not be loading the correct input driver for the keyboard device. This is common with specialized gaming keyboards or after recent kernel updates.
  • Hardware Failure: The switch itself may be broken, preventing any electrical signal from reaching the controller.
  • X Server Configuration: Rarely, the X server might be ignoring certain scan codes due to conflicting configuration files.
It is crucial to distinguish between a missing keycode in xev and a missing keysym. If xev shows a keycode but no visual change in apps, the issue is likely a setxkbmap or xmodmap configuration error. If xev shows nothing, the issue is at the driver or hardware level.

Resolving Kernel-Level Input Issues

If xev confirms no events are sent, check the kernel's input subsystem. You can verify if the kernel sees the key by using the showkey command in a virtual console (TTY), switching away from the graphical environment with Ctrl+Alt+F3.
sudo showkey -k
If showkey detects the key press in TTY mode but xev does not, the problem is isolated to the X server. You may need to update your Xorg configuration or reinstall the xserver-xorg-input-evdev package. Conversely, if neither tool detects the key, the issue is likely hardware-related or requires a kernel module reload. Rebooting the system often forces the kernel to re-enumerate USB or PS/2 devices, which can restore functionality for previously unresponsive keys. For users experiencing broader system instability alongside input issues, checking system logs for hardware errors is advisable. See our guide on Troubleshooting System Freezes after Changing Processors or GPUs on Linux for related diagnostic techniques.

Verifying Keyboard Layout Mappings

Once you have confirmed that the kernel sends events via showkey, you must ensure the X server maps them correctly. Use xmodmap -pke to list all current key mappings. Search for the detected keycode to see its assigned keysym. If the keysym is NoSymbol, the key is effectively disabled in your current layout. You can remap keys temporarily using xmodmap. For instance, to assign a function to an empty keycode:
xmodmap -e "keycode 248 = F1"
This command maps keycode 248 to the F1 function key. To make changes persistent, add the command to your ~/.xprofile or desktop environment's startup settings. Always verify the change by running xev again to ensure the new keysym appears in the output.

Frequently Asked Questions

Why does xev show different keycodes for the same key on different machines?

Keycodes are dynamically assigned based on the physical device ID and the active keyboard layout. There is no fixed standard for which keycode corresponds to the 'A' key across all hardware. Always rely on the output of xev for your specific system rather than generic online tables.

How do I fix a key that works in terminals but not in browsers?

This indicates the X server receives the event, but the application ignores it or has a conflicting binding. Check your browser's shortcut settings or use xdotool to simulate the key press for debugging. Clearing browser caches or disabling extensions often resolves application-specific conflicts.

What if xev crashes when I press a specific key?

A crash suggests a bug in the X server driver handling that specific scan code. Update your graphics and input drivers to the latest version. Reporting the bug to your distribution's tracker with the exact keycode and driver version is the best course of action.

Can I use xev to test keys on a remote machine?

No, xev relies on local X11 forwarding and cannot capture hardware events over SSH without complex X11 tunneling setup. Use ssh-keygen or local TTY tools like showkey for remote diagnostics. Physical access or proper KVM/IPMI is required for hardware-level testing.

Is keycode 248 always the same as the Shift key?

No, keycode 248 is just an example value often used in tutorials. On some layouts, it might map to Shift, while on others, it could be unused or mapped to a media key. Always check the actual keysym returned by xev to understand what the key represents in your context.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More