Install NVIDIA proprietary driver, replace nouveau using apt

By default, in Debian-based systems (Ubuntu, Mint, Debian) nouveau driver is installed. It is free and open-source, perfectly compatible with other open-source applications and exports a large amount of information in /sys. But in some applications, especially in video games, nouveau often has weak support and is inferior in performance to NVIDIA proprietary driver.

NVIDIA proprietary driver has better performance and provides more settings for a video card. But access to video card information (temperature, fan speed) requires special non-free NVIDIA applications, what I personally don’t like. CUDA technology is also available with the proprietary driver.

For example, we have nouveau installed, its module loads when system starts:

lsmod | grep nouveau
nouveau              2162688  4

And we want to install NVIDIA proprietary driver.

There are many driver packages in the repository:

Current NVIDIA proprietary driver for new and modern video cards
Legacy drivers for old video cards
Another legacy package

Which driver should we choose? There is nvidia-detect utility in the repository. This is a simple script, install it:

sudo apt install nvidia-detect

The following command will show a suitable package:

Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF119 [GeForce GT 610] [10de:104a] (rev a1)

Checking card:  NVIDIA Corporation GF119 [GeForce GT 610] (rev a1)
Your card is only supported up to the 390 legacy drivers series.
It is recommended to install the
 !!!!   nvidia-legacy-390xx-driver  !!!!

The utility showed that nvidia-legacy-390xx-driver package suits me.

Your result may vary depending on the video card model.

Remember the result, now we can remove the utility, it will not be required anymore:

sudo apt remove nvidia-detect

Use the package that nvidia-detect utility showed you. Install the driver without unnecessary things (minimal installing with –no-install-recommends option):

sudo apt install --no-install-recommends nvidia-legacy-390xx-driver       # Use the package name that nvidia-detect utility showed you

A warning message will appear if nouveau is installed and loaded in the system:

A warning message

At present time, apt is able to make configure on its own. We don’t need to modify xorg config and blacklist nouveau.

As recommended by the warning message, after the driver has been installed, reboot the system:

sudo reboot

After the reboot, we can check NVIDIA driver with the following command:

lsmod | grep nvidia
nvidia                  14409728  209 nvidia_modeset
nvidia_modeset     1048576  6   nvidia_drm
nvidia_drm                45056  1

Now we need some kind of utility to view information about the video card, here’s a graphic version:

nvidia-settings – graphic utility for managing video card

This utility has many packages, you need to choose the package that corresponds to your driver version (suggested by nvidia-detect utility):

nvidia-settings for nvidia-driver package (modern NVIDIA video cards)
nvidia-settings for nvidia-legacy-390xx-driver package (so, i should choose this one)
nvidia-settings for nvidia-legacy-340xx-driver package

This graphical utility can be installed by one of the following commands (depending on the driver version):

sudo apt install --no-install-recommends nvidia-settings                          # For nvidia-driver
sudo apt install --no-install-recommends nvidia-settings-legacy-390xx   # For nvidia-legacy-390xx-driver
sudo apt install --no-install-recommends nvidia-settings-legacy-340xx   # For nvidia-legacy-340xx-driver

The call is the same for all the driver versions:


There is also a terminal variant, the utility is called nvidia-smi:


This can be installed by one of the following commands:

sudo apt install --no-install-recommends nvidia-smi                           # For nvidia-driver
sudo apt install --no-install-recommends nvidia-legacy-390xx-smi    # For nvidia-legacy-390xx-driver
sudo apt install --no-install-recommends nvidia-legacy-340xx-smi    # For nvidia-legacy-340xx-driver

The call is the same for all the driver versions: