How to Install NVIDIA Drivers on Ubuntu 26.04, 24.04 and 22.04

Last updated Wednesday, April 29, 2026 8:08 pm Joshua James 16 min read 6 comments

Install NVIDIA drivers on Ubuntu when Nouveau is not enough for gaming, Blender, CUDA workloads, external displays, or hybrid graphics. Ubuntu 26.04, 24.04, and 22.04 all provide packaged driver paths, so most systems should start with the default repository before adding the graphics-drivers PPA or NVIDIA’s CUDA repository.

The safest path is to let ubuntu-drivers devices identify the branch marked recommended, then install that branch through APT so kernel-module rebuilds, Secure Boot prompts, and future driver updates stay tied to Ubuntu’s package manager.

Install NVIDIA Drivers on Ubuntu

Use the quick path only on a clean system with no previous NVIDIA runfile, CUDA repository, or graphics-drivers PPA setup. If you are changing sources or recovering from a broken driver, remove the old packages first.

Quick NVIDIA Driver Install Commands for Ubuntu

sudo apt update
sudo apt install ubuntu-drivers-common
ubuntu-drivers devices
sudo ubuntu-drivers install
sudo reboot

After rebooting, confirm the active driver with nvidia-smi or cat /proc/driver/nvidia/version. If the quick path does not detect your GPU or you need a specific branch, continue with the full method sections.

The main packaged methods differ by source, branch cadence, and update behavior.

MethodChannelBranch SourceUpdatesBest For
Default Repository (CLI/GUI)Ubuntu ReposUbuntu-packaged branch selectionAutomatic via apt upgradeMost desktops and laptops that need a tested, system-managed driver
graphics-drivers PPALaunchpad PPAAdditional Ubuntu-packaged branchesAutomatic via apt upgradeSystems that need a branch not offered by the default repository yet
NVIDIA CUDA RepositoryNVIDIA CUDANVIDIA-packaged driver and CUDA branchesAutomatic via apt upgradeCUDA development, machine learning, and compute nodes that follow NVIDIA’s CUDA packaging

For most users, the default repository method is recommended because it keeps driver updates aligned with Ubuntu’s kernel and desktop packages. Use the graphics-drivers PPA only when the default repository does not offer the branch your GPU needs. Use the CUDA repository when you specifically want NVIDIA’s CUDA packaging and driver cadence for compute workloads.

Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS are in scope. The default repository, graphics-drivers PPA, and NVIDIA CUDA repository all publish amd64 driver metadata for these releases, but the CUDA repository uses different package names on 26.04 than it does on 24.04 and 22.04.

Remove Previous NVIDIA Drivers on Ubuntu

Before switching installation methods, remove the old NVIDIA source cleanly. Mixing Ubuntu repository packages, the graphics-drivers PPA, NVIDIA’s CUDA repository, and runfile installs can leave mismatched DKMS modules or libraries. After removal, Ubuntu falls back to the Nouveau kernel driver and Mesa userspace stack until a new NVIDIA driver is installed.

If you have not previously installed NVIDIA drivers through any method, skip to the preparation section.

Remove Old NVIDIA Driver Repositories

If you previously enabled the graphics-drivers PPA or the NVIDIA CUDA repository, remove those sources before reinstalling to avoid mixed driver branches or duplicate repository warnings. The CUDA cleanup includes the current cuda-keyring source file and older article-created source names:

sudo add-apt-repository --remove ppa:graphics-drivers/ppa
sudo rm -f /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa*.list
sudo rm -f /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa*.sources
sudo rm -f /etc/apt/sources.list.d/cuda-ubuntu*-x86_64.list
sudo rm -f /etc/apt/sources.list.d/nvidia-drivers.list
sudo rm -f /etc/apt/sources.list.d/nvidia-cuda.sources
sudo rm -f /etc/apt/preferences.d/cuda-repository-pin-600

Refresh APT after removing these entries so the old source is no longer considered during package selection:

sudo apt update

Remove NVIDIA Packages via APT

Preview the APT-based NVIDIA cleanup before running it. Quoting the package patterns keeps your shell from expanding them before APT receives the package names:

sudo apt --simulate remove --purge 'nvidia*' 'libnvidia*'

If the preview contains only NVIDIA driver packages you intend to remove, run the real purge:

sudo apt remove --purge 'nvidia*' 'libnvidia*'

Preview dependency cleanup separately so APT does not remove unrelated desktop, kernel, or development packages without review:

sudo apt autoremove --dry-run --purge

Continue only if the preview is limited to packages you no longer need:

sudo apt autoremove --purge

If you previously installed the CUDA Toolkit through Ubuntu or NVIDIA repositories, purge those packages before choosing a new driver source. This removes meta-packages such as cuda-drivers, cuda-toolkit-13-2, and libcuda1 that can keep NVIDIA components pinned in place:

sudo apt --simulate remove --purge 'cuda-*' 'libcuda*' 'nvidia-cuda-toolkit' cuda-keyring

If the preview is clean, remove the CUDA packages:

sudo apt remove --purge 'cuda-*' 'libcuda*' 'nvidia-cuda-toolkit' cuda-keyring

Confirm the old APT packages are gone or only left as removed config entries (rc):

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 'nvidia*' 'libnvidia*' 'cuda*' 'libcuda*' 2>/dev/null | grep -E '^(ii|rc)' || true

No lines starting with ii should remain for NVIDIA or CUDA packages before you continue.

Remove NVIDIA Drivers Installed via Runfile

If you installed NVIDIA drivers with a runfile downloaded from NVIDIA’s Unix driver page, do not use APT as the only cleanup path. Runfile installs place files outside APT’s package database and include their own uninstaller script.

The uninstaller refuses to run while GNOME, KDE, or Wayland sessions are active. Press Ctrl+Alt+F3 to reach a text console, sign in, and stop your display manager (for example, sudo systemctl stop gdm3 or sudo systemctl stop lightdm) before continuing. After cleanup, reboot or start the display manager again.

Before running the uninstaller, remove NVIDIA-created modprobe blacklist files so the system can boot back into Nouveau if needed:

The next command deletes NVIDIA installer blacklist files from system modprobe directories. Review the paths first if you manually manage custom modprobe rules.

sudo rm -f /lib/modprobe.d/nvidia-installer-*
sudo rm -f /etc/modprobe.d/nvidia-installer-*
sudo rm -f /usr/lib/modprobe.d/nvidia-installer-*

Next, edit /etc/default/grub and remove any custom parameters such as nvidia-drm.modeset=1 or nvidia-drm.fbdev=1 that were added to support the proprietary driver. After saving the file, rebuild GRUB and your initramfs:

sudo update-grub
sudo update-initramfs -u

Run the bundled uninstaller to remove the driver:

sudo /usr/bin/nvidia-uninstall

Remove CUDA Toolkit Installed via Runfile

If you installed the CUDA Toolkit using a runfile, remove it with the included cuda-uninstaller script. Replace X.Y with your installed CUDA version number:

sudo /usr/local/cuda-X.Y/bin/cuda-uninstaller

For example, CUDA 12.0 uses /usr/local/cuda-12.0/bin/cuda-uninstaller.

Prepare Ubuntu for NVIDIA Driver Installation

Update the system, install matching kernel headers, and confirm Ubuntu can see the NVIDIA GPU before choosing a driver branch.

Update Ubuntu System Packages

Update package metadata first so APT sees the latest kernel, driver, and dependency candidates.

Refresh package metadata:

sudo apt update

These commands use sudo for package-management tasks that need root privileges. If your account is not in the sudoers file yet, run the commands as root or follow the guide on how to add a new user to sudoers on Ubuntu.

Then apply pending package upgrades:

sudo apt upgrade

For LTS users with recent hardware, the HWE kernel provides newer kernel versions and improved driver compatibility without upgrading your entire Ubuntu release.

Ubuntu Server and other minimal images often skip kernel headers and PCI utilities. DKMS needs matching headers to compile NVIDIA modules, while pciutils provides the lspci command used for GPU detection:

sudo apt install linux-headers-$(uname -r) pciutils

