I had the same problem and I tried several things, and finally, this is what worked for me:
First, you need to enter into recovery mode. Enter the GRUB menu by rebooting and then pressing eSC if you boot using UEFI or Shift if you boot using BIOS. You may have to press the key multiple times or hold the key down.
When you see the menu, use the arrow keys to navigate and select Advanced options for Ubuntu.
Select the line containing the latest version of the kernel but with (recovery mode) at the end and press Enter.
After you entered recovery mode you will see the Recovery Menu. Navigate to the line containing root Drop to root shell prompt. Press Enter and then when you see a prompt press Enter for maintenance press Enter again.
Run the following commands:
sudo apt-get update --fix-missing
sudo apt-get upgrade -y
sudo apt-get install -y xserver-xorg-input-all
Finally to restart run the command:
sudo reboot
When the login page appears, your mouse and keyboard should work normally.
Note: if you get an error Temporarily unable to fetch ....com when running apt-get, press Ctrl+D from the root prompt to go back to recovery menu and select Network in the drop down to access the internet.