Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active April 22, 2024 05:06
Show Gist options
  • Save grenade/e3c33e6ad4a0da901aa06a7eb4001a73 to your computer and use it in GitHub Desktop.
Save grenade/e3c33e6ad4a0da901aa06a7eb4001a73 to your computer and use it in GitHub Desktop.
# generate keypair
openssl req -new -x509 -newkey rsa:4096 -keyout ~/.ssh/nvidia-module-private.key -outform DER -out ~/.ssh/nvidia-module-public.key -nodes -days 3650 -subj "/CN=nvidia-kernel-module"
# enroll public key in mok list (see https://docs.fedoraproject.org/en-US/Fedora/23/html/System_Administrators_Guide/sect-enrolling-public-key-on-target-system.html)
sudo mokutil --import ~/.ssh/nvidia-module-public.key

if after following the instructions at the fedora-nvidia-guide, you get an error message during driver installation that reads: ERROR: Unable to load the 'nvidia-drm' kernel module, there are a few things to check:

  • does your kernel version match your kernel-devel version?: uname -r && rpm -q kernel && rpm -q kernel-devel
  • does the version of gcc on your system match the version of gcc used to compile your kernel: gcc --version && cat /proc/version

sync your versions to latest by running: sudo dnf install kernel kernel-devel gcc

if you use uefi and secure boot, you also need to sign the nvidia module:

# generate a new signing keypair:
openssl req -new -x509 -newkey rsa:4096 -keyout ~/.ssh/nvidia-module-private.key -outform DER -out ~/.ssh/nvidia-module-public.key -nodes -days 3650 -subj "/CN=nvidia-kernel-module"

# enroll the generated public key in the mok list (see: https://docs.fedoraproject.org/en-US/Fedora/26/html/System_Administrators_Guide/sect-enrolling-public-key-on-target-system.html)
sudo mokutil --import ~/.ssh/nvidia-module-public.key

reboot

when the system reboots it will prompt for the password set in mokutil and enroll the signing key. after that you can reinstall the nvidia driver and sign the kernel module with your enrolled key:

sudo NVIDIA-Linux-x86_64-435.21.run --module-signing-secret-key=$HOME/.ssh/nvidia-module-private.key --module-signing-public-key=$HOME/.ssh/nvidia-module-public.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment