How to Install NVIDIA Drivers on Ubuntu 26.04 and 24.04 LTS
Let Ubuntu pick the right driver for your GPU, install it, and reboot. If Secure Boot is on and you are asked for a password, remember it: you need it once on the blue MOK screen at the next boot.
sudo apt update
ubuntu-drivers list
sudo ubuntu-drivers install
sudo reboot
nvidia-smi
Before you start
- Update first. Run
sudo apt update && sudo apt full-upgradeand reboot if a new kernel was installed. Building a driver for a kernel you are about to replace causes trouble. - Identify the GPU.
lspci -nn | grep -i -E 'vga|3d'shows the model. The generation decides which driver flavour works. - Check Secure Boot.
mokutil --sb-state. If it saysSecureBoot enabled, read the Secure Boot section before installing. - Know your way back. Bookmark fix a black screen after installing NVIDIA drivers. You probably won't need it, but you can't open it from a black screen.
Ubuntu 26.04 LTS ships GNOME 50, which runs on Wayland only. The NVIDIA driver supports Wayland well on current branches, but it does mean there is no X11 session to fall back to if the driver fails. Ubuntu 24.04 still offers an "Ubuntu on Xorg" session.
Open vs proprietary kernel modules: which one you need
Every NVIDIA driver package has two parts: a kernel module and the user-space libraries (OpenGL, Vulkan, CUDA). The user-space part is always proprietary. The kernel module comes in two flavours:
| GPU generation | Examples | Package to use |
|---|---|---|
| Blackwell, Ada, Ampere, Turing | RTX 50, RTX 40, RTX 30, RTX 20, GTX 16 | nvidia-driver-XXX-open (default, required for RTX 50) |
| Volta, Pascal, Maxwell | Titan V, GTX 10-series, GTX 900, GTX 750 | nvidia-driver-580 (580 is the last branch for these cards) |
| Kepler and older | GTX 600/700 (most) | No maintained proprietary driver for current kernels: use the built-in nouveau driver |
XXX is the branch number. Ubuntu carries several branches at once; the numbers you see will depend on when you read this, so always go by what ubuntu-drivers list offers for your card rather than a number from a tutorial.
Method 1: ubuntu-drivers (recommended)
List what is available for your hardware:
ubuntu-drivers list
ubuntu-drivers devices
Example output of ubuntu-drivers devices:
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002803sv...
vendor : NVIDIA Corporation
model : AD106 [GeForce RTX 4060 Ti]
driver : nvidia-driver-580-open - distro non-free recommended
driver : nvidia-driver-580 - distro non-free
driver : nvidia-driver-570-open - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
The line marked recommended is what ubuntu-drivers install chooses. To install it:
sudo ubuntu-drivers install
sudo reboot
To install a specific branch instead, name it. The form nvidia:BRANCH lets ubuntu-drivers still pick matching pre-signed modules for your kernel:
sudo ubuntu-drivers install nvidia:580
# or the open flavour explicitly
sudo ubuntu-drivers install nvidia:580-open
Why this beats a plain apt install nvidia-driver-580: ubuntu-drivers also installs the matching linux-modules-nvidia-* package, which contains modules already built and signed by Canonical for your exact kernel. No DKMS compile, no MOK enrollment, and kernel updates bring matching modules automatically.
Graphical way: Additional Drivers
Open Software & Updates → Additional Drivers, pick the entry marked (proprietary, tested) or the open variant your card needs, click Apply Changes and reboot. On Linux Mint, use Driver Manager from the menu; it does the same thing.
Servers and compute-only machines
On a headless server you don't need the desktop components. The --gpgpu option installs the server driver branch without X/Wayland libraries:
sudo ubuntu-drivers install --gpgpu
sudo apt install nvidia-utils-580-server # provides nvidia-smi; match the installed branch
For CUDA development, install the toolkit from the Ubuntu archive (nvidia-cuda-toolkit) or NVIDIA's CUDA repository. If you use NVIDIA's repository, install only the toolkit packages from it and keep the driver from Ubuntu, so the two package sources don't fight over the kernel module.
Secure Boot and MOK enrollment
When Ubuntu cannot use a pre-signed module (for example with a PPA driver or a non-standard kernel), DKMS compiles the module locally and signs it with a Machine Owner Key. The firmware has to trust that key, which takes one manual step:
- During the install, a text dialog asks you to set a Secure Boot password. Choose something simple (8+ characters); you only need it once.
- Reboot. A blue screen titled Perform MOK management appears. It times out after a few seconds, so press a key immediately.
- Choose Enroll MOK → Continue → Yes, type the password, then Reboot.
If you missed the screen, the driver won't load (often a black screen or the low-resolution fallback). Queue the key again and reboot:
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
sudo reboot
Confirm it worked:
mokutil --list-enrolled | grep -i -A1 'subject:'
sudo dmesg | grep -i 'key was rejected'
No Key was rejected lines means the module was accepted.
Verify the driver is working
nvidia-smi
cat /proc/driver/nvidia/version
lspci -k | grep -A3 -i nvidia
Example output of nvidia-smi (trimmed):
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05 Driver Version: 580.95.05 CUDA Version: 13.0 |
| GPU Name Persistence-M | Bus-Id Disp.A | ... |
| 0 NVIDIA GeForce RTX 4060 Ti Off | 00000000:01:00.0 On | ... |
+-----------------------------------------------------------------------------+
lspci -k should show Kernel driver in use: nvidia. If it shows nouveau or nothing, the module did not load; check Secure Boot first, then dkms status.
Laptops with hybrid graphics (Optimus)
Most laptops pair an Intel or AMD integrated GPU with the NVIDIA card. The nvidia-prime package (installed with the driver) controls which GPU renders the desktop:
prime-select query
sudo prime-select on-demand # iGPU for the desktop, NVIDIA on request (default)
sudo prime-select nvidia # everything on NVIDIA, higher power use
sudo prime-select intel # NVIDIA powered off where supported
Log out or reboot after switching. In on-demand mode, GNOME offers Launch using Discrete Graphics Card when you right-click an app, and you can run a program on the NVIDIA GPU from a terminal:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep 'OpenGL renderer'
Steam and many launchers set this automatically.
Switching branches, PPA drivers and upgrades
Switch to another branch
Install the new branch with ubuntu-drivers install nvidia:BRANCH; apt removes the old one automatically because they conflict. Reboot afterwards.
The graphics-drivers PPA
The ppa:graphics-drivers/ppa carries newer branches before they reach the Ubuntu archive. It is useful for a GPU released after your Ubuntu version, but the packages are less tested and always go through DKMS (so you need the MOK step).
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
ubuntu-drivers list
Upgrading Ubuntu
The release upgrader moves you to the matching driver on the new release, and Ubuntu 24.04 to 26.04 upgrades handle NVIDIA systems. If you used a PPA, disable it before upgrading. After an Ubuntu upgrade, run ubuntu-drivers list again: a newer recommended branch may be available. Ubuntu 26.04 builds its initramfs with Dracut instead of initramfs-tools, which you only notice if you rebuild it by hand (sudo dracut --force).
Common problems after installing
| Symptom | Cause and fix |
|---|---|
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver | Module not loaded. Check mokutil --sb-state and sudo dmesg | grep -i nvidia; enroll the MOK or rebuild with sudo dkms autoinstall. |
| Black screen or login loop after reboot | See the black screen fix: boot with nomodeset, purge, reinstall with ubuntu-drivers. |
| Low resolution, only one monitor works | Still running on the fallback driver. lspci -k shows which driver is in use. |
| Screen tearing or stutter in games on 24.04 Xorg | Enable Force Full Composition Pipeline in nvidia-settings, or use the Wayland session. |
| Black screen after suspend | Make sure nvidia-suspend.service and nvidia-resume.service are enabled (systemctl status nvidia-suspend). |
| Driver stops working after a kernel update | With pre-signed modules this shouldn't happen; check that the matching linux-modules-nvidia-* package for the new kernel is installed with apt list --installed | grep linux-modules-nvidia. |
If you need a temporary boot option such as nomodeset or nvidia-drm.modeset=1 while sorting this out, see kernel boot parameters.
Don't use the .run installer
NVIDIA's NVIDIA-Linux-x86_64-*.run file installs outside the package manager. It isn't rebuilt on kernel updates unless you set up DKMS yourself, it collides with Ubuntu's packages, and it is the single most common cause of broken NVIDIA setups on Ubuntu. Every branch you would get from it is available through Ubuntu or the PPA.
Remove the NVIDIA driver
To go back to the open-source nouveau driver:
sudo apt purge '^nvidia-.*' '^libnvidia-.*' '^linux-modules-nvidia-.*'
sudo apt autoremove
sudo reboot
If the screen goes black at any point during this process, the NVIDIA black screen fix shows how to reach a terminal and recover. For problems beyond graphics, the Ubuntu troubleshooting hub lists fixes by symptom. Ubuntu's own reference is the NVIDIA drivers installation page.
Frequently asked questions
Which NVIDIA driver should I install on Ubuntu?
The one ubuntu-drivers marks as recommended. It matches your GPU, picks the open or proprietary kernel module flavour correctly and prefers pre-signed modules that work with Secure Boot.
What is the difference between nvidia-driver-XXX and nvidia-driver-XXX-open?
Both use the same proprietary user-space driver. The -open package uses NVIDIA's open-source kernel module, which is the default for Turing (RTX 20 / GTX 16) and newer GPUs. Older GPUs such as GTX 10-series need the non-open package.
Do I need to disable Secure Boot for NVIDIA drivers on Ubuntu?
No. Either Ubuntu installs pre-signed modules, or you enroll a Machine Owner Key (MOK) once on the blue screen that appears after the next reboot.
Should I use the graphics-drivers PPA?
Only if you need a driver branch newer than Ubuntu provides, for example for a GPU released after your Ubuntu version. The packages in the main archive are tested against Ubuntu's kernels and are the safer choice.
How do I check that the NVIDIA driver is working?
Run nvidia-smi. It should list your GPU and the driver version. In Settings → System → About, the graphics line should name your NVIDIA card.
Spotted a mistake or a command that no longer works? Send a correction — pages are re-checked when reports come in.