sodcalculator

10 Tech How-To

Fix Ubuntu 20.04 LTS Keyboard and Mouse Not Working

Guide 10-10879 · Updated · Step by step

If your keyboard and mouse stop working in Ubuntu 20.04 LTS, the fix is usually a USB driver issue, a kernel regression, or a GNOME settings problem. You can often restore input by switching to a different USB port, booting with a kernel parameter, or reinstalling the xserver-xorg-input-libinput package. Below are the most effective troubleshooting steps, starting with the quickest and safest.

Why This Happens on 20.04 LTS

Ubuntu 20.04 uses the 5.4 or 5.15 HWE kernel with the libinput driver for both keyboard and mouse. The most common causes of total input failure are:

  • USB controller power management suspending the port (autosuspend)
  • A kernel update that breaks a specific chipset (especially Realtek or ASMedia)
  • GNOME’s input settings getting corrupted, often after a crash or upgrade
  • Wayland session issues (though 20.04 defaults to Xorg for NVIDIA users)
  • Hardware-level firmware bugs on laptops with USB-C or Thunderbolt

The problem is frequently temporary and recoverable without reinstalling. The steps below cover both the live session and the installed system.

Quick Recovery: Get a Working Cursor and Keys Right Now

If you are stuck at the login screen or on the desktop, try these in order. Each takes less than a minute.

  1. Unplug and replug the keyboard and mouse into a different USB port. Prefer a port directly on the motherboard (back panel) over a front-panel hub.
  2. Press Ctrl+Alt+F3 to switch to a text console. If that works, your hardware is fine; the issue is in the GUI. Log in and run sudo systemctl restart gdm to restart the display manager.
  3. Use the on-screen keyboard (if the mouse works) by clicking the accessibility icon in the top-right corner, then selecting “Screen Keyboard”.
  4. Boot from a live USB of Ubuntu 20.04. If the keyboard works there, the problem is in your installed system’s configuration, not the hardware.

Fix 1: Disable USB Autosuspend

Linux’s USB autosuspend can cut power to a device that is idle for a few seconds. This is the most common cause of “keyboard works for a minute, then dies.”

  1. Boot to a text console (Ctrl+Alt+F3) or use a live USB.
  2. Edit the GRUB configuration: sudo nano /etc/default/grub
  3. Find the line GRUB_CMDLINE_LINUX_DEFAULT and add usbcore.autosuspend=-1 inside the quotes. For example:
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"
  4. Run sudo update-grub and reboot.

Fix 2: Reinstall the Input Drivers

The libinput driver is the standard for both keyboard and mouse on 20.04. If its configuration is corrupted, reinstalling it often resolves the issue.

  1. Get to a terminal via Ctrl+Alt+F3 or a live USB chroot.
  2. Run:
    sudo apt update
    sudo apt install --reinstall xserver-xorg-input-libinput
  3. Also remove any stale configuration:
    sudo rm -f /etc/X11/xorg.conf (only if you never created one manually)
  4. Reboot.

Fix 3: Switch to a Different Kernel

If the problem started after a kernel update, boot the previous kernel from the GRUB menu (hold Shift during boot, select “Advanced options”). If that works, you can pin the old kernel:

  1. Remove the problematic kernel: sudo apt remove linux-image-5.15.0-XX-generic (replace XX with the actual version).
  2. Or hold the current one: sudo apt-mark hold linux-image-generic

Fix 4: Reset GNOME Settings

Corrupted GNOME settings can disable input devices. Resetting them is safe but will revert your desktop customization.

  1. From a text console, run: dconf reset -f /org/gnome/desktop/input-sources/
  2. Also reset the entire GNOME session: dconf reset -f /org/gnome/ (this resets all GNOME settings).
  3. Reboot.

When Nothing Works: Reinstall the OS

If you have tried all the above and the keyboard/mouse still fail even in a live session, it is likely a hardware issue or a very early boot problem. Before reinstalling, test the devices on another computer. If they work elsewhere, try a different USB port, a powered hub, or a PS/2 adapter (if your motherboard has PS/2 ports). Reinstalling Ubuntu 20.04 is a last resort but will resolve any software corruption.

Frequently Asked Questions

Why does my keyboard work in BIOS but not in Ubuntu?

This indicates the hardware is fine. The issue is in the Linux kernel or the display server. Try the USB autosuspend fix first, then reinstall libinput. If it still fails, boot with a different kernel from GRUB.

Can I use a wireless keyboard/mouse during these fixes?

Yes, but wireless receivers are also USB devices and can be affected by the same autosuspend issue. If a wired device works, use that for the fixes. If only wireless devices fail, try moving the receiver to a different port or using a USB extension cable to reduce interference.

Will updating to a newer kernel break my input devices?

It can. The 5.15 HWE kernel (available via ubuntu-drivers install) is generally stable, but regressions do happen. If you update and lose input, boot the previous kernel and report the bug to Launchpad.

Is this a hardware failure or a software problem?

If the devices work in BIOS, in another OS, or on another computer, it is software. If they fail everywhere, it is hardware. The live USB test is the quickest way to tell.

Does Wayland cause keyboard/mouse failures?

Wayland can have input issues with certain graphics drivers, but 20.04 defaults to Xorg for NVIDIA and Wayland for AMD/Intel. If you are on Wayland, switch to Xorg at the login screen (gear icon) and test.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →