When it comes to maximizing the performance of your NVIDIA GPU on Fedora, installing the right drivers is crucial. With various methods available, each catering to different user needs and levels of expertise, it’s essential to adopt a tried-and-true approach that ensures compatibility and reliability. This article will guide you step-by-step through installing NVIDIA drivers using RPM Fusion, the official NVIDIA repository, and even a manual installation method for advanced users.

Install NVIDIA Drivers Using RPM Fusion (Recommended Method)

Step 1: Update Your Fedora System
Start by ensuring that your system is up to date, which helps minimize conflicts during the installation process.

sudo dnf update

Step 2: Add RPM Fusion Repositories
RPM Fusion hosts proprietary NVIDIA drivers compatible with Fedora. You must install both the free and nonfree repositories.

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Step 3: Identify Your NVIDIA GPU Model
It’s essential to verify your GPU model to select the appropriate driver.

lspci | grep VGA

Check the RPM Fusion NVIDIA Howto page to determine which driver suits your model. Most modern GPUs will require the akmod-nvidia package, while older models might need specific legacy drivers.

Step 4: Install the Appropriate Driver Package
For most current NVIDIA GPUs, execute:

sudo dnf install akmod-nvidia

For legacy GPUs, adjust the package name as needed.

This installation process will set up required dependencies such as kernel modules and CUDA libraries, enhancing the gaming and graphical experience by utilizing the akmod system to build kernel modules.

READ 👉  Flowframes – Restore smoothness to choppy videos and animated GIFs with the help of AI

Step 5: Reboot Your System
To load the new modules, reboot your computer.

sudo reboot

After rebooting, verify if the driver is operational by executing:

nvidia-smi

This command should display your GPU details and the current driver version. If issues arise or you revert to the Nouveau driver, ensure compatibility between the driver version and your GPU, and check if Secure Boot has disabled the module loading.

Step 6: Secure Boot Considerations
If Secure Boot is activated, enrolling a Machine Owner Key (MOK) during installation can facilitate module loading. Refer to the RPM Fusion Secure Boot guide for detailed instructions.

Step 7: GPU Switching for Optimus Laptops (Optional)
For laptops equipped with both integrated and discrete GPUs, utilize switcheroo-control for smooth GPU switching. This functionality allows per-application GPU selection, either graphically or through command-line variables.

Install NVIDIA Drivers Using the Official NVIDIA Repository (Advanced)

With Fedora 41 and newer, users can install drivers directly from NVIDIA’s repository for the latest updates and specific configurations.

Step 1: Install Kernel Development Tools
Ensure essential development tools and headers are in place.

sudo dnf install kernel-devel-matched kernel-headers

Step 2: Enable NVIDIA CUDA Repository
Add the CUDA repository for access to NVIDIA’s latest offerings.

sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/fedora41/x86_64/cuda-fedora41.repo
sudo dnf clean expire-cache

Step 3: Choose Kernel Module Flavor
You may select between open and proprietary kernel modules depending on your GPU architecture:

For Open Module:

sudo dnf install nvidia-open

For Proprietary Module:

sudo dnf install cuda-drivers

Step 4: Reboot
Restart your system for the driver installation to take effect.

sudo reboot

Switching Modules: You can switch module types using the --allowerasing flag if needed.

READ 👉  How to Secure Your Files/Folders with ‘TrueCrypt Encryption’ Tool in Linux

Step 5: Secure Boot for Official Repository Users
Follow the prompts during the installation to enroll your MOK keys for Secure Boot compatibility.

Step 6: Verification
Confirm proper installation with:

1nvidia-smi

And check dmesg or journalctl -k for loading errors if issues occur.

Manually Install NVIDIA Drivers from Nvidia.com (.run Package) (Not Recommended)

This method is not endorsed as it can lead to conflicts with system updates. Attempt this approach only if you require specific configurations and are comfortable with potential troubleshooting.

Step 1: Download the Driver
Obtain the correct NVIDIA driver for your GPU from the official site.

Step 2: Make the Installer Executable
Change the permissions:

chmod +x NVIDIA-Linux-x86_64-*.run

Step 3: Install Required Build Tools
Set up necessary tools for building modules:

sudo dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

Step 4: Disable Nouveau Driver
Blacklist Nouveau and update the kernel initramfs:

echo -e "blacklist nouveau\noptions nouveau modeset=0" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
sudo dracut --force

Step 5: Switch to Multi-User Mode
To avoid conflicts, switch to a non-graphical environment:

sudo systemctl set-default multi-user.target
sudo reboot

Step 6: Run the Installer
Log in and execute:

sudo ./NVIDIA-Linux-x86_64-*.run

Accept all necessary dependencies and configurations as prompted.

Step 7: Restore Graphical Mode
After installation, revert to graphical target:

sudo systemctl set-default graphical.target
sudo reboot

Manual installations may face issues with future kernel updates. If problems arise, consider reverting to RPM Fusion or official repository installations.

Troubleshooting and Maintenance Tips

Once the NVIDIA driver is installed, pay close attention to system updates, especially kernel upgrades that necessitate NVIDIA kernel module rebuilding. If you encounter a black screen or fall back to the Nouveau driver, check if your kernel headers are installed correctly, and manually trigger a rebuild:

sudo akmods --force
sudo dracut --force
sudo reboot

For systems with Secure Boot, maintain your MOK key’s validity across major changes, particularly when reinstalling operating systems.

READ 👉  How to Fix Machine Check Exception Blue Screen Error on Windows 11 (Step-by-Step)

To uninstall NVIDIA drivers installed via RPM Fusion:

sudo dnf remove akmod-nvidia xorg-x11-drv-nvidia\*

This command will revert your system to the open-source Nouveau driver, ensuring a smooth transition back if necessary.

Conclusion

Installing NVIDIA drivers on Fedora can significantly enhance your system’s graphics processing capabilities. By following this detailed guide, you can confidently configure your system whether you choose the recommended RPM Fusion method, the official NVIDIA repository, or the more advanced manual installation. Ensure to monitor updates actively to maintain driver functionality and performance.

By optimizing your installation process, you’re not only setting your system up for optimal performance but also ensuring a seamless user experience with lower susceptibility to conflicts and errors.

Did you enjoy this article? Feel free to share it on social media and subscribe to our newsletter so you never miss a post!

And if you'd like to go a step further in supporting us, you can treat us to a virtual coffee ☕️. Thank you for your support ❤️!
Buy Me a Coffee

Categorized in: