Can't type in login password because no keyboard is found

I was trying to edit a keyboard layout in Ubuntu 14.04, but it wasn't accepting the changes.

  • I looked it up and found I needed to delete /var/lib/xkb to make the change take effect. I did that and it still hadn't taken effect, but nothing had changed either.
  • I looked further and found I had to do sudo restart lightdm. I did that and it did its thing, but when I tried to log back in, I couldn't type.
  • I shut down and tried again, but I still couldn't type. I went to onscreen keyboard and it said No X keyboard found, retrying…

I don't even have a USB keyboard or anything, it's a laptop with the keyboard built in. I can't do anything because my keyboard doesn't work and I have no idea what to do. Help!


Solution 1:

Just had this happen. I was editing /usr/share/X11/xkb/symbols/pc (remapping alt to ctrl) but forgot a semicolon and could not use my keyboard to log in.

I restarted using GRUB to select recovery mode and then root terminal mode. Keyboard worked in the simple root terminal and I was able to edit and fix .../pc. Phew!

Solution 2:

I had the same happen after making some (apparently) bad changes to /usr/share/X11/xkb/symbols/pc and rm /var/lib/xkb/*.xkm.

I ended up being able to recover by logging in as guest, clicking open the wifi menu, clicking Connection Information, getting the IPv4 address, and ssh'ing in from my other computer. Then I undid my bad changes to pc, quit the ssh connection, and restarted the Ubuntu box. The keyboard worked normally when the login screen came back up.

Note that this wouldn't have worked if I had been following decent security practices and not allowed root via ssh, but this was a fairly new install and I hadn't gotten around to that yet.