top of page

How to install NVIDIA driver in Debian

Many days ago, I'm bough a laptop of second hand that mistakenly i consider that it was worth reliving using Debian distro, but i to test commands in my main laptop that use Zorin OS, i will end destroying the distro, finally i decide reinstall Debian in my main laptop due that Zorin hide many configurations, avoid that i can take the control.


The most distros depend of Ubuntu and Ubuntu depends of Debian, therefore, Debian is more basic, is more "pure", more stable and grant more control that the rest of distros, it not distro easy to handle, ti lack of packages that #Ubuntu have, but not mean that it is imposible and the long term you will learn Linux deeply.



Preparing Debian for the installation.

The first requirement is installing the Synaptic packages installer, though is few intuitive this offers more information and more control that to use store applications.



The first pass that most know is if i have a GPU available, for this we install and execute neofetch.

sudo apt install neofetch

This will return a resume of the device configuration included the available GPU, though the GPU seems available, this not mean that work, we can install the driver but, may that never communicate with the GPU, this may to be because the driver is not adequate or because the GPU is physically broken.


To choose the adequate driver we most install a package called nvidia-detect, for to install we most include contrib and non-free PPA repositories in Debian.


For to aggregate these repos, we most run the software and updates and check the repos showed in the image.


$ nvidia-detect  
Detected NVIDIA GPUs: 07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1) 

Checking card:  NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1) Your card is supported by all driver versions. 
Your card is also supported by the Tesla 440 drivers series. 
Your card is also supported by the Tesla 418 drivers series. 
It is recommended to install the     
    nvidia-driver package.

Now you can install nvidia-detect using `sudo apt install nvidia-detect` command and run nvidia-detect. This must return one of four generic NVidia drivers with exact name. In my case is nvidia-legacy-390xx-driver, but in your case maybe to be different.


Drivers installation.

Exist a direct installation guide on Debian in this link, though i give more particular details and how resolve any problems not mentions in the guide.


The last Debian version is the 11 and i focus in this, but this guide works since version 9 onwards.


Before installing the driver is necessarily know the device architecture, if is an old computer it has a 32 bits architecture. If a modern it has 64 bits architecture, this data can be intuited running neofetch of the kernel, but surely you can consult with the device model in a web browser finder.


If 64 bits then install:

# apt install linux-headers-amd64

If 32 bits then install depending on if it comes with PAE:

# apt install linux-headers-686
# apt install linux-headers-686-pae

After installed header, go to install the sugested driver from #nvidia_detect along with de firmware, in my case is nvidia-legacy-390xx-driver.

 apt update
# apt install nvidia-legacy-390xx-driver firmware-misc-nonfree

A detail that the guide no comments is that after installed the driver, it can detect the GPU and show hardware info, but it will be unusable until you have the firmware, so both are necessary packages.


Reboot the device and when start, we run the nvidia-smi command from terminal and will get something like this:


Fri Aug 19 13:23:19 2022

+-----------------------------------------------------------------------------+

| NVIDIA-SMI 390.151 Driver Version: 390.151 |

|-------------------------------+----------------------+----------------------+

| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |

| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |

|===============================+======================+======================|

| 0 GeForce 820M Off | 00000000:04:00.0 N/A | N/A |

| N/A 52C P0 N/A / N/A | 0MiB / 1985MiB | N/A Default |

+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+

| Processes: GPU Memory |

| GPU PID Type Process name Usage |

|=============================================================================|

| 0 Not Supported |

+-----------------------------------------------------------------------------+


If you get a similar message like this, then you're achieved to install the driver successfully, if you get a different message, then you installed a wrong driver, if you get the message `Device not found` after installing the correct driver, then your GPU is dead despite being detected by the kernel.


The nvidia-smi are contained in legacy-390xx-driver dependencies, but it also comes with other graphic drivers if you mix dependencies, you will have uncomfortable problems, that's why it's better to use the synaptic package installer, because it allows you to see all the dependencies that come with the driver, even install more dependencies according to your needs.


El problema de los portátiles con doble tarjeta

In my case that i have an Asus X455L laptop that have an integrated GPU and a dedicated GPU NVidia GeForce 820m. the kernel normally uses the integrated GPU leaving useless the dedicated GPU, there are some ways of activate a GPU or other, to do discrete use of both graphics or castrate one graphic and use the other GPU definitively, in my opinion this last option is the least desirable, but which are the differences and benefits of each option?

Discrete graphics with Optimus.

This in my opinión is the best option, since it will come using the integrated Intel GPU and if you need more processing power, the Intel GPU delegate calculations to the NVidia GPU through of the NVidia Optimus Technology, obtaining a smart consuming electric power.


For to know if you GPU Nvidia use this technology go to list of Nvidia.


If so, then you can install #Bumblebee or primus package to take advantage of this discrete graphics technology.


GPU switch.

If the first option is not posible there are still chance to switch a GPU or other at your convenience with prime-select command, this option is a bit uncomfortable.


GPU castration.

This option for me is the worse, but is the last option when no there are more options, even so it has an interest point and is choose between energetic power definitive saving using only the integrated GPU versus the maximum performance of the dedicated GPU all the time.



Servidor de gráficos OpenGL

Surely you are notice that maybe none application that use 3D graphics is running in Debian because this is not installed by default.


To know if you have a graphic server you can test with glxgears, this command shows three gears spinning, if you see then you have a graphic server, else you obtain a message as:

Xlib: extension "GLX" missing on display ":0".
Error: couldn't get an RGB, Double-buffered visual

Then maybe have a hint that not have a graphic server for OpenGL or simply glxgears not know which GPU start the benchmark, but to be sure you can install the application hard info and execute the GPU benchmark.




If the benchmark result in the machine section appears the OpenGL renderer show unknow, then is because you not have installed none OpenGL library, to resolve it there are to install or reinstall some packages:

sudo apt-get install --reinstall libgl1-mesa-glx bumblebee-nvidia

Installing it is enough, but if it still gives problems the execute glxgears, even after being able to see the name of the GPU and after of to have reinstall the mesa library, then maybe running glxinfo will fix all the problems.


Execute glxinfo -h command will see the help, between the options are -l that show the OpenGL limits, for some reason it to do that choose any available OpenGL server, either intel or NVidia.


So far there are no problems and you can use the graphics, everything also depends on the option you have chosen and if your graphics has #Optimus technology.


NVidia configurations.

According to what driver you has installed this include some dependencies like #glxinfo, #glxgears, #prime_settings, #nvidia_xconfig, but in my case comes with #nvidia_settings.

to execute say that i must be execute first #nvidia_xconfig as root user, nevertheless this package is deprecated because it comes contained in the xorg library, it is not recommended to install.


However, running `optirun nvidia-settings -c :8` now allows us to see all the available options that we couldn't access using the #nvidia_settings command alone.


still i am not understand how to conserve the changes without #optirun command, i would like in a nearest future not force all with commands, i am still learning.


Resume.

I am writing this post like a personal guide if in the future would have go through this winding road, i hope that my experience helps you to clarify posibles failures in your device.


I am not understanding completely some commands and your options that comes by default as dependencies, either I know what is #Xorg or #Wayland and your role in this.


For now, this is enough to install the driver successfully. See you in the next post.

246 views0 comments
bottom of page