How To Install NVIDIA Drivers on Fedora 42
Installing NVIDIA drivers on Fedora 42 can significantly enhance your system’s graphics performance, enabling smoother gaming experiences, efficient computational tasks, and better support for graphics-intensive applications. While Fedora ships with the open-source Nouveau drivers by default, they often lack the performance and features of NVIDIA’s proprietary drivers. This comprehensive guide walks you through multiple methods to install NVIDIA drivers on Fedora 42, ensuring you get the best possible performance from your graphics hardware.
Prerequisites and System Preparation
Before diving into the installation process, it’s essential to verify your hardware and prepare your system properly. This preparation ensures a smooth installation experience and prevents potential issues.
Checking Your NVIDIA GPU Model
First, confirm that you have an NVIDIA GPU installed on your system by running the following terminal command:
lspci | grep -Ei 'VGA|3D'
This command displays all graphics and 3D acceleration devices connected to your system. The output should include a line mentioning NVIDIA, similar to this:
00:02.0 VGA compatible controller: Intel Corporation TigerLake-H GT1 [UHD Graphics] (rev 01)
01:00.0 VGA compatible controller: NVIDIA Corporation GA104M [GeForce RTX 3070 Mobile / Max-Q] (rev a1)
If you see an NVIDIA entry, note the exact model as it helps determine which driver version you need.
Update Your System
For optimal compatibility, ensure your Fedora 42 system is fully updated before proceeding:
sudo dnf update --refresh
This command updates all existing packages to their latest versions, which is crucial for driver compatibility and system stability. After updating, reboot your system to ensure all changes take effect:
sudo reboot
Check Secure Boot Status
NVIDIA drivers may have issues with Secure Boot enabled. Check your current Secure Boot status using:
mokutil --sb-state
If Secure Boot is enabled, you might need to either disable it in your BIOS/UEFI settings or sign the NVIDIA modules yourself. For most users, temporarily disabling Secure Boot is the simpler option.
Install Required Dependencies
Install the necessary development tools and kernel headers that will be needed for the driver installation:
sudo dnf install kernel-devel-matched kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig
These packages provide the essential tools for compiling and installing the NVIDIA kernel modules.
Method 1: Installing NVIDIA Drivers Using RPM Fusion
The RPM Fusion repository offers the simplest and most reliable method for installing NVIDIA drivers on Fedora 42. This method is recommended for most users due to its simplicity and integration with Fedora’s package management system.
Setting Up RPM Fusion Repositories
First, you need to enable the RPM Fusion repositories, which contain the NVIDIA driver packages not included in Fedora’s official repositories:
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-42.noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-42.noarch.rpm
For users who prefer to use Fedora’s workstation repositories:
sudo dnf install fedora-workstation-repositories
sudo dnf config-manager --set-enabled rpmfusion-nonfree-nvidia-driver
After enabling these repositories, update your package list:
sudo dnf update
Installing Drivers Through DNF
With the repositories set up, you can now install the appropriate NVIDIA drivers using dnf. For most modern GPUs (manufactured after 2014), use:
sudo dnf install akmod-nvidia
For CUDA support, which is essential for computational tasks and some encoding/decoding operations, add:
sudo dnf install xorg-x11-drv-nvidia-cuda
If you need 32-bit compatibility for certain applications or games:
sudo dnf install xorg-x11-drv-nvidia-libs.i686
After installation, wait about 5 minutes for the kernel modules to build before rebooting. You can verify the module building process with:
modinfo -F version nvidia
When the process completes successfully, this command should display the driver version instead of an error message.
Post-Installation Setup
After the driver installation completes, reboot your system to load the new drivers:
sudo reboot
To enable NVIDIA’s power management services and ensure proper system suspend/resume functionality, enable the necessary systemd services:
sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service
These services help manage your GPU’s power states during sleep, hibernate, and resume operations.
Method 2: Manual Installation Using Official NVIDIA Runfile
For those who need specific driver versions or prefer direct installation from NVIDIA, the manual installation method using NVIDIA’s official runfile installer provides more control.
Downloading the Appropriate Driver
Visit the NVIDIA Driver Downloads page and select your GPU model, operating system (Linux 64-bit), and series. Download the .run file for your specific GPU.
Alternatively, use wget to download directly from the terminal. For example:
wget https://us.download.nvidia.com/XFree86/Linux-x86_64/570.133.07/NVIDIA-Linux-x86_64-570.133.07.run
Make the downloaded installer executable:
chmod +x NVIDIA-Linux-x86_64-*.run
Disabling Nouveau Drivers
Before installing NVIDIA’s proprietary drivers, you must disable the default open-source Nouveau drivers that come with Fedora. Create a blacklist configuration file:
sudo nano /etc/modprobe.d/blacklist.conf
Add the following lines to blacklist Nouveau:
blacklist nouveau
options nouveau modeset=0
Create another configuration file for NVIDIA:
sudo nano /etc/modprobe.d/nvidia.conf
Add these lines:
options nvidia-drm modeset=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1
The first line enables kernel mode setting for better Wayland support, while the second helps with suspend and resume functions.
Update the GRUB configuration:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Backup and regenerate your initramfs:
sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
sudo dracut /boot/initramfs-$(uname -r).img $(uname -r)
Switching to Multi-User Mode and Installing Drivers
Reboot into runlevel 3 (text mode without graphical interface):
sudo systemctl set-default multi-user.target
sudo reboot
After rebooting, log in with your username and password. Run the NVIDIA installer:
sudo ./NVIDIA-Linux-x86_64-*.run
During the installation:
- Accept the license agreement
- Choose “Yes” for installing NVIDIA’s 32-bit compatibility libraries
- When asked about registering the kernel module with DKMS, select “Yes”
- Allow the installer to create an xorg.conf file if prompted
After installation completes, return to graphical mode:
sudo systemctl set-default graphical.target
sudo reboot
Method 3: Software Center Installation
For users who prefer a graphical approach, Fedora’s Software Center offers a simple method to install NVIDIA drivers.
- Open the Software Center application
- Click on the menu and select “Software Repositories”
- Enable the “RPM Fusion for Fedora 42 – Nonfree” repository
- Search for “NVIDIA” in the Software Center
- Select and install the appropriate driver for your GPU
While this method is the most user-friendly, it offers less control over the installation process and may not provide access to the latest driver versions.
Enabling Wayland Support with NVIDIA
Wayland is the default display server protocol in Fedora 42, but it hasn’t always played nicely with NVIDIA drivers. Recent versions of NVIDIA drivers have improved Wayland support significantly.
To enable Wayland with NVIDIA drivers, ensure you have the following configuration in /etc/modprobe.d/nvidia.conf
:
options nvidia-drm modeset=1
This enables kernel mode setting, which is required for Wayland support.
To check if you’re running Wayland or X11, use:
echo $XDG_SESSION_TYPE
To force GDM to use Wayland with NVIDIA, edit /etc/gdm/custom.conf
and make sure the WaylandEnable
line is commented out or set to true:
#WaylandEnable=false
For KDE Plasma users, you can select Wayland from the session type menu at the login screen after installing NVIDIA drivers.
Post-Installation Verification and Optimizations
After installing the NVIDIA drivers, it’s important to verify the installation and configure optimizations for better performance.
Verifying Successful Installation
To confirm that the NVIDIA drivers are properly installed and functioning, use the nvidia-smi
command:
nvidia-smi
This should display information about your GPU, driver version, and current utilization. You should also be able to open the NVIDIA Settings application:
nvidia-settings
This graphical tool allows you to configure various aspects of your GPU, including performance settings, display configurations, and thermal controls.
Performance Optimizations
NVIDIA drivers offer several performance profiles that can be adjusted based on your needs:
sudo nvidia-smi --gpu-reset
sudo nvidia-smi -pm 1 # Enable persistent mode
For gaming or high-performance computing, you can set the performance level to maximum:
sudo nvidia-smi -ac 3505,1177 # Example values; adjust for your GPU
For better power efficiency during regular use:
sudo nvidia-smi --power-limit=150 # Adjust wattage to your GPU specs
Troubleshooting Common Issues
Even with careful installation, you might encounter some issues with NVIDIA drivers on Fedora 42. Here are solutions to common problems:
Black Screen After Installation
If you encounter a black screen after installing drivers:
- Boot into recovery mode by pressing ESC during boot to access the GRUB menu
- Select an older kernel or recovery option
- When in command line, switch to a different TTY using
Ctrl+Alt+F2
- Login and reinstall the drivers or restore your backup configuration:
sudo mv /boot/initramfs-$(uname -r).img.bak /boot/initramfs-$(uname -r).img
sudo dracut -f
Login Loop Problems
If you’re stuck in a login loop:
- Press
Ctrl+Alt+F3
to access a terminal - Login with your credentials
- Check the X server logs:
sudo cat /var/log/Xorg.0.log | grep EE
- If NVIDIA modules are missing, rebuild them:
sudo akmods --force
sudo dracut --force
Kernel Updates Breaking NVIDIA Drivers
When updating the kernel, your NVIDIA drivers might need rebuilding. For RPM Fusion-installed drivers, this usually happens automatically with akmods, but you can force it:
sudo akmods --force
sudo dracut --force
For manually installed drivers, you may need to reinstall them after kernel updates.
Comparing Installation Methods
Each installation method has its advantages and considerations:
RPM Fusion Method:
- Pros: Simple, integrates with package management, automatic updates
- Cons: May not have the absolute latest drivers, less control over installation options
Manual Installation:
- Pros: Latest drivers directly from NVIDIA, complete control over installation options
- Cons: More complex, requires manual updates, may break with kernel updates
Software Center:
- Pros: Extremely simple, graphical interface
- Cons: Limited options, less control, potential dependency issues
For most users, the RPM Fusion method provides the best balance of simplicity and functionality. It ensures your drivers stay updated with your system and handles most of the complex configuration automatically.
Congratulations! You have successfully installed NVIDIA Driver. Thanks for using this tutorial for installing the NVIDIA Drivers on your Fedora 42 Linux system. For additional help or useful information, we recommend you check the official NVIDIA website.