In this article, we will show you how to install the official NVIDIA drivers on Linux Mint 21.
Table of Contents:
- Why Use the Official NVIDIA Drivers Instead of Nouveau Drivers?
- Check Whether You Have the NVIDIA GPU Installed on Your Computer
- Check the GPU Drivers That Are Currently Used on Linux Mint
- Install the Official NVIDIA Drivers on Linux Mint via the Graphical User Interface
- Install the Official NVIDIA Drivers on Linux Mint from the Command Line
- Check If the Official NVIDIA Drivers Are Installed Correctly on Linux Mint
- Switch Back to the Open Source Nouveau Drivers on Linux Mint
- Uninstall the NVIDIA Drivers from Linux Mint 21
- Conclusion
- References
Why Use the Official NVIDIA Drivers Instead of Nouveau Drivers?
There are two types of NVIDIA Drivers for Linux operating systems out there:
1. Open-Source Nouveau Drivers: At the time of this writing, the open-source Nouveau drivers support only the basic graphics features like 2D/3D accelerations, video decoding accelerations, and so on. It does not support many of the advanced features that the NVIDIA GPUs are capable of. For example, the open-source Nouveau drivers have no CUDA support. So, if you want to run the AI (Artificial Intelligence) codes on your NVIDIA GPUs, there are no currently other options than using the official NVIDIA drivers on Linux.
2. Official NVIDIA Drivers: The official NVIDIA drivers support all the features of the NVIDIA GPUs (including CUDA for AI projects). The official NVIDIA drivers are faster and perform better than the open-source Nouveau drivers on Linux at the time of this writing. So, the official NVIDIA drivers are preferred if you own an NVIDIA GPU.
Check Whether You Have the NVIDIA GPU Installed on Your Computer
You can check whether your computer has an NVIDIA GPU installed from the command line.
First, open a Terminal app on Linux Mint from the Application menu or press <Ctrl> + <Alt> + T.
To check the GPU hardware that you installed on your computer, run the following command:
As you can see, we have an NVIDIA GeForce GTX 1050 Ti GPU installed on my computer. You will most likely have a different NVIDIA GPU installed on your computer.
Check the GPU Drivers That Are Currently Used on Linux Mint
You can check whether Linux Mint is using the open-source Nouveau drivers or the official NVIDIA drivers from the command line.
First, open a Terminal app on Linux Mint from the Application menu or press <Ctrl> + <Alt> + T.
To check whether you’re using the official NVIDIA drivers, run the following command:
To check whether you’re using the open-source Nouveau drivers, run the following command:
By default, Linux Mint 21 uses the open-source Nouveau drivers, not the official NVIDIA drivers as you can see from the output of the previous commands.
Install the Official NVIDIA Drivers on Linux Mint via the Graphical User Interface
You can use the Driver Manager app on Linux Mint 21 to graphically install the official NVIDIA drivers on Linux Mint.
You can open the Driver Manager app on Linux Mint from the Application Menu as you can see in the following screenshot.
As you can see, the open-source Nouveau drivers are used by default on Linux Mint 21.
To install and use the latest version of the official NVIDIA drivers on Linux Mint 21, select the latest version of the nvidia-driver package from the list[1] and click on Apply Changes[2].
At the time of this writing, the nvidia-driver-525 is the latest version of the official NVIDIA drivers that you can install on Linux Mint 21. You can see that this version of official NVIDIA drivers is marked as recommended.
To confirm the installation, type in your login password[1] and click on Authenticate[2].
The official NVIDIA drivers and the required dependency packages are being downloaded. It takes a while to complete.
The official NVIDIA drivers and the required dependency packages are being installed. It takes a while to complete.
At this point, the official NVIDIA drivers should be installed.
For the changes to take effect, click on Restart… to restart your computer/laptop.
Install the Official NVIDIA Drivers on Linux Mint from the Command Line
You can also install the latest version of the official NVIDIA drivers on Linux Mint 21 from the command line.
First, open a Terminal on Linux Mint from the Application menu or press <Ctrl> + <Alt> + T.
Update the APT package repository cache with the following command:
To figure out the versions of the official NVIDIA drivers available for Linux Mint 21, type in the following command and press <Tab> a few times.
A list of all the available official NVIDIA driver versions should be displayed. At the time of this writing, the official NVIDIA driver version 525 (nvidia-driver-525 package) is the latest as marked in the following screenshot:
To install the latest version of the official NVIDIA drivers on Linux Mint 21 from the command line, run the following command:
To confirm the installation, press Y and then press <Enter>.
The official NVIDIA drivers and the required dependency packages are being downloaded from the internet. It takes a while to complete.
The official NVIDIA drivers and the required dependency packages are being installed. It takes a while to complete.
At this point, the NVIDIA drivers should be installed.
For the changes to take effect, restart your computer/laptop with the following command:
Check If the Official NVIDIA Drivers Are Installed Correctly on Linux Mint
There are a few ways to verify whether the official NVIDIA drivers are working on Linux Mint 21. In this section, we will show you three of the most common methods.
The first method is to check whether the nvidia kernel modules are loaded instead of the nouveau kernel modules.
To check whether the nvidia kernel modules are loaded instead of the nouveau kernel modules, run the following commands:
$ lsmod | grep nvidia
You should see that the nvidia kernel modules are loaded instead of the nouveau kernel modules as shown in the following screenshot. This means that the official NVIDIA drivers are working just fine on Linux Mint 21.
The second method is to see whether the NVIDIA X Server Settings app is available and runs correctly.
You can search for the NVIDIA X Server Settings app in the Application Menu of Linux Mint 21. As you can see in the following screenshot, the NVIDIA X Server Settings app is available. Click to open it.
As you can see, the NVIDIA X Server Settings app is running just fine and it shows up all the information about our NVIDIA GPU correctly. So, the official NVIDIA drivers are working just fine on Linux Mint 21.
The third method is to run the nvidia-smi command from the command line and see if it prints the usage information about your NVIDIA GPU. If the official NVIDIA drivers are working, the command should print the NVIDIA GPU usage information correctly.
You can run the nvidia-smi command from the command line of Linux Mint 21 as follows:
As you can see, the nvidia-smi command prints the NVIDIA GPU usage information correctly. So, the official NVIDIA drivers are working just fine.
Switch Back to the Open Source Nouveau Drivers on Linux Mint
If you installed Linux Mint 21 on a laptop with multiple GPUs, an integrated GPU (i.e. Intel/AMD iGPU) and a discrete NVIDIA GPU (i.e. NVIDIA 1050Ti dGPU), the official NVIDIA drivers may cause problems for you. In that case, you may want to switch back to the open-source Nouveau drivers. It’s pretty easy to do.
First, open the Driver Manager app from the Application Menu of Linux Mint 21.
As you can see, the official NVIDIA drivers are being used.
To switch to the open-source Nouveu drivers, select the xserver-xorg-video-nouveau (open-source) from the bottom of the Driver Manager app[1] and click on Apply Changes[2].
To confirm the switch, type in your login password[1] and click on Authenticate[2].
The official NVIDIA drivers are being removed from Linux Mint 21 and are being replaced by the open-source Nouveau drivers. It takes a few seconds to complete.
At this point, the switch to the open-source Nouveau drivers should be successful.
For the changes to take effect, click on Apply Changes. Your computer/laptop will reboot.
Once your computer/laptop boots, you should see that the nouveau kernel modules are loaded instead of the nvidia kernel modules. You successfully switched to the open-source nouveau drivers.
Uninstall the NVIDIA Drivers from Linux Mint 21
If, for some reason, the official NVIDIA drivers are causing problems for you (i.e. shows black screen), try to uninstall them completely. Then, clean install it and see if it works.
To see how to completely uninstall the official NVIDIA drivers and prepare the Linux Mint 21 to clean install the official NVIDIA drivers, read the article on How to Clean Install the NVIDIA Drivers on Linux Mint 21.
Once you uninstalled the official NVIDIA drivers completely, you can install the official NVIDIA drivers on Linux Mint using the Driver Manager app graphically or from the command line
Conclusion
We showed you how to check whether you have the NVIDIA GPU installed on your computer/laptop from Linux Mint 21 operating system. We also showed you how to install the official NVIDIA drivers on Linux Mint 21 using the Driver Manager app graphically and from the terminal or command line. We also showed you the three methods of checking if the official NVIDIA drivers are working correctly on Linux Mint 21 as well. Finally, we showed you how to switch back to the open-source Nouveau drivers if the official NVIDIA drivers are causing you any problems.