NVIDIA Driver Installation Best Practices Guide

Alexander Hill
Alexander Hill
  • Updated

Document Overview

This guide provides comprehensive best practices for installing NVIDIA drivers on Linux systems using the official .run installer with DKMS (Dynamic Kernel Module Support) integration. Following these procedures ensures reliable driver installation, automatic kernel module rebuilding during kernel updates, and optimal system stability.

The methodology outlined here is particularly valuable for enterprise environments, high-performance computing clusters, and development workstations where driver reliability and automated maintenance are critical requirements.

Prerequisites

System Requirements

  • Linux distribution with kernel version 3.10 or newer
  • Root or sudo access privileges
  • Active internet connection for package downloads
  • Minimum 2GB free disk space
  • X11 or Wayland display server (if GUI is required)

Required Packages

Before beginning the installation process, ensure the following packages are installed:

For Debian/Ubuntu-based systems:

sudo apt-get update
sudo apt-get install build-essential dkms linux-headers-$(uname -r)
sudo apt-get install pkg-config libglvnd-dev

For RHEL/CentOS/Rocky Linux systems:

sudo yum groupinstall "Development Tools"
sudo yum install dkms kernel-devel-$(uname -r) kernel-headers-$(uname -r)
sudo yum install pkgconfig libglvnd-devel

Pre-Installation Checklist

  • Verify system architecture matches driver package (x86_64)
  • Confirm kernel headers match running kernel version: uname -r
  • Check available disk space: df -h /
  • Backup current driver configuration (if applicable)
  • Download latest NVIDIA driver from official sources
  • Verify driver package integrity with checksums

Installation Procedure

1. Prepare System

Make sure the system is clean of any previous NVIDIA driver installations. Remove drivers installed from package managers or previous run files.

# Stop graphical session (X/Wayland)
sudo systemctl isolate multi-user.target

# Remove NVIDIA modules if loaded
sudo rmmod nvidia_uvm nvidia_drm nvidia_modeset nvidia

# Uninstall previous NVIDIA drivers
sudo ./NVIDIA-Linux-x86_64-XXX.XX.run --uninstall

Install prerequisites (kernel headers, build tools, DKMS package):

sudo apt-get update
sudo apt-get install build-essential dkms linux-headers-$(uname -r)

2. Blacklist Nouveau Driver (Optional, if it conflicts)

Create /etc/modprobe.d/blacklist-nouveau.conf:

blacklist nouveau
options nouveau modeset=0

Then regenerate initramfs:

sudo update-initramfs -u

Reboot to apply changes.

3. Run NVIDIA Driver Installer with --dkms

Run the installer like this:

sudo bash NVIDIA-Linux-x86_64-XXX.XX.run --dkms
  • This will build and install the NVIDIA kernel module and register it with DKMS.
  • The module will rebuild automatically when a new kernel is installed.

4. Verify Installation

Check kernel module is loaded:

lsmod | grep nvidia

Check NVIDIA devices recognized:

nvidia-smi

5. Post-Installation Configuration

Enable NVIDIA services:

sudo systemctl enable nvidia-persistenced
sudo systemctl start nvidia-persistenced

Configure X11 (if using GUI):

sudo nvidia-xconfig

Set persistence mode:

sudo nvidia-smi -pm 1

 

Common Issues and Solutions

Issue: DKMS build failures

  • Solution: Ensure kernel headers match running kernel exactly
  • Verify: ls /usr/src/linux-headers-$(uname -r)

Issue: Secure Boot conflicts

  • Solution: Sign NVIDIA kernel modules or disable Secure Boot
  • Alternative: Use distribution-provided signed drivers

Issue: X11 startup failures

  • Solution: Regenerate X11 configuration: sudo nvidia-xconfig
  • Check: /var/log/Xorg.0.log for detailed error messages

Issue: Module loading errors

  • Solution: Check kernel module dependencies: modinfo nvidia
  • Verify: No conflicting drivers loaded: lsmod | grep -E '(nouveau|nvidia)'

Notes & Caveats

  • Avoid mixing package manager installs (apt install nvidia-driver-XXX) with .run file installs unless you know what you're doing.
  • On systems with secure boot enabled, the NVIDIA kernel module may need to be signed to load properly.
  • Sometimes DKMS builds fail if kernel headers don't match the running kernel; ensure linux-headers-$(uname -r) is installed.
  • If you want to uninstall later, the .run file uninstall script will unregister DKMS modules.
  • DKMS integration requires additional disk space for kernel module source storage
  • Regular system updates may trigger automatic driver rebuilds, which can take several minutes
  • Some enterprise environments may require custom DKMS configuration for security compliance

Conclusion

Following these best practices ensures a robust NVIDIA driver installation that automatically adapts to kernel updates through DKMS integration. The use of the official .run installer provides the most up-to-date drivers and features, while DKMS support eliminates the common issue of driver breakage during kernel updates.

 

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.