HOW-TO · SET

How to install CUDA drivers on Ubuntu

intermediate20 minBy Eruo Fredoline
Target environment
Ubuntu 24.04 · Ollama 0.4.xWindows 11 · Ollama 0.4.xmacOS 15 · Ollama 0.4.x
PREREQUISITES

Ubuntu 22.04+, NVIDIA GPU, internet

What this does

Installs the NVIDIA driver and CUDA toolkit so that GPU-accelerated workloads run on the hardware. After completion, nvidia-smi reports the GPU and nvcc --version shows the toolkit version.

Steps

  1. Update the package index.

    sudo apt update
    

    Expected output: Package lists updated.

  2. Install the NVIDIA driver meta-package.

    sudo apt install -y ubuntu-drivers-common
    sudo ubuntu-drivers autoinstall
    

    Expected output: Driver packages installed.

  3. Reboot the system. The driver loads as a kernel module.

    sudo reboot
    
  4. Verify the driver installation.

    nvidia-smi
    

    Expected output: Table listing GPU, driver version, and memory usage.

  5. Install the CUDA toolkit (optional for nvcc).

    sudo apt install -y cuda
    

    Expected output: CUDA toolkit installed.

Verification

nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv
# Expected: GPU name, driver version, total memory in MB

Common failures

  • No GPU detected by lspci — GPU not seated properly. Physically reseat the card.
  • Secure Boot blocks the driver — Disable Secure Boot in BIOS or sign modules with MOK enrollment.
  • Driver version mismatch — Run ubuntu-drivers list and manually install a compatible version.
  • Reboot hangs at Plymouth — Add nvidia-drm.modeset=1 to GRUB kernel parameters.
  • CUDA installed but nvcc not found — Source /usr/local/cuda/bin/nvcc or add it to the shell profile.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Operator checkpoint

Before treating this as solved, write down the local runtime, model or package version, hardware/backend if relevant, and the verification output. This keeps the guide useful as a Will-It-Run style decision instead of a one-off command transcript.

Related guides

RELATED GUIDES