Enable NVIDIA Driver Ubuntu: How and Why
In this article
To enable the NVIDIA driver on Ubuntu, you can use either the Software & Updates tool or install it from the terminal with the correct proprietary driver package. This ensures your system uses the NVIDIA GPU for improved performance in graphics and compute tasks.
Background: Why NVIDIA Drivers Matter on Ubuntu
NVIDIA drivers are essential for users who want to leverage the full performance of their NVIDIA GPU. By default, Ubuntu uses open-source drivers like Nouveau, but these offer limited performance and support for modern features. Installing the correct proprietary NVIDIA driver enables hardware acceleration for gaming, machine learning, and graphics rendering. It also ensures better stability and compatibility with newer applications that rely on CUDA or Vulkan support.
How NVIDIA Drivers Work on Linux
NVIDIA Linux drivers are proprietary software packages that provide direct access to the GPU’s capabilities. They include the kernel module (nvidia-kernel), the user-space X server component (nvidia-xserver), and the CUDA toolkit if installed. The driver communicates with the Linux kernel and the display server to manage GPU tasks efficiently. When enabled, the system bypasses the Nouveau driver and routes all GPU operations through the NVIDIA driver stack.
How to Enable NVIDIA Driver on Ubuntu
There are multiple ways to install and enable an NVIDIA driver on Ubuntu. Here are the most common methods:
- Using GUI: Software & Updates
- Open "Software & Updates" from the Ubuntu application menu.
- Go to the "Additional Drivers" tab.
- Select the recommended proprietary driver (e.g., nvidia-driver-535).
- Click "Apply Changes" and wait for the installation to complete.
- Reboot your system to load the new driver.
- Using Terminal
- Open the terminal (Ctrl+Alt+T).
- Update your system:
sudo apt update && sudo apt upgrade. - Install the NVIDIA driver package:
sudo apt install nvidia-driver-XXX(replace XXX with the version number). - Reboot your system:
sudo reboot.
- Using NVIDIA CUDA Toolkit
- Visit the NVIDIA CUDA website.
- Download the corresponding .run or .deb package for your system.
- Install it following the on-screen instructions.
- Ensure the driver is selected during installation.
How to Choose the Right NVIDIA Driver Version
Choosing the right driver version is crucial for stability and compatibility. Here are some guidelines:
- Use the recommended version from the "Software & Updates" tool or the official NVIDIA website.
- Check your GPU model (run
nvidia-smior uselspci | grep VGAin the terminal) to ensure compatibility with the driver version. - For CUDA development, match the driver with the CUDA version you plan to use.
- For gaming or rendering, use the latest stable version (e.g., 535 or newer) for the best performance and support.
Common Problems and How to Fix Them
Users often face issues when enabling or switching NVIDIA drivers. Here are some common problems and solutions:
- Black screen after reboot: This often happens if the Nouveau driver is still loaded. Add
nomodesetto the kernel boot parameters in GRUB or use recovery mode to purge the driver and reinstall. - Driver not detected: Make sure Secure Boot is disabled, or your system is not blocking unsigned kernel modules. Check with
grep -i secure /etc/default/grub. - Performance issues: Ensure the correct driver is active with
nvidia-smi. Reset the driver withsudo nvidia-xconfigand reboot. - Conflicting drivers: Remove old or incompatible drivers with
sudo apt purge nvidia*before reinstalling.
Alternatives to NVIDIA Drivers on Ubuntu
If you prefer not to use NVIDIA’s proprietary drivers, you can stick with the Nouveau open-source driver, but it lacks many modern features and performance benefits. For CUDA or machine learning, no open-source alternative provides the same level of functionality. Some users may also consider switching to AMD GPUs if they want fully open-source support, but that requires a hardware change.
Frequently Asked Questions
Can I use NVIDIA drivers on a system with Optimus technology?
Yes, but you need to configure the system to use the NVIDIA GPU. Tools like bumblebee or prime-select can manage this. For Ubuntu, prime-select nvidia is often sufficient before rebooting.
Will enabling NVIDIA drivers improve gaming performance?
Yes, significantly. NVIDIA drivers enable full GPU acceleration for games, especially when using Proton (Wine) to run Windows games on Linux. They also allow access to NVIDIA-specific features like RTX ray tracing and DLSS.
How do I check which NVIDIA driver is currently active?
Use the command nvidia-smi in the terminal. If it shows your GPU and driver version, the driver is active. If it returns an error, the driver is either not installed or not loaded.
Can I install NVIDIA drivers without internet?
Yes, if you have the .run or .deb package downloaded offline. Follow the installation instructions from the NVIDIA website or use the local file with sudo dpkg -i package.deb and install dependencies with sudo apt install -f.
Are NVIDIA drivers safe to install on Ubuntu?
Yes, as long as you install them from the official NVIDIA website or Ubuntu repositories. Avoid untrusted third-party sources. NVIDIA drivers are stable and widely used on Linux, but always back up your system before making changes.
Do I need to enable the driver every time I reboot?
No. Once installed and properly configured, the NVIDIA driver is loaded automatically at boot. If you encounter issues, ensure Secure Boot is disabled or configured correctly in the BIOS.