If you compile OpenGL or EGL applications locally, install NVIDIA’s GLVND development stack and build helpers now. These libraries are optional for driver installation but save time when you later build GPU-aware software:

sudo apt install pkg-config libglvnd-dev libegl-dev libgl-dev libgles-dev libglx-dev libopengl-dev gcc make

Verify NVIDIA GPU Compatibility

Verify the detected GPU before you pick a branch. Recent GPUs usually work with the recommended branch, while older cards may need a legacy branch that still supports their architecture.

Find your graphics card model:

lspci | grep -E 'VGA|3D|Display'

The grep -E filter catches desktop GPUs, laptop hybrid GPUs that appear as 3D controllers, and display controllers. The grep command guide with examples explains the extended-regex form used here.

Relevant output looks similar to this:

03:00.0 VGA compatible controller: NVIDIA Corporation TU117 [GeForce GTX 1650] (rev a1)

After you know the GPU model, check NVIDIA’s Unix driver page or the supported-products list for the branch you plan to install. Legacy GPUs such as older Kepler, Maxwell, Pascal, and some notebook variants may need a specific branch instead of the newest package Ubuntu exposes.

Method 1: Install NVIDIA Drivers on Ubuntu via CLI

The CLI method is the best default because it shows the recommended package, works on desktop and server installs, and keeps the driver under APT management.

Identify Available NVIDIA Drivers

If ubuntu-drivers is missing, which is common on Ubuntu Server or minimal installs, install it first:

sudo apt install ubuntu-drivers-common

List available drivers for your GPU:

ubuntu-drivers devices

Relevant output shows the detected GPU and the driver marked recommended:

vendor   : NVIDIA Corporation
model    : TU117 [GeForce GTX 1650]
driver   : nvidia-driver-580 - third-party non-free recommended
driver   : nvidia-driver-580-open - third-party non-free
driver   : nvidia-driver-550 - third-party non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

You can also list branch packages without device detection:

ubuntu-drivers list

Servers and GPU compute hosts should include the --gpgpu flag to see the recommended -server builds:

ubuntu-drivers list --gpgpu

The --gpgpu option belongs to the list and install subcommands. If the top-level help does not show it, check ubuntu-drivers list --help or ubuntu-drivers install --help.

The ubuntu-drivers tool uses Ubuntu-packaged drivers and is usually the safest starting point when Secure Boot is enabled. If Secure Boot still blocks the modules, enroll a Machine Owner Key (MOK) or temporarily disable Secure Boot during installation.

In the example output, the graphics card model is TU117 [GeForce GTX 1650], and the recommended NVIDIA driver is nvidia-driver-580. Your GPU may produce a different branch, so use the entry marked recommended unless you have a hardware-support reason to choose another package.

Install NVIDIA Drivers from Ubuntu Repositories

Install the recommended driver automatically using the ubuntu-drivers install command:

sudo ubuntu-drivers install

The tool analyzes your hardware and installs the recommended branch. Ubuntu 24.04 and 22.04 still list ubuntu-drivers autoinstall as a deprecated alias, but Ubuntu 26.04 does not list that command, so use sudo ubuntu-drivers install in new instructions.

If you prefer explicit control while staying inside the helper tool, specify the branch from the ubuntu-drivers list output. Replace <version> with the number shown as recommended:

sudo ubuntu-drivers install nvidia:<version>

You can also install a specific package directly with APT. Use the regular proprietary package when your GPU or workload requires it:

sudo apt install nvidia-driver-<version>

Use the -open kernel-module package only on supported GPUs:

sudo apt install nvidia-driver-<version>-open

For legacy GPUs, verify that the branch exists on your Ubuntu release before installing it. Ubuntu 24.04 and 22.04 currently expose nvidia-driver-470; Ubuntu 26.04 does not expose that package in the default repository, and some older branch names on 26.04 are transitional packages that point to a newer branch.

apt-cache policy nvidia-driver-470
sudo apt install nvidia-driver-470

Ubuntu Server editions should install the -server metapackages, which provide server-oriented driver packages without pulling unnecessary desktop components. Use the proprietary server package when appropriate for the GPU:

sudo apt install nvidia-driver-<version>-server

Use the open server package for supported GPUs:

sudo apt install nvidia-driver-<version>-server-open

The ubuntu-drivers tool can install the same server package family in one command:

sudo ubuntu-drivers install --gpgpu nvidia:<version>-server

After selecting a server driver, install the matching utilities so headless hosts still have nvidia-smi and related tooling:

sudo apt install nvidia-utils-<version>-server

Reboot after installation so the new kernel modules replace Nouveau or any older NVIDIA branch still loaded in memory:

sudo reboot

If Secure Boot prompts for MOK enrollment during the reboot, finish that enrollment before expecting the NVIDIA module to load.

Method 2: Install NVIDIA Drivers on Ubuntu via GUI (Desktop Only)

The graphical method uses Ubuntu Desktop’s Additional Drivers panel. It is convenient on GNOME desktops, but the CLI method above is more predictable on servers, minimal installs, and remote systems.

This workflow only exists on Ubuntu Desktop editions where GNOME and the Additional Drivers panel are installed. Ubuntu Server users should stick with the CLI methods above.

Ubuntu 26.04 desktop installs may not include the GUI tools by default. If “Additional Drivers” is missing from the menu, install software-properties-gtk first, then open the app again:

sudo apt install software-properties-gtk

Open Ubuntu Additional Drivers

Open the “Additional Drivers” application from your application menu:

  1. Click “Activities” in the top-left corner of the screen.
  2. Then, type “Additional Drivers” in the search bar.
  3. Select the “Additional Drivers” application from the search results.

Select and Install an NVIDIA Driver in Additional Drivers

The “Software & Updates” window displays available drivers for your NVIDIA graphics card. The branch list varies by GPU model and enabled repositories.

Select the recommended NVIDIA driver, click “Apply Changes”, and wait for the package installation to finish.

Finally, reboot your system after installation completes.

Method 3: Install NVIDIA Drivers on Ubuntu via graphics-drivers PPA

The graphics-drivers PPA can expose additional NVIDIA driver branches before they reach Ubuntu’s default repository. Use it only when the default repository lacks a branch your GPU or workload needs.

Install graphics-drivers PPA Prerequisites

Install the helper package that provides add-apt-repository on minimal systems:

sudo apt install software-properties-common

Add graphics-drivers PPA

Add the graphics-drivers PPA:

sudo add-apt-repository ppa:graphics-drivers/ppa

Refresh APT for NVIDIA Drivers from the PPA

Refresh package metadata to detect drivers from the PPA:

sudo apt update

APT should report an InRelease fetch for your Ubuntu codename, such as resolute, noble, or jammy. If APT reports a 404 error or says the repository does not have a Release file, the PPA does not currently publish metadata for that Ubuntu release.

Verify Available NVIDIA Drivers

List the PPA’s available drivers:

ubuntu-drivers devices

The output may show a newer branch, a legacy branch, or the same recommended branch that Ubuntu already offered. Compare the recommended entry before installing anything; a visible PPA does not always mean the PPA is the better source for your release.

Install NVIDIA Drivers from PPA

Install the recommended driver from the PPA:

sudo ubuntu-drivers install

To install a specific proprietary branch directly, replace <version> with the recommendation from ubuntu-drivers devices:

sudo apt install nvidia-driver-<version>

Use the open kernel-module package only when the listed branch supports your GPU:

sudo apt install nvidia-driver-<version>-open

On Ubuntu Server with the graphics-drivers PPA, select the matching -server metapackage to keep the installation lean:

sudo apt install nvidia-driver-<version>-server

Use the -server-open package only on supported GPUs:

sudo apt install nvidia-driver-<version>-server-open

To stay with ubuntu-drivers, use the GPGPU flag to install the server package family from the active source:

sudo ubuntu-drivers install --gpgpu nvidia:<version>-server

Add the matching utilities for headless systems:

sudo apt install nvidia-utils-<version>-server

Reboot after installation completes.

Method 4: Install NVIDIA Drivers on Ubuntu via CUDA Repository

NVIDIA’s CUDA repository now publishes amd64 driver metadata for Ubuntu 26.04, 24.04, and 22.04. Use this method only when you want NVIDIA’s CUDA repository to own the driver packages; otherwise, the default Ubuntu repository remains the cleaner desktop path.

Install CUDA Repository Prerequisites

The NVIDIA CUDA repository provides driver packages alongside CUDA Toolkit support. The build-essential package includes the GCC compiler and build tools for DKMS, while matching kernel headers let NVIDIA modules build against the running kernel. The keyring download uses curl; the curl command in Linux guide explains common flags such as -fsSLO.

sudo apt install build-essential dkms linux-headers-$(uname -r) ca-certificates curl

Install the NVIDIA CUDA Keyring

NVIDIA’s cuda-keyring package installs the repository source file, CUDA signing keyring, and APT priority pin together. Choose the command block that matches your Ubuntu release.

Ubuntu 26.04 LTS

curl -fsSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2604/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb

Ubuntu 24.04 LTS

curl -fsSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb

Ubuntu 22.04 LTS

curl -fsSLO https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb

Remove the downloaded package after dpkg installs it; APT uses the installed keyring and source file, not the local .deb copy:

rm -f cuda-keyring_1.1-1_all.deb

Refresh APT After Adding the CUDA Repository

Refresh package metadata so APT reads NVIDIA’s repository and pin file:

sudo apt update

Relevant output includes the CUDA repository for your release. Ubuntu 24.04 and 22.04 show the same pattern with ubuntu2404 or ubuntu2204 in the path:

Get:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2604/x86_64  InRelease
Get:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2604/x86_64  Packages

Check CUDA Repository Driver Packages

Check the driver package names before installation because Ubuntu 26.04 currently uses unversioned rolling packages in NVIDIA’s repository, while Ubuntu 24.04 and 22.04 also expose versioned branch packages such as nvidia-driver-580:

apt-cache policy cuda-drivers nvidia-open nvidia-driver nvidia-driver-580 nvidia-driver-580-open nvidia-headless nvidia-headless-580

For CUDA repository packages, look for developer.download.nvidia.com and APT priority 600 in the policy output. On Ubuntu 26.04, nvidia-driver-580 may still come from Ubuntu’s own repository, while NVIDIA’s CUDA repository owns nvidia-driver, nvidia-open, and cuda-drivers.

Install Current NVIDIA Drivers from CUDA Repository

For NVIDIA’s current CUDA repository branch, choose one current-package path. NVIDIA’s current documentation recommends the open kernel module flavor for newer supported GPUs:

sudo apt install nvidia-open

Use the proprietary kernel module flavor only when your GPU or workload requires it:

sudo apt install nvidia-driver

Use the CUDA driver metapackage when you want NVIDIA’s CUDA repository to choose the matching driver stack:

sudo apt install cuda-drivers

Install a Versioned CUDA Repository Driver on Ubuntu 24.04 or 22.04

Ubuntu 24.04 and 22.04 currently expose versioned CUDA repository branches such as 580. Use the proprietary branch only when you need that specific branch instead of the rolling nvidia-open, nvidia-driver, or cuda-drivers package:

sudo apt install nvidia-driver-580 nvidia-utils-580

Use the open kernel module variant for the same branch on supported GPUs:

sudo apt install nvidia-driver-580-open nvidia-utils-580

On Ubuntu 26.04, the CUDA repository currently owns the unversioned current-driver packages, while the versioned nvidia-driver-580 package comes from Ubuntu’s default repository.

Install NVIDIA Headless Drivers

For servers, containers, or headless compute nodes without a display, headless drivers omit GUI components while keeping GPU compute support. The unversioned proprietary package follows NVIDIA’s current CUDA repository branch:

sudo apt install nvidia-headless

Use the unversioned open kernel module package for supported GPUs:

sudo apt install nvidia-headless-open

On Ubuntu 24.04 or 22.04, use a versioned proprietary branch only after apt-cache policy shows it comes from NVIDIA’s CUDA repository:

