How to install CUDA drivers on Ubuntu
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
Update the package index.
sudo apt updateExpected output: Package lists updated.
Install the NVIDIA driver meta-package.
sudo apt install -y ubuntu-drivers-common sudo ubuntu-drivers autoinstallExpected output: Driver packages installed.
Reboot the system. The driver loads as a kernel module.
sudo rebootVerify the driver installation.
nvidia-smiExpected output: Table listing GPU, driver version, and memory usage.
Install the CUDA toolkit (optional for nvcc).
sudo apt install -y cudaExpected 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 listand manually install a compatible version. - Reboot hangs at Plymouth — Add
nvidia-drm.modeset=1to GRUB kernel parameters. - CUDA installed but nvcc not found — Source
/usr/local/cuda/bin/nvccor 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.