Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Ubuntu Nvidia Driver Install: A Complete Guide

· 6 min read · Home Tech

In this article
  1. Understanding Nvidia Drivers and Ubuntu
  2. How Nvidia Drivers Work: Kernel Modules and Secure Boot
  3. Choosing the Right Driver: Versions and Repositories
  4. Installing Nvidia Drivers: The 'Additional Drivers' Tool
  5. Installing Nvidia Drivers: Command Line (APT)
  6. Common Problems and Troubleshooting
  7. Comparing Methods: 'Additional Drivers' vs. Command Line
  8. Costs and Licensing
  9. Safety Considerations
  10. Alternatives to Nvidia Drivers
  11. Frequently Asked Questions

Installing Nvidia drivers on Ubuntu can seem daunting, but it's a manageable process. The core concept is to leverage Ubuntu's package management system (primarily APT) to install drivers that are either officially provided by Nvidia or available through Ubuntu's repositories. However, the optimal method often depends on your specific Nvidia card, Ubuntu version, and desired driver stability—ranging from the latest bleeding-edge drivers to the more conservative, tested versions.

Understanding Nvidia Drivers and Ubuntu

Nvidia produces proprietary drivers for their graphics cards, optimized for performance and often essential for features like CUDA (for GPU computing) and advanced gaming capabilities. These drivers aren't included in the standard Ubuntu kernel; instead, they're provided as separate packages. Ubuntu offers several ways to obtain and install these drivers: the default 'Additional Drivers' tool, the command line using APT, or directly from Nvidia's website (though this is generally discouraged unless you have a very specific reason).

How Nvidia Drivers Work: Kernel Modules and Secure Boot

Nvidia drivers aren't just about the graphics interface; they're primarily kernel modules. These modules are pieces of code that run within the Linux kernel, allowing the kernel to communicate with the Nvidia GPU. A crucial consideration is Secure Boot, a security feature that prevents unsigned kernel modules from loading. When Secure Boot is enabled, you *must* ensure that the Nvidia driver is signed with a key trusted by your system. Failing to do so will result in the driver not loading, and you’ll likely experience a black screen or a system that fails to boot properly.

Ubuntu handles Secure Boot signing automatically when using drivers from its repositories. However, if you download drivers directly from Nvidia, you’ll need to enroll your own key or disable Secure Boot (not recommended for security reasons).

Choosing the Right Driver: Versions and Repositories

Ubuntu provides a few different driver options, each with its own trade-offs:

  • Nouveau (Open Source): This is the default driver. It's free and open-source, but generally offers significantly lower performance than the proprietary Nvidia drivers. It's a reasonable choice if you don't need maximum performance or CUDA support.
  • Recommended Driver: This is the driver typically suggested by Ubuntu's 'Additional Drivers' tool. It's a stable, tested version, often slightly older than the absolute latest release.
  • Latest Driver: This is the most recent driver available. It may offer the best performance and support for the newest games and features, but it's also more likely to have bugs or compatibility issues.
  • CUDA Drivers: If you're using your GPU for GPU computing with CUDA, you'll need a specific CUDA-enabled driver version. These drivers are often tied to specific CUDA toolkits.

You can find the appropriate driver for your card by searching Nvidia's website or using the 'Additional Drivers' tool in Ubuntu. The tool will list available drivers and their versions. Consider your use case: gaming prioritizes the latest driver, while stability favors the recommended one.

Installing Nvidia Drivers: The 'Additional Drivers' Tool

The easiest method for most users is to use the 'Additional Drivers' tool:

  1. Open the 'Software & Updates' application (search for it in the Ubuntu Activities overview).
  2. Go to the 'Additional Drivers' tab.
  3. Ubuntu will scan your system for available drivers.
  4. Select the desired Nvidia driver from the list. Pay attention to the 'Proposed by Ubuntu' label, which indicates the recommended driver.
  5. Click 'Apply Changes'.
  6. You may be prompted for your password.
  7. After installation, reboot your system.

