Fedora Hardware

How to Install NVIDIA GPU Driver on Fedora 40+ KDE 6 Spin on Wayland

Installing the NVIDIA GPU driver is the first thing you will want to do after installing Fedora 40 on your computer. Fedora 40 comes with different spins (desktop environments) and the latest software. Wayland display server (which will replace the X11/Xorg display server completely one day) is the default on some of the Fedora 40 spins. One of the most awaited Fedora 40 spin is the KDE spin. Fedora 40 KDE spin comes with the KDE Plasma 6 desktop environment which supports only the Wayland display server. As the traditional X display server is gone, getting the NVIDIA GPU driver to work on Wayland might be a little bit tricky.

In this article, I will show you how to install the latest version of the NVIDIA GPU driver on Fedora 40 KDE 6 Spin on Wayland display server. This article should work without any changes on other Fedora 40 spins that replaced the X display server with Wayland display server.

 

 

Table of Contents

  1. Checking the UEFI Secure Boot Status
  2. Checking if an NVIDIA GPU is Available on Your System
  3. Downloading the NVIDIA Drivers for Fedora Linux
  4. Updating the Fedora 40 System Packages
  5. Installing Required Libraries and Tools for Building NVIDIA Kernel Modules
  6. Blacklisting Nouveau Drivers on Fedora 40
  7. Switching to Text-Based User Interface on Fedora 40
  8. Installing NVIDIA GPU Driver on Fedora 40
  9. Switching Back to Graphical Desktop Environment on Fedora 40
  10. Checking if NVIDIA Driver is Working on Fedora 40
  11. Solution to nvidia-installer was forced to guess the X library path and X module path
  12. Conclusion

 

Checking the UEFI Secure Boot Status

To get the NVIDIA GPU driver to work on UEFI secure boot enabled systems, you will have to sign the NVIDIA kernel modules manually, which is a bit complex. Without signed NVIDIA kernel modules, the NVIDIA GPU driver won’t work even if you’ve done all the installation steps correctly.

In this article, I assume you’re trying to install the NVIDIA GPU driver on a system with UEFI secure boot disabled. If you have UEFI secure boot enabled on your system, make sure to disable it from the BIOS/UEFI firmware of your computer for the NVIDIA GPU driver to work.

You can check the UEFI secure boot status from Fedora 40 with the following command:

$ mokutil --sb-state

 

As you can see, UEFI Secure Boot is disabled on my Fedora 40 system.

Checking if an NVIDIA GPU is Available on Your System

To check if an NVIDIA GPU is installed on your Fedora 40 system, run the following command:

$ lspci | egrep -i 'VGA|3D'

 

As you can see, I have an NVIDIA GeForce RTX 4070 GPU installed on my computer. You will most likely have a different GPU installed on your computer. So, you will see a different output.

 

Downloading the NVIDIA Drivers for Fedora Linux

The official NVIDIA driver is not included in the official package repository of Fedora 40. So, you will have to download the NVIDIA driver from the official NVIDIA website.

Once the NVIDIA drivers download page loads on your web browser, select your NVIDIA GPU from the Product Type, Product Series, and Product dropdown menu respectively[1], select Linux 64-bit from the Operating System dropdown menu[2], select Production Branch from the Download Type dropdown menu[3], and click on Search[4].

Click on Download.

Click on Agree & Download.

Your web browser should start downloading the NVIDIA GPU driver installer file. It will take a while to complete.

At this point, the NVIDIA GPU driver installer file should be downloaded.

Once the NVIDIA GPU driver installer file is downloaded, you will find it in the ~/Downloads directory of your Fedora 40 system.

$ ls -lh ~/Downloads

 

Updating the Fedora 40 System Packages

Before attempting to install the NVIDIA GPU driver on your Fedora 40 system, it’s a good idea to update all the installed packages of your Fedora 40 system.

First, update the Fedora 40 package database cache:

$ sudo dnf makecache

To update all the installed Fedora 40 packages, run the following command:

