What a nightmare!
I solved this once when several months ago when I got new hardware and did not write down the instructions. Kernel did an update, now my drivers do not work. After some head wall bashing for a day, I have solved the problem again. For reference, I have a 5080 RTX.
Here is the most straightforward way to have Nvidia drivers work for Ubuntu 24.04 with secure boot enabled:
# purge any and all existing nvidia installations
sudo apt purge --purge nvidia-*
sudo apt purge --purge libnvidia-*
# Download NVIDIA-Linux-x86_64-570.86.16.run from https://www.nvidia.com/en-us/drivers/details/240524/
# Run this installer
sudo ./NVIDIA-Linux-x86_64-570.86.16.run
- Choose MIT/GPL (non proprietary)
- Yes to continuing the installation on any prompt that requests it.
- Yes sign the module. Use a new key. Write down the location of the .der file it tells you. The path will look like
/usr/share/nvidia/nvidia-modsign-crt-HEX.der
- Yes to update/overwrite X server settings.
Before you restart your computer, you will need to load the public key (der file above) into the Machine Owner Key list.
sudo mokutil --import /usr/share/nvidia/nvidia-modsign-crt-HEX.der
-
It will then prompt you for a password. Type it in twice.
-
Reboot.
-
On reboot, the system will ask you if you want to examine new keys, do so, the signature should match what you were told in the installation (fingerprint, etc...).
-
You will be prompted for a password to load the module, use the password you made earlier.
Your nvidia linux drivers should now be loaded and working.
Confirm with nvidia-smi
.
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.86.16 Driver Version: 570.86.16 CUDA Version: 12.8 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 5080 Off | 00000000:01:00.0 On | N/A |
| 0% 29C P8 26W / 360W | 507MiB / 16303MiB | 1% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 3046 G /usr/lib/xorg/Xorg 280MiB |
| 0 N/A N/A 3428 G /usr/bin/gnome-shell 47MiB |
| 0 N/A N/A 4670 G /opt/google/chrome/chrome 4MiB |
| 0 N/A N/A 4738 G ...ersion=20250511-180108.192000 120MiB |
+-----------------------------------------------------------------------------------------+