sudo apt install nvidia-headless-580 nvidia-utils-580

Use the matching versioned open kernel module package when appropriate for the GPU:

sudo apt install nvidia-headless-580-open nvidia-utils-580

For data center servers with NVSwitch hardware, install Fabric Manager from the same CUDA repository source. Verify package names with apt-cache policy first because Fabric Manager packaging differs by branch and release:

apt-cache policy nvidia-fabricmanager libnvidia-nscq
sudo apt install nvidia-fabricmanager libnvidia-nscq

Reboot after installation so the new modules load:

sudo reboot

Update NVIDIA Drivers on Ubuntu

Keep driver updates tied to the same source you used for installation. Mixing default repository, PPA, and CUDA repository packages during updates can replace the kernel module without the matching utilities.

sudo apt update
apt list --upgradable 2>/dev/null | grep -E '^(nvidia|libnvidia|cuda)' || true

For routine updates, upgrade through APT and reboot if a driver, DKMS, kernel, or CUDA package changed:

sudo apt upgrade
sudo reboot

For a targeted desktop-driver update, replace <version> with the installed branch, such as 580 or 550:

sudo apt install --only-upgrade nvidia-driver-<version> nvidia-utils-<version>

For a targeted server-driver update, keep the server packages on the same branch:

sudo apt install --only-upgrade nvidia-driver-<version>-server nvidia-utils-<version>-server

Troubleshoot NVIDIA Driver Installation Issues on Ubuntu

Installation failures and display issues usually stem from driver conflicts, Secure Boot blocking modules, missing utilities, or stale GNOME settings.

Secure Boot Blocks NVIDIA Driver Loading

Systems with Secure Boot enabled block unsigned kernel modules, preventing NVIDIA drivers from loading. Consequently, you have two options: disable Secure Boot in BIOS/UEFI settings during installation, or enroll a Machine Owner Key (MOK) to sign DKMS-built modules.

For most users, temporarily disabling Secure Boot during driver installation is simplest:

  1. Reboot and enter BIOS/UEFI (usually by pressing Del, F2, or F12 during startup)
  2. Find “Secure Boot” in Security settings and disable it
  3. Save and reboot
  4. Install NVIDIA drivers using any method above
  5. Re-enable Secure Boot only after enrolling a key that signs the NVIDIA modules; otherwise leave it disabled

If you need Secure Boot enabled, install the MOK tooling and enroll a Machine Owner Key (MOK) so DKMS signs the drivers before you switch it back on. The shim-signed package provides update-secureboot-policy on Ubuntu systems where that command is not already installed:

sudo apt install shim-signed mokutil
sudo update-secureboot-policy --new-key
sudo reboot

During reboot, follow the on-screen MOK enrollment prompt. After enrollment, reinstall the NVIDIA driver so the modules are signed, then re-enable Secure Boot. For more background, refer to Debian’s Secure Boot and DKMS documentation; the process applies to Ubuntu as well.

Black Screen or No Display After Installation

If your system boots to a black screen, the NVIDIA driver failed to load or Nouveau is still active. Boot into recovery mode or a virtual console, then check whether the NVIDIA module is loaded:

lsmod | grep nvidia

If this shows no output, the NVIDIA driver did not load. Loaded systems usually show module names such as nvidia, nvidia_modeset, and nvidia_drm.

Next, check DKMS status:

sudo dkms status

A healthy DKMS entry ends with : installed for the active kernel. If the driver shows as added, built, unbuilt, or failed for the running kernel, rebuild it:

sudo dkms autoinstall

After the rebuild, run sudo dkms status again and confirm the entry ends with : installed.

If you see Nouveau loading instead of NVIDIA, blacklist it permanently:

printf '%s\n' \
'blacklist nouveau' \
'options nouveau modeset=0' \
| sudo tee /etc/modprobe.d/blacklist-nouveau.conf > /dev/null

Rebuild your initramfs and reboot:

sudo update-initramfs -u
sudo reboot

nvidia-smi Command Missing After Installation

