After enabling Secure Boot in BIOS settings on my PC with Kubuntu, I noticed laggy animations. When checking nvidia-smi, I got this error:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
Updating apt packages and drivers didn't help. After a day of troubleshooting, here's what worked for me:
# Install necessary tools
sudo apt update && sudo apt install -y openssl mokutil
# Create directory for keys
sudo mkdir -p /var/lib/shim-signed/mok/
# Generate the key that will be used to sign drivers
sudo openssl req -new -x509 -newkey rsa:2048 -keyout /var/lib/shim-signed/mok/MOK.priv -outform DER -out /var/lib/shim-signed/mok/MOK.der -days 36500 -subj "/CN=MyKey4Nvidia/" -nodes
# Import generated key
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
Now you will be prompted to enter a new password, this can be any string (not necessary your user's password). Remember it! You'll need to enter it after reboot.
# Reinstall NVIDIA drivers
sudo apt purge 'nvidia*'
sudo apt autoremove
sudo ubuntu-drivers autoinstall
Reboot your system. At the beginning of the boot process, you'll see a countdown for 10 seconds to enter the MOK management menu.
Select "Enroll MOK", press continue, and enter the password you created earlier. After enrollment, select the reboot option.
That's it! After booting up, you should have working NVIDIA drivers. Verify this with the nvidia-smi command.
Top comments (0)