NVIDIA Drivers on Linux: Proprietary, Open Modules, and Nouveau

NVIDIA Drivers on Linux: Proprietary, Open Modules, and Nouveau

NVIDIA on Linux has a reputation, most of it earned in an era that has largely passed. The situation now is workable, and the remaining pain is concentrated in two places: kernel module rebuilds and Secure Boot.

The three options

Proprietary driver. Full performance, CUDA, NVENC encoding, and everything the hardware supports. Closed source, out of tree, and rebuilt for every kernel.

Open kernel modules. NVIDIA now publishes open-source kernel modules, which are the default for recent GPUs on many distributions. They work on Turing and later, with a proprietary userspace component still involved. Distributions are moving to these by default, as Arch has.

nouveau. In the kernel, no installation required, reverse engineered. Adequate for a console and a light desktop, unable to clock modern cards properly, so performance is a fraction of what the hardware can do.

For anything recent, use the proprietary or open modules from your distribution repository.

Installing

# Ubuntu, which detects and recommends
ubuntu-drivers devices
sudo ubuntu-drivers autoinstall

# Fedora, via RPM Fusion
sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda

# Arch
sudo pacman -S nvidia-open-dkms nvidia-utils   # Turing and newer
sudo pacman -S nvidia-dkms nvidia-utils        # older cards

Use the distribution package rather than NVIDIA’s .run installer. The .run file installs outside package management, does not rebuild on kernel updates, and conflicts with packaged versions in ways that are tedious to unpick.

The DKMS problem

The module is built against your running kernel. A new kernel means a new build, done by DKMS or akmods automatically.

When that fails, you reboot into a system with no working display driver. The three usual causes are missing kernel headers, missing DKMS itself, or a driver too old for the new kernel.

# Confirm the build succeeded, before rebooting
dkms status
# nvidia/560.35.03, 6.18.44, x86_64: installed

# Ensure headers are present
sudo apt install linux-headers-$(uname -r)       # Debian and Ubuntu
sudo dnf install kernel-devel-$(uname -r)        # Fedora

Making that check a habit before rebooting after a kernel update prevents most NVIDIA disasters.

Secure Boot

An unsigned kernel module will not load with Secure Boot enabled. The symptom is the driver appearing installed and simply not working.

mokutil --sb-state

Options are to enrol your own key with MOK, which distributions like Ubuntu prompt you through during installation, or to disable Secure Boot. Our Secure Boot explainer covers the tradeoff.

When it goes wrong

Black screen after reboot. Get to a console:

  • Boot the previous kernel from the GRUB menu
  • Or edit the boot entry and add nomodeset
  • Or switch to a TTY with Ctrl-Alt-F3

Then:

dkms status
sudo dmesg | grep -i nvidia
journalctl -b -p err | grep -i nvidia

Verifying it is actually in use:

nvidia-smi                                  # driver and GPU status
glxinfo -B | grep "OpenGL renderer"         # what is rendering
lsmod | grep nvidia

If nvidia-smi reports no devices, the module is not loaded. If glxinfo shows llvmpipe, you are rendering in software.

nouveau conflicting. Both drivers cannot be loaded. Distribution packages blacklist nouveau automatically; if something went wrong:

cat /etc/modprobe.d/blacklist-nouveau.conf

Hybrid laptops

Most laptops with NVIDIA also have integrated graphics, and running the whole desktop on the discrete GPU wastes a great deal of battery.

The sensible arrangement is the desktop on integrated graphics with per-application offload:

prime-run steam                             # Arch and others
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep renderer

envycontrol and optimus-manager automate switching modes. Our power management guide covers the wider battery picture.

Wayland

Support was genuinely poor for years and is not now. Current drivers implement what compositors require, and GNOME having dropped X11 entirely means the old advice to fall back to X11 on NVIDIA is no longer viable anyway.

If you hit issues, check the driver version first. Most remaining NVIDIA-on-Wayland reports concern old driver releases.

Frequently Asked Questions

Which NVIDIA driver should I install?

The proprietary driver from your distribution repository for anything modern, since it gives full performance, CUDA, and encoding support. NVIDIA now also ships open kernel modules which are the default for recent GPUs and work well on Turing and later.

What is nouveau and when is it enough?

The community reverse-engineered driver, in the kernel by default. It is fine for a console, a basic desktop, and older cards, and it cannot clock modern GPUs properly so performance is poor. Use it when the proprietary driver will not install.

Why does my system boot to a black screen after installing the driver?

Usually the module failed to build against the new kernel, or Secure Boot refused to load an unsigned module. Boot the previous kernel from the GRUB menu, or add nomodeset to reach a console and investigate from there.

What breaks NVIDIA drivers on kernel updates?

The module is built out of tree by DKMS against each kernel. If DKMS is missing, the headers for the new kernel are not installed, or the build fails, you reboot into a system with no working driver. Always confirm the build succeeded before rebooting.

Does NVIDIA work on Wayland now?

Yes. Support lagged for years, which is why so many older guides say to use X11, but current drivers implement what compositors need and the major desktops enable Wayland on NVIDIA by default.

How do I use the GPU for compute and the integrated GPU for display?

That is the normal hybrid laptop arrangement, handled by PRIME. Run the desktop on the integrated GPU and offload specific applications with prime-run or the equivalent, which saves considerable battery.