This method automatically handles Secure Boot signing if your system is configured correctly.

Installing Nvidia Drivers: Command Line (APT)

For more control or if the 'Additional Drivers' tool doesn't work, you can use APT from the command line. First, update your package lists:

sudo apt update

Then, search for available Nvidia driver packages:

apt search nvidia-driver

This will list packages like nvidia-driver-535 (the version number will vary). Install the desired driver:

sudo apt install nvidia-driver-535

Reboot your system after installation.

If you need CUDA support, install the CUDA toolkit and corresponding driver. The exact package names will depend on the CUDA version; consult the Nvidia CUDA documentation.

Common Problems and Troubleshooting

  • Black Screen After Reboot: This is often caused by Secure Boot issues or an incompatible driver. Ensure Secure Boot is enabled if you’re using a signed driver, or disable it temporarily to test. Try booting into recovery mode and uninstalling the driver.
  • Driver Not Loading: Check the system logs (/var/log/syslog or using journalctl) for error messages related to Nvidia. Make sure the kernel modules are loaded correctly (lsmod | grep nvidia).
  • Performance Issues: Ensure you’ve selected the correct driver for your GPU and that the latest kernel updates are installed. Sometimes, a clean reinstall of the driver can resolve issues.
  • CUDA Not Working: Verify that the CUDA toolkit and driver versions are compatible. Check the environment variables (PATH, LD_LIBRARY_PATH) are correctly set.

Comparing Methods: 'Additional Drivers' vs. Command Line

The 'Additional Drivers' tool is generally easier for beginners. It handles dependencies and Secure Boot signing automatically. However, the command line offers more control and flexibility, allowing you to install specific driver versions or troubleshoot issues more effectively. For advanced users or those with specific needs, the command line is often preferred.

Costs and Licensing

The Nvidia drivers themselves are free to use. However, Nvidia's proprietary license restricts redistribution and modification. The CUDA toolkit also has licensing terms that may apply depending on your usage (e.g., commercial vs. academic).

Safety Considerations

  • Ground Yourself: Before opening your computer case to check the GPU, ground yourself to prevent electrostatic discharge (ESD), which can damage components.
  • Power Down: Always power down your computer and unplug it before installing or removing hardware.
  • Compatibility: Ensure the driver version is compatible with your GPU and Ubuntu version.
  • Secure Boot: Be extremely cautious when disabling Secure Boot, as it reduces your system's security.

Alternatives to Nvidia Drivers

  • Nouveau (Open Source): As mentioned earlier, Nouveau is a free and open-source alternative, though it offers lower performance.
  • AMD GPUs: If performance isn't critical, consider using an AMD GPU, which generally has better open-source driver support.

Frequently Asked Questions

How do I know which Nvidia driver version to install?

Use the 'Additional Drivers' tool, which will recommend a driver based on your hardware and Ubuntu version. For CUDA, check the Nvidia CUDA documentation for compatible driver versions. If you are unsure, the 'recommended' driver is usually a safe bet.

What does Secure Boot have to do with Nvidia drivers?

Secure Boot requires that kernel modules (like Nvidia drivers) are digitally signed. Ubuntu automatically handles this when using drivers from its repositories. If you download drivers directly from Nvidia, you’ll need to sign them yourself or disable Secure Boot.

My Nvidia driver isn't working after installing. What should I do?

Check the system logs for error messages. Try booting into recovery mode and uninstalling the driver. Ensure Secure Boot is configured correctly, and that your GPU is properly seated in the PCIe slot.

Can I install multiple Nvidia drivers?

While technically possible, it’s generally not recommended. Having multiple drivers installed can lead to conflicts and instability. Uninstall any previous drivers before installing a new one.

How do I uninstall an Nvidia driver?

You can use the 'Additional Drivers' tool to uninstall the driver, or use the command line: sudo apt remove --purge nvidia-*. Remember to reboot after uninstalling.