Install Nvidia drivers on Debian [and Ubuntu]

Published on

Many Linux enthusiasts use Debian Linux system with high-end hardware specs and find Nvidia drivers difficult to install; the main reason behind this difficulty is that Nvidia is not open-source so no support for it, thus it needs to done manually most of the time.

This is the main reason why Linux users are tended to buy AMD GPU in the first place. But we are not going to buy new GPU, or not suggesting buying a new one for this, instead I’ll show you how to install NVIDIA driver on Debian and Debian-based distros.

Nvidia

Note: This article will also work on Debian-based Linux systems like Ubuntu and others.

Before we install anything, make sure everything is up-to-date.

sudo apt update

Now we need to install small self hardware check software that will tell you what exact drivers you’ll need for Linux system. Skip this step if you do not wish to test the system and want to install drivers directly. But test this once for safety.

sudo apt install nvidia-detect

Now run the following command and see it’s output. Skip this step too if you do not want to test and didn’t install nvidia-detect before.

sudo nvidia-detect

It will tell you what drivers you’ll need based on hardware.

It was suggesting me to install nvidia-driver as I have Nvidia GTX 1060 in my computer system. So I’ll install what it is suggesting me in my setup.

If you are on a server, then it may suggest some different.

Now all you need to do is install that and wait for it to finish. Since the Nvidia driver is large, it may take few seconds to minutes based on your internet speed.

sudo apt install nvidia-driver

While Nvidia driver is being installed you may be prompted for a note that nouveau will be blacklisted or disabled and something like that, that will be fixed with simple restart when installation is finished. Let it blacklist and disable that.

Reboot the system once installation done, and it will apply the Nvidia driver in action.

Keep in mind that Nvidia has not given any driver support to Linux kernel development so new kernel update may brick your installation so it is better idea to lock your kernel to existing one, or remove Nvidia driver all together before doing kernel update.

To hold your kernel version from updating itself, first identify what version of kernel is installed. Simply, run the following command and know the version:

uname -r

The output would be like this:

6.xx.x-xx-generic

As you know the version now, hold it from being updated.

sudo apt-mark hold 6.xx.x-xx-generic

It will hold a few headers and images that run the system, and now you can relax.

But you should update the system when new drivers are there as using too old kernel not suggested for long run. However, if you have basic home computer, then be worry free for 6–12 months. Later, try to update.

What if I updated the system accidentally and getting errors now!

The solution is very simple, just turn off the system and turn it on, as soon as you see GRUB menu load the older kernel which was fine and then remove the newer kernel.

If you missed locking the kernel, do it now, otherwise update will keep causing issues.

Leave a Reply

Your email address will not be published. Required fields are marked *