Install NVIDIA Drivers on Ubuntu 26.04: Terminal & GUI Fixes
In this article
Installing the correct NVIDIA drivers on Ubuntu 26.04 ensures your GPU operates at peak performance for gaming, AI workloads, and general desktop acceleration. This guide provides a reliable method to install proprietary drivers via the terminal while offering solutions for common graphical interface failures. Before beginning, ensure you have administrative privileges (sudo access) and that your system is fully updated to avoid dependency conflicts.
What You'll Need
- A Ubuntu 26.04 installation with an active internet connection.
- Administrative (sudo) access to the terminal.
- The exact model of your NVIDIA graphics card (e.g., RTX 3060, GTX 1650).
- A backup of important data, as driver updates can occasionally cause boot issues.
- Patience, as the process involves multiple verification steps.
Step-by-Step
- Update System Repositories: Open your terminal and run
sudo apt update && sudo apt upgrade -y. This ensures your package lists are current and reduces the risk of installing outdated dependencies. Reboot your system if prompted by the kernel upgrade. - Identify Your Graphics Card: Run
lspci | grep -i nvidiain the terminal. Note the exact model name displayed. This prevents you from accidentally installing a driver meant for a different hardware generation. - Check Available Driver Versions: Execute
ubuntu-drivers devices. This command lists recommended proprietary drivers. Look for the line marked "recommended" or choose the latest stable version listed (e.g., nvidia-driver-535 or higher). Avoid using the "proprietary-test" drivers unless specifically required for bleeding-edge features. - Install the Driver: Run
sudo apt install nvidia-driver-XXX, replacing XXX with the version number identified in the previous step (e.g.,nvidia-driver-550). Alternatively, you can use the simpler commandsudo ubuntu-drivers autoinstall, which automatically selects the best available driver for your hardware. - Verify Installation: After the installation completes, reboot your computer using
sudo reboot. Once logged back in, open the terminal and runnvidia-smi. If successful, this command will display a table showing your GPU status, driver version, and CUDA version. If it returns an error, the installation failed. - Fix GUI Issues (If Applicable): If your screen resolution is incorrect or the desktop environment fails to load after reboot, press
Ctrl+Alt+F3to switch to a text console. Log in with your credentials. Stop the display manager by runningsudo systemctl stop gdm3(orlightdmdepending on your flavor). Then, reinstall the driver using the commands above. Restart the display manager withsudo systemctl start gdm3.
Common Mistakes
One frequent error is ignoring blacklisting of the Nouveau driver. Ubuntu uses the open-source Nouveau driver by default. If you do not disable it before installing the proprietary NVIDIA driver, conflicts can occur, leading to a black screen. Another mistake is mixing installation methods; do not mix APT packages with manual .run file installations from the NVIDIA website, as this corrupts the package database. Additionally, users often forget to update their BIOS/UEFI firmware, which can sometimes cause compatibility issues with newer GPUs on older motherboards.
Tips
Always keep a live USB stick handy with a recent Ubuntu installer. If the driver installation breaks your ability to boot into the GUI, you can boot from the USB, chroot into your installed system, and remove the problematic driver. When installing drivers, prefer the repository versions provided by Ubuntu over manual downloads, as they integrate better with the system's security updates and kernel headers. If you use Wayland (the default display server in newer Ubuntu versions), ensure your NVIDIA driver version supports it properly, as some older versions may have limited compositing support.
Troubleshooting
If nvidia-smi shows "NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver," check if the kernel module is loaded by running lsmod | grep nvidia. If it is missing, try loading it manually with sudo modprobe nvidia. If the system boots to a black screen, enter recovery mode from the GRUB menu, drop to a root shell, and uninstall the driver using sudo apt purge *nvidia*. Then, reinstall the generic nvidia-driver-generic package to restore basic functionality. For persistent GUI loops, check the logs at /var/log/Xorg.0.log for errors related to the NVIDIA module. Ensuring your kernel headers are installed (sudo apt install linux-headers-$(uname -r)) is also critical, as missing headers prevent proper driver compilation.
Frequently Asked Questions
Can I use the NVIDIA .run file instead of APT?
Yes, but it is not recommended for most users. The .run files bypass the package manager, making future updates and removals difficult. They can also break after kernel updates. Stick to APT for stability.
Why does my screen go black after installing the driver?
This usually happens because the Nouveau driver was not disabled, causing a conflict with the newly installed proprietary driver. Boot into recovery mode, purge all NVIDIA packages, and ensure the Nouveau module is blacklisted in /etc/modprobe.d/blacklist.conf before reinstalling.
Does Ubuntu 26.04 support Wayland with NVIDIA?
Yes, modern NVIDIA drivers (version 470 and above) have robust Wayland support. However, some older applications may still behave better on X11. You can switch between Wayland and X11 at the login screen by clicking the gear icon.
How do I know if my driver is working correctly?
Run nvidia-smi in the terminal. If it displays your GPU information without errors, the driver is active. You can also check the "Details" section in the Settings > About panel or use the NVIDIA Settings application if installed.
Will updating the kernel break my NVIDIA driver?
Generally, no. Ubuntu’s DKMS (Dynamic Kernel Module Support) automatically recompiles the NVIDIA driver modules when a new kernel is installed. However, if DKMS fails, you may need to reinstall the driver package manually after a major kernel update.