Keyboard and mouse not working after upgrading nvidia drivers on Ubuntu 20.04

After installing the latest nvidia drivers on ubuntu 20.04 I can no longer use mouse/keyboard. I used this recipe: How can I install Nvidia drivers on Ubuntu 18.04 with secure boot?.

I believe this must be something to do with secure boot since I was asked to set a password at the bios screen after rebooting.

Since I can still access via ssh, I have followed the instructions here.

However, the following message comes up:

WARNING:root:_pkg_get_support nvidia-driver-390: package has invalid Support Legacyheader, cannot determine support level
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 linux-modules-nvidia-470-generic-hwe-20.04 : Depends: linux-modules-nvidia-470-5.11.0-37-generic (= 5.11.0-37.41~20.04.2) but it is not going to be installed
                                              Depends: nvidia-kernel-common-470 (<= 470.63.01-1) but 470.74-0ubuntu0.20.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

I first tried to purge nvidia packages but when I try to remove the package with have unmet dependencies directly (linux-modules-nvidia-470-generic-hwe-20.04), it fails saying it is not installed!

And whilst this is going on, it seems that nvidia-driver-390 is named as well.

So I've stopped before I do anything more damaging...

The main problem is the keyboard and mouse, not the driver atm. I cannot use the keyboard to enter bios.

Has anyone got any ideas?

I have tried the following:

  • Keyboard, Touchpad and external mouse not working after Nvidia driver uninstallation, xorg reinstallation

  • https://newbedev.com/ubuntu-18-04-keyboard-and-mouse-not-working-at-login-screen


I got the exact same error concerning the unmet dependencies and for me the following worked: Paste each code line by line into the terminal

sudo su

(enter root password)

for FILE in $(dpkg-divert --list | grep nvidia-470 | awk '{print $3}'); do dpkg-divert --remove $FILE; done
exit

After that:

sudo apt-get install -f
sudo apt-get update
sudo apt-get upgrade

Then:

sudo apt-get autoclean
sudo apt-get autoremove

Then I rebooted the system, ran sudo apt-get update && sudo apt-get upgrade again and could install the correct driver in the Additional Drivers tab from Software & Updates. Hope it helps!