The nvidia-smi command comes from NVIDIA utilities packages. If the driver loads but nvidia-smi is missing, check whether a matching utilities package is installed:

command -v nvidia-smi || true
dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 'nvidia-utils*' 2>/dev/null | grep '^ii' || true

For desktop drivers, install the utilities package matching your branch:

sudo apt install nvidia-utils-<version>

For server drivers, use the matching server utilities package instead:

sudo apt install nvidia-utils-<version>-server

If nvidia-smi exists but reports No devices were found, the utilities package is present but the driver is not bound to the GPU. Check Secure Boot, DKMS status, and loaded NVIDIA modules before reinstalling random driver branches.

DKMS Build Failures After Kernel Updates

If DKMS fails to rebuild drivers after a kernel update, ensure kernel headers match your running kernel:

uname -r

The output is your active kernel version. Install headers for that exact value before rebuilding NVIDIA modules:

sudo apt install linux-headers-$(uname -r)

Then force DKMS to rebuild:

sudo dkms autoinstall
sudo update-initramfs -u

Remove Ghost “Unknown Display” Entries

Some GNOME installs display an extra “Unknown Display” entry after switching driver branches because stale monitor layout files linger in your profile or in GDM’s configuration. Delete those layout files so GNOME regenerates them with the active displays:

rm -f ~/.config/monitors.xml
sudo rm -f /var/lib/gdm3/.config/monitors.xml

Log out and back in (or restart GDM on multi-user systems) so GNOME creates a fresh layout without the phantom monitor. Repeat the user-specific removal command for any additional desktop accounts affected by the ghost entry.

Restore Wayland on the Login Screen

If Wayland disappears as a session option, edit the GDM configuration file:

sudo nano /etc/gdm3/custom.conf

Find the line WaylandEnable=false and change it to WaylandEnable=true, or uncomment it if already set to true. Save the file with Ctrl+O and exit with Ctrl+X. Then neutralize GDM’s old udev rule and reboot:

sudo ln -sf /dev/null /etc/udev/rules.d/61-gdm.rules
sudo reboot

Stabilize Wayland Sessions with NVIDIA

Wayland behaves best on GNOME 46 and NVIDIA driver 555 or newer. Edit the GRUB configuration file:

sudo nano /etc/default/grub

Find the line containing GRUB_CMDLINE_LINUX and add the parameters nvidia-drm.modeset=1 nvidia-drm.fbdev=1 inside the quotes. For example:

GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1 nvidia-drm.fbdev=1"

Save the file, then update GRUB and reboot:

sudo update-grub
sudo reboot

Verify the proprietary EGL bindings are installed. Ubuntu 24.04’s packages include libnvidia-egl-wayland1, but you can reinstall it if Wayland keeps falling back to Mesa (skip this step if you installed NVIDIA 555+ runfiles because they already provide the library):

sudo apt install libnvidia-egl-wayland1

Chrome, Chromium, and Electron apps (VS Code, Slack, etc.) may still default to XWayland. Enable the Wayland Ozone backend by setting the “Preferred Ozone platform” flag to “Wayland” or launching Electron apps with --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto.

Disable Problematic GSP Firmware (Optional)

Preview NVIDIA drivers occasionally enable GSP firmware that hurts responsiveness. Check whether GSP is active:

nvidia-smi -q | grep "GSP Firmware"

If a version number appears (instead of N/A), edit the GRUB configuration file:

sudo nano /etc/default/grub

Add nvidia.NVreg_EnableGpuFirmware=0 inside the quotes on the GRUB_CMDLINE_LINUX line, then save the file and apply the changes:

sudo update-grub
sudo reboot

Fix Suspend or Resume Artifacts

Systems that resume to flickering displays often lack the Preserve Video Memory Allocations parameter. Edit the GRUB configuration file:

sudo nano /etc/default/grub

Add nvidia.NVreg_PreserveVideoMemoryAllocations=1 inside the GRUB_CMDLINE_LINUX quotes, save the file, then apply the changes and reboot:

sudo update-grub
sudo reboot

After rebooting, verify the setting is active:

cat /proc/driver/nvidia/params | grep PreserveVideoMemoryAllocations

Expected output confirming the setting is enabled:

PreserveVideoMemoryAllocations: 1

Confirm NVIDIA Drivers Work on Ubuntu

After installing NVIDIA drivers and rebooting, verify the installation from the terminal first, then use the NVIDIA GUI tools if you need display or performance tuning options.

Check NVIDIA Drivers via Terminal

First, confirm which kernel module version is loaded:

cat /proc/driver/nvidia/version

The output should include an NVRM version line for the loaded NVIDIA branch and a GCC version line for the compiler used to build the module.

Then, use nvidia-smi to see GPU utilization, memory usage, and driver status:

nvidia-smi

The output should include Driver Version, CUDA Version, and a row for your GPU. The CUDA value in nvidia-smi is the driver’s maximum CUDA runtime compatibility, not proof that the CUDA Toolkit is installed.

If you have a laptop with NVIDIA Optimus technology (hybrid Intel + NVIDIA graphics), you may need to switch to NVIDIA mode with prime-select before nvidia-smi works. Install nvidia-prime and the X.Org input driver stack first so the login screen keeps keyboard and mouse input after the switch.

sudo apt install nvidia-prime xserver-xorg-input-all
sudo prime-select nvidia
sudo reboot

If your keyboard and mouse freeze after rebooting, access recovery mode by holding Shift during boot, select “Advanced options,” choose “recovery mode,” then “Drop to root shell.” Switch back to Intel graphics, reboot, install the input drivers, and retry:

sudo prime-select intel
sudo reboot

For a broader graphical overview, install GPU Viewer on Ubuntu to monitor GPU metrics, temperatures, and utilization.

Access NVIDIA Settings GUI

Install and launch the NVIDIA settings GUI if you need display layout, OpenGL, or performance configuration options:

sudo apt install nvidia-settings
nvidia-settings

You can also open it from Activities > Show Applications > NVIDIA X Server Settings.

The NVIDIA settings GUI displays your GPU configuration, information, and customizable settings. From here, you can adjust display settings, manage performance profiles, and configure advanced driver options.

NVIDIA Driver References and Support Links

Use these references for upstream driver documentation, branch information, and community support when troubleshooting or planning upgrades:

Conclusion

Your Ubuntu system now has NVIDIA drivers installed and verified working, whether you used the default repository, the graphics-drivers PPA, the CUDA repository, or the desktop GUI workflow. From here, you can install CUDA Toolkit on Ubuntu, install the HWE kernel on Ubuntu for newer hardware support, or install GPU Viewer on Ubuntu to monitor temperatures and utilization.

Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

6 thoughts on “How to Install NVIDIA Drivers on Ubuntu 26.04, 24.04 and 22.04”

  1. Just as a heads-up after rebooting I could not get to nvidia-smi so I did (DO NOT ENTER THIS COMMAND YET) sudo prime-select nvidia. And after rebooting again I couldn’t use my mouse or keyboard, found a solution here:
    https://forums.developer.nvidia.com/t/ubuntu-22-04-2-lts-nvidia-525-105-17-hangs-on-login-screen/249679

    Which basically is doing: sudo apt-get install xserver-xorg-input-all
    Then do “sudo prime-select nvidia” and reboot

    NOTE: If after reboot your mouse and keyboard are not responding enter in recovery mode (select to open a shell) and switch back to intel “sudo prime-select nvidia” then do the steps above.

    Reply
    • Thanks for sharing this, Alexouwu. Your case matches an Optimus setup where switching to NVIDIA mode before installing input drivers can leave the keyboard and mouse unresponsive.

      Install the full X.Org input stack, then switch to NVIDIA and reboot:

      sudo apt install xserver-xorg-input-all
      sudo prime-select nvidia
      sudo reboot

      If input is frozen after reboot, use recovery mode, drop to a root shell, switch back to Intel graphics, reboot, install the input package, then retry the NVIDIA switch:

      sudo prime-select intel
      sudo reboot

      The verification section now includes this Optimus prerequisite to prevent others from hitting this issue. Thanks for surfacing it!

      Reply
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: