Debian jessie USB Keyboard Problem

I upgraded from Debian wheezy to jessie, and everything went pretty well. But when I rebooted into the new system, my USB keyboard did not work for unlocking the root partition. It took me a good bit of time to find the problem and solve it; maybe this write-up will save someone else time.

More Details About The Problem

debian_jessie-usb_keyboard_problem.png

I upgraded from wheezy to jessie, and then rebooted to begin using the upgraded system. As I rebooted, the USB keyboard did not work for unlocking the root partition. Specifically:

  • It worked in the EFI or BIOS;
  • It worked in the GRUB menu;
  • It did not work for unlocking the root partition;
  • It resumed working once the full system was running.

The fact that the keyboard doesn’t work for unlocking the root partition means the system can’t be used until you find a workaround.

Temporary Workaround

First we need a temporary workaround so that we can boot into the system and work on it. Here are a few ideas:

  • Get an old keyboard that works has a PS2 plug, and use that to unlock the root partition.
  • Select an old kernel in the GRUB menu. This is like turning back time temporarily, to before the upgrade.

The two methods above both worked for me. Other options might be booting the system with a live CD and working on it from there.

Wheezy Solution

I remembered having this problem on wheezy too, so I looked up the old solution. The wheezy solution is covered pretty well on the Debian wiki page about keyboards.

To summarize the wheezy solution: The problem is that the kernel modules needed for a USB keyboard are not present in the initrd.img used to boot the system. You then specifically request that certain USB modules are loaded, and rebuild the initrd.img.

  1. Edit the file /etc/initramfs-tools/modules.
  2. Add these lines:

    # USB keyboard at boot usbcore uhci_hcd ehci_hcd usbhid

  3. Rebuild the initrd.img for the most recent kernel (these are located in /boot/):

    $ sudo update-initramfs -u

The above worked for me in wheezy and I didn’t think too much about it.

Jessie Solution

I had the wheezy solution in place when I updated to jessie. But I still wound up with a USB keyboard that did not work early in the boot process. I tried many things which I will not describe. What finally worked was thinking about what changed between wheezy and jessie.

The most notable thing that changed was the kernel moved from 3.2 to 3.11 (at the time I upgraded). After searching around, I learned that some Linux kernel modules have been renamed or changed between 3.2 and 3.11.

  • For example, the kernel module ehci_hcd was split into two modules, ehci_hcd and ehci_pci.
  • Also, the kernel module usbhid was split into two modules, usbhid and hid_generic.

I may not be exactly correct about how these kernel modules changed, but I was able to get my system working by applying the solution from wheezy (above), and just adding the kernel modules that are related but new between 3.2 and 3.11. The full solution for me looked like this:

  1. Edit the file /etc/initramfs-tools/modules.
  2. Add these lines:

    # USB keyboard at boot usbcore uhci_hcd ehci_hcd ehci_pci usbhid hid_generic

  3. Rebuild the initrd.img for the most recent kernel (these are located in /boot/):

    $ sudo update-initramfs -u

The above solution is the same as the wheezy solution, but with two new kernel modules added to the list. The new modules are ehci_pci and hid_generic.

Hope that helps!