02. NVIDIA Driver Installation

Chapter 2 of 15 · 20 min

On Ubuntu 22.04 or 24.04, the Nouveau driver is loaded by default and must be disabled before the proprietary driver can function. Check with lsmod | grep nouveau. If it returns output, Nouveau is active and will conflict with the proprietary driver.

Disable it permanently:

sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo update-initramfs -u

Then install the driver. Use the Ubuntu-owned package, not the .run installer from NVIDIA's website unless you have a specific reason:

sudo apt update
sudo apt install nvidia-driver-535  # 535 is a stable long-lived branch
sudo reboot

After reboot, verify:

nvidia-smi
# Expected output:
# +-----------------------------------------------------------------------------+
# | NVIDIA-SMI 535.183.01   Driver Version: 535.183.01  CUDA Version: 12.2     |
# | GPU  Name   Temp/Memory/Pwr  Util  Corp |
# |   0  RTX 3090    42C   24GB /  24GB    15W  Default |
# +-----------------------------------------------------------------------------+

The "CUDA Version" in nvidia-smi header is the maximum supported CUDA runtime version, not what you have installed. Actual CUDA toolkit version comes from nvcc --version.

Failure mode: The driver installs but nvidia-smi fails with NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. This usually means the kernel module failed to load. Check with lsmod | grep nvidia. If empty, run sudo modprobe nvidia and check dmesg | grep -i nvidia for the error. Common cause: kernel ABI mismatch after a kernel update and the DKMS rebuild did not complete.

Failure mode: update-initramfs -u fails because the initramfs is mounted on a device that depends on Nouveau. Boot into recovery mode and run the blacklist commands from there, then reboot.

Failure mode: You install the .run installer and it overwrites /usr/lib/x86_64-linux-gnu/libnvidia-rtcore.so*, breaking Steam or other applications that link against the distribution's libglvnd. Use the .run installer only when you are running a custom kernel that the distribution package does not support.

EXERCISE

On an Ubuntu machine, run lsmod | grep nouveau, install the proprietary driver, reboot, and confirm nvidia-smi output matches your GPU's specifications.