Title: Kinetica Documentation: Installing Nvidia Drivers on Debian/Ubuntu”*
In this guide, we’ll walk you through the process of installing Nvidia drivers on a Debian or Ubuntu system, particularly when working with Nvidia GPUs. Proper installation is crucial for utilizing the full capabilities of your hardware, especially for tasks involving CUDA applications.
Preliminary Checks
Before diving into the installation, it’s essential to verify that your system recognizes the installed Nvidia GPUs. You can do this with the following commands:
- First, ensure that the
lspci
tool is installed: - Next, check for Nvidia devices:
sudo apt-get -y install pciutils
lspci | grep VGA
The output should include a line that mentions Nvidia. If you don’t see it, there may be an issue with your GPU installation.
Disabling Nouveau Driver
The Nouveau driver is an open-source alternative to Nvidia’s proprietary drivers, but it’s incompatible with CUDA. Therefore, it must be disabled before installing the Nvidia drivers:
Blacklist Nouveau
cat <
Then, apply the following commands:
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
Update Grub Configuration
To ensure that Nouveau is disabled, you also need to modify the Grub configuration:
sudo cp /etc/default/grub /etc/default/grub.bak
Edit the Grub configuration file:
sudo nano /etc/default/grub
Add the following options to the GRUB_CMDLINE_LINUX
line:
rd.driver.blacklist=nouveau rcutree.rcu_idle_gp_delay=1
Update Grub:
sudo grub2-mkconfig -o /boot/grub/grub.cfg
Installation Prerequisites
Before installing the Nvidia drivers, ensure the following packages are installed:
linux-headers-$(uname -r)
make
gcc-4.8
acpid
dkms
sudo apt-get -y install linux-headers-$(uname -r) make gcc-4.8 acpid dkms
Exiting the X Server
Before proceeding with the installation, ensure that you exit from any graphical interface (like Gnome or KDE). You can switch to a TTY console by pressing Ctrl-Alt-F1
. To find out which display manager is running, use:
sudo ps aux | grep "lightdm|gdm|kdm"
Stop the service as needed:
sudo service lightdm stop
sudo init 3
Installing Nvidia Drivers
To get the best performance, remember to include OpenGL and GL Vendor Neutral Dispatch (GLVND) in your installation. You can download the latest drivers from the Nvidia website, selecting the appropriate version for your architecture.
To install the drivers, change the permissions on the downloaded file:
chmod +x ./NVIDIA-Linux-$(uname -m)-*.run
Run the installation script with:
sudo ./NVIDIA-Linux-$(uname -m)-*.run
If prompted about cryptographic signatures, choose to sign the kernel module and generate a new key pair. Be cautious not to update your X configuration if asked.
Troubleshooting Installation Issues
If you encounter problems during installation, such as kernel signature errors, running the installer in expert mode may help:
sudo ./NVIDIA-Linux-
Make sure to have matching kernel headers installed:
sudo apt-get update && sudo apt-get install linux-headers-$(uname -r)
Verifying the Installation
After installation, you can check if the Nvidia drivers are functioning correctly by running:
nvidia-smi
This command should display details about your Nvidia GPU and confirm that the drivers are correctly installed.
Resolving Driver Conflicts
If you encounter the message "Failed to initialize NVML: GPU access blocked by the operating system," there may be multiple versions of the Nvidia drivers on your system. You can check for installed versions using:
dpkg --list | grep -E "cuda|nvidia"
Remove any outdated versions if needed, and confirm that all relevant libraries are associated with the installed driver version.
Restarting the X Server
If you stopped your X Server for the installation, the simplest way to resume is to reboot your system:
sudo reboot now
Following these steps will ensure that your Nvidia drivers are installed correctly and ready for use.