$ sudo dnf update

 

To confirm the update operation, press Y and then press <Enter>.

 

All the updates are being downloaded and installed on the Fedora 40 system. It will take a while to complete.

 

At this point, all the updates should be installed on your Fedora 40 system.

 

For the changes to take effect, reboot your Fedora 40 system with the following command:

$ sudo reboot

 

 

Installing Required Libraries and Tools for Building NVIDIA Kernel Modules

To install all the required libraries and tools for building the NVIDIA kernel modules, run the following command:

$ sudo dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx
libglvnd-opengl libglvnd-devel libxcb egl-wayland pkgconf-pkg-config xorg-x11-server-Xwayland xorg-x11-server-Xwayland-devel xorg-x11-server-Xorg xorg-x11-server-devel

 

To confirm the installation, press Y and then press <Enter>.

 

All the required packages are being downloaded and installed. It will take a while to complete.

 

At this point, all the required packages should be installed.

 

 

Blacklisting Nouveau Drivers on Fedora 40

If you have an NVIDIA GPU installed on your Fedora 40 system, it’s very likely that you will have the open-source Nouveau driver installed and enabled by default. But for the official NVIDIA driver to work, you must blacklist/disable the Nouveau driver on Fedora 40.

You can verify whether the Nouveau driver is enabled on your Fedora system with the following command:

$ lsmod | grep nouveau

 

If the Nouveau driver is enabled, you will see that the nouveau kernel modules are loaded on your Fedora system.

 

To blacklist the Nouveau driver on Fedora 40 system, create a new file blacklist-nouveau.conf in the /etc/modprobe.d/ directory and open it with the nano text editor as follows:

$ sudo nano /etc/modprobe.d/blacklist-nouveau.conf

 

Type in the following lines in the blacklist-nouveau.conf file.

blacklist nouveau
options nouveau modeset=0

 

Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the blacklist-nouveau.conf file.

 

Open the GRUB bootloader configuration file with the nano text editor as follows:

$ sudo nano /etc/default/grub

 

Blacklist the Nouveau driver using the kernel boot parameter rd.driver.blacklist=nouveau and force the official NVIDIA driver to load (once installed) using the kernel boot parameter nvidia-drm.modeset=1.

Once you’ve added the required kernel boot parameters on GRUB_CMDLINE_LINUX environment variable in the /etc/default/grub file, press <Ctrl> + X followed by Y and <Enter> to save the file.

 

Update the initramfs of your Fedora 40 system with the following command:

$ sudo dracut --force

 

Also, update the GRUB bootloader of your Fedora 40 system with the following command:

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

 

 

Switching to Text-Based User Interface on Fedora 40

You must install the official NVIDIA GPU driver on Fedora 40 from the text-based user interface.

To enable the text-based user interface on Fedora 40, run the following command:

$ sudo systemctl set-default multi-user.target

 

For the changes to take effect, reboot your Fedora 40 system:

$ sudo reboot

 

You will see a text-based user interface on your Fedora 40 system instead of the graphical desktop environment on the next boot.
Use your login username and password to log in to the text-based UI of your Fedora 40 system.

 

 

Installing NVIDIA GPU Driver on Fedora 40

The downloaded NVIDIA GPU driver installer file NVIDIA-Linux-x86_64-550.78.run should be in the ~/Downloads directory of your Fedora 40 system. Before running the NVIDIA GPU driver installer file, you must make it executable.

You can make the NVIDIA GPU driver installer file executable with the following command:

$ chmod +x NVIDIA-Linux-x86_64-550.78.run

 

You can run the NVIDIA GPU driver installer file NVIDIA-Linux-x86_64-550.78.run as follows:

$ sudo ./NVIDIA-Linux-x86_64-550.78.run

 

The NVIDIA GPU driver installer should start building the NVIDIA kernel modules for Fedora 40. It will take a few seconds to complete.

 

Once you see the following prompt, select Yes and press <Enter> to install the NVIDIA GPU driver 32-bit compatibility libraries.

 

