Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing NVIDIA GPU Drivers on Ubuntu

Tech 1

Identify Your GPU

Open a terminal and run one of the following commands:

lspci | grep -i vga
# or
lspci | grep -i nvidia

The output will include your GPU model. For example:

01:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 SUPER] (rev a1)

Download the Correct Driver

Visit the NVIDIA driver download page. Select your GPU model, operating system (Linux 64-bit), and Ubuntu version to get the appropriate .run file.

Prepare the System

Update packages and install build tools:

sudo apt update
sudo apt upgrade -y
sudo apt install -y gcc g++ make

Disable the Nouveau Driver

Create or edit the blacklist configuraton:

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

Add these lines:

blacklist nouveau
options nouveau modeset=0

Regenerate the initramfs and reboot:

sudo update-initramfs -u
sudo reboot

Install the NVIDIA Driver

After rebooting, switch to a TTY console (e.g., press Ctrl+Alt+F2) and log in.

Stop the display manager (use gdm3 if you're on GNOME):

sudo systemctl stop lightdm
# or
sudo systemctl stop gdm3

Navigate to the directory containing the downloaded .run file, make it executable, and run it:

chmod +x NVIDIA-Linux-x86_64-*.run
sudo ./NVIDIA-Linux-x86_64-*.run

Accept the license and follow prompts. Use default options unless you have specific requirements.

Verify Installation

Reboot the system:

sudo reboot

After login, confirm the driver is active:

nvidia-smi

A successful output shows GPU details, driver version, and CUDA version.

Fix Driver Issues After Kernel Updates

If nvidia-smi fails with a communication error after a system update, the kernel module may be incompatible with the new kernel.

Install DKMS to automatically rebuild drivers for new kernels:

sudo apt install -y dkms

Rebuild the NVIDIA modules for the current kernel:

# Replace <version> with your actual driver version, e.g., 550.54.14
sudo dkms install -m nvidia -v <version>

Then reload the modules or reboot:

sudo modprobe nvidia
# or
sudo reboot

Run nvidia-smi again to confirm functionality.

Tags: ubuntuNVIDIA

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.