I updated my laptop to 18.04 from 17.10 . The keyboard inputs are recognized only in the login screen after booting. Keyboard also works fine if I switch into the terminal from the login screen. But when logged in no keystrokes are perceived.
11 Answers
Installing xserver-xorg-input
solved my problem !
Expanding on the above for the inexperienced, it is possible to turn on the on-screen keyboard (accessibility menu) as it is likely that external USB keyboards will also not work. After that perhaps the command
sudo apt-get install xserver-xorg-input-all
will do it. You need to shutdown and reboot each time (closing the lid usually just puts it to sleep).
At time of login press Ctrl+Alt+F3.
Then input your username and password.
After that, input the command
sudo apt-get install xserver-xorg-input-all
Then input
startx
And your problem will be solved.

- 2,426
For anyone who still has this issue, in my case it's that somehow "Slow Keys" was turned on in the accessibility menu (little person icon in the upper-right corner of the login screen).
Was driving me crazy!

- 387
Also I've just discovered the "capitalise" button on the on-screen keyboard doesn't work. You may need type your password into libre office and use the capitalise menu button then paste your password into the terminal.

- 11
Ubuntu 18.04.1 here. In my case, only the numb-pad keys did not work. This was due to Settings>Universal Access>Mouse Keys being enabled.

- 11
Not sure why @thunderstorm got negative vote for his answer but his answer solved the keyboard issue for me. My keyboard input could work on grub menu and during console but stopped working on login screen after I upgraded my Ubuntu from 18.04.1 to 18.04.2.
The issue was cased by running sudo apt-get install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04
( According to www.omgubuntu.co.uk/2019/02/ubuntu-18-04-2-lts-released ).
It appears above put system in broken mode. Running sudo apt-get install xserver-xorg-input-all
with touch input and onboard onscreen keyboard could solve the issue with physical keyboard.

- 3,887

- 91
- 1
- 1
- 4
Well, I was running Ubuntu 18.04 and noticed that my chromebook's keyboard was not working. So after nothing seemed to work I just updated the Kernel version ukuu. See here for an installation guide Ukuu Makes it Easy to Install Mainline Linux Kernels on Ubuntu - OMG! Ubuntu.
In case this site is no longer available try :
sudo add-apt-repository ppa:teejee2008/ppa
sudo apt-get update && sudo apt-get install ukuu
and then run ukuu
or ukuu-gtk
So , I updated to version 4.19.38 and then it worked. However I knew that Ubuntu 16.04 was working on my chromebook too.
So I think changing the kernel version is the solution for many hardware troubles.

- 17,696
After upgrading to 18.04 my keyboard wasn't working, not even at the login screen. After trying a bunch of things I had an epiphany and replaced my PS/2 keyboard with a USB keyboard and sure enough that was the issue (which is weird because my PS/2 mouse still works).
-
Glad you solved it but you might still want to ask a new question about the PS/2 keyboard on Ubuntu 18.04. – Melebius Oct 09 '18 at 07:08
It was driving me crazy and I was coming to the conclusion it was planned obsolescence ... ... I am happy to report I was wrong!
In my Hp Omen Laptop ... Windows and/or Hp and/or Ubuntu Incompatibility appears to be the culprit.
Solution was to get into the BIOS and disable the "Action Keys" (Function Keys), then ... the USB Wireless Keyboard and Mouse ... Started Working again.
To add to the Windows/Hp conspiracy Theory ... the problem seems to come in when the Hp Omen (Laptop) keys are lit up in the cool Omen X way.

- 2,587
For those with Ubuntu 18.04 who can not find settings -> universal tools Here is what you do simply: Control Center -> Keyboard Uncheck the
Only accept long keypresses
under the
Slow Keys
option

- 123
xserver-xorg-input-libinput
andxserver-xorg-input-synaptics
, and installing a synaptics tweak (e.g. GitHub.com/urbie-mk2/xf86-input-synaptics). Unfortunately, removing those two packages and installing the tweaked package breaks the keyboard input after logging into user – geominded May 25 '18 at 21:38apt-get
will fail! See here for how to start wifi in recovery mode ... https://askubuntu.com/questions/104066/enable-wi-fi-in-recovery-terminal – yuqli Jun 29 '20 at 18:54