When you upgrade the kernel on your Fedora system, you may need to rebuild the NVIDIA kernel module. To allow this, select Yes and press <Enter> to register the NVIDIA kernel module sources with DKMS.

 

Select Rebuild initramfs and press <Enter>.

 

The initramfs of your Fedora 40 system is being rebuilt. It will take a few seconds to complete.

 

Select Yes and press <Enter> to allow nvidia-xconfig utility to automatically update the X server configuration files on your Fedora 40 system

 

The NVIDIA GPU driver installation should be complete. Press <Enter> to close the NVIDIA GPU driver installer.

 

Switching Back to Graphical Desktop Environment on Fedora 40

To switch from text-based user interface back to the default graphical desktop environment, run the following command:

$ sudo systemctl set-default graphical.target

 

For the changes to take effect, reboot your Fedora 40 system with the following command:

$ sudo reboot

 

 

Checking if NVIDIA Driver is Working on Fedora 40

Once your Fedora 40 system boots, you should see that the nvidia kernel modules are loaded. This is an indication that the NVIDIA GPU driver installation was successful.

$ lsmod | grep nvidia

 

If the NVIDIA GPU driver installation was successful, the nvidia-smi command will report information on the NVIDIA GPU you have installed on your Fedora 40 machine.

In my case, the nvidia-smi command reports the following information about my NVIDIA GeForce RTX 4070:

  • Installed NVIDIA driver version
  • The maximum CUDA version the currently installed NVIDIA GPU driver version supports
  • GPU power limit and used power (in Watt unit)
  • GPU temperature (in degree centigrade unit)
  • Processes utilizing the GPU and per process memory usage (in MiB unit)
  • Total available memory and total memory usage (in MiB unit), etc.
$ sudo nvidia-smi

 

If the NVIDIA GPU driver was installed correctly, the NVIDIA Settings app will also show relevant information on the NVIDIA GPU you have installed on your Fedora 40 machine.

 

As you can see, my NVIDIA GeForce RTX 4070 GPU is working just fine on Fedora 40 KDE Plasma 6 desktop environment on Wayland display server.

 

 

Solution to nvidia-installer was forced to guess the X library path and X module path

If you see one of the following errors/warnings while installing the NVIDIA GPU driver on your Fedora 40 system, it means that the required X server development libraries are missing on your system.

  • WARNING: nvidia-instalelr was force to guess the X library path ‘/usr/lib64’ and X module path ‘/usr/lib64/xorg/modules’: these paths were not queryable from this system. If X fails to find the NVIDIA X driver module, please install the ‘pkg-config’ utility and the X.org SDK/development package for your distribution and reinstall the driver.

  • WARNING: You appear to be using a modular X.Org release, but the X module installation path, ‘/usr/lib64/xorg/modules’, reported by ‘/usr/bin/pkg-config –variable=moduledir xorg-server’ does not exist. Please check your X.Org installation.

At times the NVIDIA GPU driver will work just fine without the X server development libraries, at times it won’t.
In this article, I have included the X server development packages and the pkg-config utility in the installation of the required libraries and tools for building NVIDIA kernel modules section. So, you probably did not run into those errors/warnings. But if you have encountered those errors/warnings and you’re looking for a solution, then just install the required X development libraries on your Fedora 40 system with the commands below and try to reinstall the NVIDIA GPU drivers.

$ sudo dnf makecache
$ sudo dnf install pkgconf-pkg-config xorg-x11-server-Xwayland-devel xorg-x11-server-Xorg xorg-x11-server-devel

 

 

Conclusion

In this article, I have demonstrated the methods of installing the official NVIDIA GPU drivers on Fedora 40 KDE Plasma 6 desktop environment running on the Wayland display server. The same procedures should work on any Fedora desktop environment running on the Wayland display server. With a little tweak, you should also be able to get the NVIDIA GPU driver installed and working on Fedora 40 desktop environments/spins that still haven’t switched to Wayland.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.