Skip to content

Installing and Troubleshooting NVIDIA Drivers on Ubuntu

This guide walks a new user through safely installing NVIDIA proprietary drivers on Ubuntu (24.04 and similar). Follow the numbered steps exactly. If Secure Boot prompts appear, follow the enrollment steps described below.

Identify PCI devices and driver info:

Terminal window
lspci -nnk | grep -iA3 \[03\]:
# or more specifically
lspci -nnk | grep -iA3 nvidia
# show kernel modules and drivers
lspci -vnn | grep -i nvidia -A 12

If output shows an NVIDIA VGA/3D controller, proceed.

Ubuntu provides ubuntu-drivers to recommend tested packages. Run:

Terminal window
sudo ubuntu-drivers devices
sudo ubuntu-drivers autoinstall
sudo reboot

This installs a distribution-tested driver and DKMS modules if needed. Reboot to load the new kernel module.

3 Manual install of a specific driver version

Section titled “3 Manual install of a specific driver version”

To explicitly install a version (example nvidia-driver-535):

Terminal window
sudo apt update
sudo apt install -y nvidia-driver-535 nvidia-utils-535
sudo reboot

Verify installation after reboot:

Terminal window
nvidia-smi
lsmod | grep nvidia

If Secure Boot is enabled, the kernel will refuse unsigned modules. When installing DKMS-based drivers, Ubuntu often triggers a MOK enrollment prompt on next reboot. If you miss it, enroll manually:

Generate a key (run once):

Terminal window
sudo apt install -y mokutil openssl
sudo openssl req -new -x509 -newkey rsa:2048 -keyout /root/MOK.priv -out /root/MOK.pem -nodes -days 3650 -subj "/CN=Custom MOK/"
sudo mokutil --import /root/MOK.pem

You will be asked to set a password. Reboot, enter the MOK manager, select “Enroll MOK”, and provide the password to complete enrollment.

Alternatively, disable Secure Boot in firmware settings (less recommended for security-aware users).

If nvidia-smi fails or shows no devices:

  1. Check kernel messages: dmesg | grep -i nvidia and journalctl -k | tail.
  2. Check DKMS build logs in /var/lib/dkms/<module>/<version>/build/make.log.
  3. Confirm nouveau is not blocking: lsmod | grep nouveau. If present, create /etc/modprobe.d/blacklist-nouveau.conf with blacklist nouveau and options nouveau modeset=0, then run sudo update-initramfs -u and reboot.
  4. Check lspci -k to see which kernel driver is in use for the VGA device.
  5. If module signing errors appear, review Secure Boot MOK enrollment or sign the module manually (see Secure Boot guide).
  6. If X/Wayland fails, check /var/log/Xorg.0.log and journalctl -b for compositor messages.
  • nvidia-smi shows GPU status and driver version.
  • glxinfo | grep OpenGL or vulkaninfo (if using Vulkan) to verify rendering.

This guide focuses on Ubuntu’s packaged drivers. If you need instructions for installing NVIDIA’s runfile installer, request that explicitly — it requires extra care (kernel headers, stopping display manager, and manual DKMS integration).