You updated the kernel and the NVIDIA driver broke
You run sudo dnf upgrade --refresh on a Tuesday evening. This is the standard weekly maintenance command on Fedora. It pulls the latest kernel, security patches, and library updates. The system reboots. You log in. The desktop environment crashes immediately, or the resolution drops to 800x600. You check the logs and see the NVIDIA kernel module failed to load. The driver package is installed, but the kernel module does not match the new kernel version.
This scenario happens frequently on Fedora. The proprietary NVIDIA driver requires a kernel module that must be compiled against the exact kernel version you are running. When the kernel updates, the old module becomes invalid. The system boots with the new kernel but has no driver for the GPU. The fallback is the nouveau open-source driver, which often causes display issues or poor performance with NVIDIA hardware.
What's actually happening
The NVIDIA driver is not a single binary. It consists of user-space libraries and a kernel module. The kernel module runs inside the kernel and talks directly to the GPU hardware. When you install the nvidia-driver package via RPM Fusion, the package manager runs a post-install script that compiles the kernel module against the currently running kernel headers.
Fedora uses DKMS (Dynamic Kernel Module Support) to automate this process. DKMS hooks into the kernel update cycle. Ideally, when a new kernel installs, DKMS automatically rebuilds the NVIDIA module for the new kernel. This automation works most of the time. It fails when the kernel headers are not installed, when the DKMS database gets out of sync, or when the NVIDIA package update lags behind the kernel update in the repository.
Think of the kernel module as a physical key cut for a specific lock. When the kernel updates, the lock changes. The old key no longer fits. You need to cut a new key for the new lock. The fix is to reinstall the driver package so the build script runs again against the new kernel headers.
RPM Fusion provides the nvidia-driver package because Fedora does not ship proprietary firmware or drivers. The RPM Fusion package includes the DKMS integration and the dependency on kernel-devel. If you installed the driver manually from the NVIDIA website, you bypassed DKMS. That approach breaks on every kernel update. Use the RPM Fusion package to get automatic rebuilds.
The fix
Run these commands to remove the stale driver, ensure headers match the new kernel, and reinstall the driver to trigger the module rebuild. If the graphical session is broken, switch to a TTY first. Press Ctrl+Alt+F2 to get a login prompt. Log in with your user credentials.
sudo dnf remove nvidia-driver # Removes the driver package and the old kernel module
sudo dnf update kernel-devel kernel-headers # Ensures headers match the running kernel
sudo dnf install nvidia-driver # Reinstalls driver and triggers dkms rebuild for current kernel
sudo modprobe nvidia # Loads the newly built module to test immediately
If the system is completely unresponsive, boot into Recovery Mode from the GRUB menu. Select the kernel entry, press e, append rd.break to the kernel line, and press Ctrl+X. This drops you into a root shell where you can run the fix commands.
Reboot before you debug. Half the time the display manager needs a fresh start to pick up the new module.
Verify it worked
Check the module status and the display manager logs to confirm the driver is active.
lsmod | grep nvidia # Confirms the module is loaded and shows version
journalctl -xeu gdm # Checks for display manager errors after the fix
nvidia-smi # Shows GPU info and driver version if the stack is healthy
The journalctl -xe command adds explanatory text and jumps to the end of the log. Most sysadmins type journalctl -xeu <unit> muscle-memory style. Use gdm for GNOME or sddm for KDE.
Run nvidia-smi first. If that command returns a table with GPU utilization and driver version, the driver is working.
Common pitfalls and errors
Secure Boot blocks the module
If you see modprobe: ERROR: could not insert 'nvidia': Required key not available, Secure Boot is blocking the module. The kernel enforces signature verification when Secure Boot is enabled. The NVIDIA module is built locally by DKMS. It is not signed by a key trusted by the firmware.
You have two choices. Disable Secure Boot in the firmware settings, or sign the module yourself with a Machine Owner Key. Most desktop users disable Secure Boot for this reason. If you keep Secure Boot enabled, you need to generate a key, enroll it in the firmware, and configure DKMS to sign the module. This adds complexity to every kernel update.
Missing kernel headers
If the install fails with Error! Your kernel headers for kernel 6.8.5 cannot be found, the kernel-devel package is missing or mismatched. The DKMS build script cannot compile the module without the headers.
sudo dnf install kernel-devel-$(uname -r) # Installs headers for the exact running kernel
sudo dnf reinstall nvidia-driver # Retries the build with headers present
The $(uname -r) expansion ensures you install headers for the kernel you are currently running. This prevents version drift between the kernel and the development files.
DKMS build failures
If the rebuild fails silently, check the DKMS log. The log shows exactly which header file is missing or which compiler error occurred.
journalctl -t dkms # Shows DKMS build output and errors
cat /var/log/dkms.log # Reads the persistent DKMS log file
Config files in /etc/ are user-modified. Files in /usr/lib/ ship with the package. If you edited a DKMS configuration file, check /etc/dkms/. Never edit files in /usr/lib/dkms/. Those files get overwritten on package update.
Check journalctl -t dkms if the rebuild fails. The log shows exactly which header file is missing.
When to use this vs alternatives
Use sudo dnf reinstall nvidia-driver when the package is already installed and you just need to trigger a rebuild without removing dependencies. Use sudo dnf remove nvidia-driver followed by install when the package metadata is corrupted or you suspect a partial transaction. Use sudo akmods --force when you want to rebuild all kernel modules manually without touching the package manager. Use sudo dnf upgrade --refresh weekly to keep the kernel and drivers in sync and prevent this issue from accumulating. Stay on the nvidia-driver package from RPM Fusion when you want automatic updates and DKMS integration. Switch to the nvidia-driver-390xx package when your GPU is too old for the main driver branch.
Trust the package manager. Manual file edits drift, snapshots stay.