How to Install NVIDIA Drivers on Linux Mint 21 or 20


Linux Mint users may want to install the official Nvidia drivers if they use a Linux system for graphical design or gaming to gain more out of their current Graphics card, especially for those with impressive hardware. The following tutorial will teach you how to install NVIDIA Graphic Drivers on Linux Mint 21 or 20 with multiple methods available. Hopefully, you can install and keep these drivers up-to-date on your Linux Mint desktop.

Update Linux Mint

Before proceeding with the tutorial, it is highly advised to run an update in your terminal to ensure all packages are up-to-date to avoid any conflicts during the installation. This is important when installing packages such as new kernels and graphic card drivers, especially.

Before proceeding with the tutorial, ensuring your system is up-to-date with all existing packages is good.

sudo apt update

Optionally, you can list the updates for users who require review or are curious.

sudo apt --list upgradable

Proceed to upgrade any outdated packages using the following command.

sudo apt upgrade

Previous Nvidia Installations

Please note installing Nvidia drivers over the standard packages can result in unexpected issues, especially if you install the Nvidia drivers from the default repository, then import the Nvidia Cuda repository and try to re-install or upgrade directly over those packages. If you use one method, stick to it, and if you want to swap, ensure you remove the previous installation to avoid conflicts.

Below I will briefly go through some options for removing the previous Nvidia Drivers.

First, use a blanket command to remove any traces of Nvidia installation on your system.

sudo apt autoremove nvidia* --purge

The second method is for anyone that installed the Nvidia drivers using the “.run” file, a method I use suggest as an installation method but is shared amongst other Linux blogs. Given the alternatives using the Nvidia Cuda repository, I recommend using this over runfile installations.

See also
How to Install Nvidia Drivers on Debian Linux 11 or 10

To remove the runfile type of installation, use the following command.

sudo /usr/bin/nvidia-uninstall

Lastly, remove the CUDA toolkit runfile installation using the following command.

sudo /usr/local/cuda-X.Y/bin/cuda-uninstall

These few methods may remove the Nvidia Drivers.

Determine your Graphics Card

The next step for users with aging NVIDIA Graphics cards is to determine what it is and if it is supported, users with brand new cards can skip this part as there is no doubt they will be supported.

First, find your graphics card module.

lspci | grep -e VGA

Example output:

03:00.0 VGA compatible controller: NVIDIA Corporation TU117 [GeForce GTX 1650] (rev a1)

If you are using an old card, I advise you to research it on the NVIDIA website; if the latest NVIDIA drivers still support it, you may need to install legacy drivers.

#1st Method: Install NVIDIA Drivers – Linux Mint Driver Manager (GUI)

The first option recommended for all Linux Mint users is to install the Nvidia drivers using the device manager, which installs, in most cases, the open-source version these days, along with some alternative options.

The GUI method should, in most cases, work the best on your system compatibility-wise.

This can be found in Taskbar > Administration > Driver Manager.

Example:

Once inside the driver manager, install the NVIDIA drivers with the prompts. This is perhaps one of the safest options.

Example:

Remember, you must reboot your system after installation of any NVIDIA drivers or removal.

reboot

The second method uses the command line terminal to install NVIDIA drivers from the well-known PPA maintained by the “Graphics Drivers” team. This PPA is known for having the most up-to-date NVIDIA proprietary drivers available. This is recommended for users wishing to update their cards regularly.

First, install the required dependencies.

sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https -y

For users who have not previously imported a GPG key from the Ubuntu keyserver, the command line terminal will often have issues importing GPG keys from LaunchPAD PPAs because the directories are not created. This is an easy fix. Use the following command that will, in turn, generate the directories.

sudo gpg --list-keys

Example output:

gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created

Now import the GPG from the keyserver. In the future, if the key changes, visit the PPA to grab a fresh fingerprint.

sudo gpg --no-default-keyring --keyring /usr/share/keyrings/graphic-drivers-ppa.gpg --keyserver keyserver.ubuntu.com --recv-keys 2388FF3BE10A76F638F80723FCAE110B1118213C

If you are having issues importing the GPG key, see the end of the article to troubleshoot GPG importing.

See also
How to Install Linux Kernel 6.1 on Linux Mint 21 or 20

Once the GPG key is imported, now import the PPA.

echo 'deb [signed-by=/usr/share/keyrings/graphic-drivers-ppa.gpg] https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu  jammy main' | sudo tee -a /etc/apt/sources.list.d/graphic-drivers-ppa.list
echo 'deb-src [signed-by=/usr/share/keyrings/graphic-drivers-ppa.gpg] https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu  jammy main' | sudo tee -a /etc/apt/sources.list.d/graphic-drivers-ppa.list

Ensure you import both repositories as above.

With the PPA now imported, run an APT update.

sudo apt update

Next, type in the terminal command to bring up recommendations on your graphics card.

ubuntu-drivers devices

Example output:

As you can see, we now have a third-party recommended driver, but technically you can install any of the above.

First, if you are happy with the recommended version, use this command:

sudo ubuntu-drivers autoinstall

Second, specify below if you want to install the driver package directly or choose another version.

Nvidia Drivers 525.x:

sudo apt install nvidia-driver-525

Nvidia Drivers 520.x:

sudo apt install nvidia-driver-520

Nvidia Drivers 515.x:

sudo apt install nvidia-driver-515

Nvidia Drivers 510.x:

sudo apt install nvidia-driver-510

Nvidia Drivers 470.x:

sudo apt install nvidia-driver-470

Nvidia Drivers 450.x:

sudo apt install nvidia-driver-450

Nvidia Drivers 390.x:

sudo apt install nvidia-driver-390

You will update several supporting packages with the new experimental/beta drivers.

Once done, reboot.

reboot

#3rd Method: Install Nvidia Drivers – Nvidia CUDA repository

The third and last method of installing Nvidia drivers is utilizing the Nvidia CUDA repository. This is frequently updated and has supported Debian, Ubuntu, RHEL, and the most popular Linux distributions. Given Linux Mint is based on Ubuntu, it can quite easily be installed and work just as well as it would on any Ubuntu system.

Importing Nvidia Repository

First, ensure you install the following packages, which may be already installed.

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https dkms curl -y

Next, import the GPG key, and ensure you match the import to your distribution version.

Import GPG key for Linux Mint 21 release:

curl -fSsL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | sudo gpg --dearmor | sudo tee /usr/share/keyrings/nvidia-drivers.gpg > /dev/null 2>&1

Import GPG key for Linux Mint 20 release:

curl -fSsL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub | sudo gpg --dearmor | sudo tee /usr/share/keyrings/nvidia-drivers.gpg > /dev/null 2>&1

Second, import the repository for your system, and again ensure you import the correct one to match your Linx Mint distribution version.

Import Nvidia Repository for Linux Mint 21 release:

echo 'deb [signed-by=/usr/share/keyrings/nvidia-drivers.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /' | sudo tee /etc/apt/sources.list.d/nvidia-drivers.list

Import Nvidia Repository for Linux Mint 20 release:

echo 'deb [signed-by=/usr/share/keyrings/nvidia-drivers.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /' | sudo tee /etc/apt/sources.list.d/nvidia-drivers.list

Install Nvidia Drivers – Proprietary or Opensource options

Update your sources list to reflect the newly added repository.

sudo apt update

Next, install the latest NVIDIA drivers. Most users should know the version they would prefer. You can also use the APT search command to bring up the complete list if you want to investigate what is available.

apt search nvidia-driver-*

The tutorial will demonstrate how to install the latest version currently available at this time. It should be pretty straightforward after presenting the following. All you would do is replace 525 with 520, 515, etc.

See also
How to Install Wine on Linux Mint 21 or 20

Install NVIDIA Drivers 525.xx Without Cuda Support (Proprietary):

sudo apt install nvidia-driver-525

Install NVIDIA Drivers 525.xx With Cuda Support (Proprietary):

sudo apt install nvidia-driver cuda

Install NVIDIA Drivers 525.xx Without Cuda Support (Opensource):

sudo apt install nvidia-driver-525-open

Install NVIDIA Drivers 525.xx With Cuda Support (Opensource):

sudo apt install nvidia-driver-525-open cuda

Confirm Nvidia Drivers are Installed

Now that you have your Nvidia Drivers installed and your system has been restarted, you can verify your installation; you can use the command line terminal with the “nvidia-smi” command.

nvidia-smi

Example output:

Alternatively, launch the NVIDIA settings GUI.

nvidia-settings

Or use the following path Taskbar > Administration > NVIDIA X Server Settings.

Example:

Once open, you can see your NVIDIA card configuration, information, and much more.

Example:

Comments

The tutorial taught you how to install NVIDIA Graphic Drivers on Linux Mint using the GUI, the LaunchPAD Graphics proprietary drivers PPA or the Nvidia CUDA repository. Overall, using the NVIDIA drivers can be more beneficial for performance. Still, if your system works fine and has an old card, often, even after installing these drivers, you will not see much difference compared to brand-new cards or ones created in the past several years.

2 thoughts on “How to Install NVIDIA Drivers on Linux Mint 21 or 20”

  1. Após corrigir a importação de GPG me aparece:
    As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY FCAE110B1118213C
    Lendo listas de pacotes… Pronto
    W: Erro GPG: https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease: As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY FCAE110B1118213C
    E: O repositório ‘https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease’ não está assinado.
    N: Atualizações a partir de tal repositório não podem ser feitas de forma segura e estão, portanto, desativadas por definição.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

    Reply
    • Olá,

      Parece que o GPG não foi importado, apenas a dupla verificação fez estas etapas.

      ### instalar estes pacotes

      sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https

      #### executar isto só no caso de####
      sudo gpg –list-keys

      ##importar a chave GPG###

      sudo gpg –no-default-keyring –keyring /usr/share/keyrings/graphic-drivers-ppa.gpg –keyserver keyserver.ubuntu.com –recv-keys 2388FF3BE10A76F638F80723FCAE110B1118213C

      Parece que algo foi importado de forma errada em torno da chave GPG. Por vezes, a cópia do website para o terminal pode ser quebrada, como espaços brancos extra no comando, etc.

      Reply

Leave a Comment

Index
Share to...