Smart Systems for Home

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

How to Stop NVIDIA Drivers from Auto-Upgrading on Ubuntu

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Preventing automatic NVIDIA driver updates on Ubuntu ensures system stability, particularly for users relying on specific versions for gaming compatibility, CUDA development, or avoiding known bugs in newer releases. To achieve this, you must disable the Unattended Upgrades feature for the nvidia packages and optionally hold the package version using APT. This guide provides the precise commands to lock your current driver configuration without breaking your desktop environment.

What You'll Need

  • A running Ubuntu installation with NVIDIA drivers already installed.
  • Terminal access with sudo privileges.
  • The exact name of your currently installed NVIDIA driver package (e.g., nvidia-driver-535).

Step-by-Step

  1. Identify Your Current Driver Package: Open a terminal and run the command dpkg -l | grep nvidia-driver. Look for the line starting with 'ii' which indicates an installed package. Note the full package name, such as nvidia-driver-535 or nvidia-driver-550. You will need this specific string for the next steps.
  2. Hold the Specific Driver Version: Preventing the package manager from upgrading the specific driver is the most critical step. Run the following command, replacing [driver-version] with the name you identified in step 1 (for example, nvidia-driver-535):
    sudo apt-mark hold [driver-version]
    This tells APT to ignore upgrade requests for this specific package, even if new versions are available in the repository.
  3. Disable Unattended Upgrades for NVIDIA: Ubuntu’s Unattended Upgrades service may still attempt to update drivers if not explicitly excluded. First, ensure the unattended-upgrades service is enabled by running sudo systemctl enable unattended-upgrades. Then, edit the configuration file by opening it in a text editor:
    sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
    Locate the section labeled "Unattended-Upgrade::PackageBlacklist". If this section does not exist, add it. Inside the brackets, add the exact name of your NVIDIA driver package followed by a semicolon. For example:
    Unattended-Upgrade::PackageBlacklist {
        "nvidia-driver-535";
    };
    Save the file (Ctrl+O, Enter) and exit (Ctrl+X).
  4. Verify the Hold Status: Confirm that the hold has been applied correctly by running:
    apt-mark showhold
    The output should list your NVIDIA driver package. If it does not, repeat step 2.
  5. Test the Configuration: Perform a dry-run simulation of an upgrade to ensure no NVIDIA packages are targeted. Run:
    sudo apt-get upgrade --simulate
    Review the output. If you see any nvidia-driver packages listed for removal or upgrade, the configuration is not yet complete. Re-check your blacklist and hold status.

Common Mistakes

One frequent error is holding only the main meta-package (like nvidia-driver-535) while ignoring dependent libraries like nvidia-dkms-535 or nvidia-kernel-common-535. These dependencies can sometimes trigger updates that break the driver stack. It is safer to hold the entire family of packages related to your specific driver version. Another mistake is editing the wrong configuration file; always verify you are modifying 50unattended-upgrades and not a generic sources list. Additionally, forgetting to remove the hold when you intentionally want to update later can lead to confusion, so document when you apply these changes.

Tips

If you use multiple NVIDIA cards or have complex setups involving CUDA toolkit versions, consider holding all related nvidia-* packages rather than just the driver. This prevents partial updates where the driver stays old but the runtime libraries update, causing compatibility issues. Regularly check the Ubuntu release notes for major kernel updates, as these often require recompiling DKMS modules. Even with holds in place, a major OS upgrade might force a driver reinstallation, so be prepared to manually intervene during distro upgrades. Using a dedicated script to manage these holds can save time if you frequently change hardware configurations.

Troubleshooting

If your screen goes black after a reboot despite following these steps, the X server or Wayland compositor may have failed to load the correct driver module. Boot into Recovery Mode from the GRUB menu. Select "root drop to root shell prompt" and remount the filesystem as read-write with mount -o remount,rw /. Then, reinstall your held driver using sudo apt install --reinstall [driver-version]. If the issue persists, try switching to the open-source Nouveau driver temporarily by installing xserver-xorg-video-nouveau to regain display access, then investigate the proprietary driver logs in /var/log/Xorg.0.log. If Unattended Upgrades continues to interfere, check for conflicting cron jobs in /etc/cron.daily/ or /etc/systemd/system/ that might be triggering manual updates outside the standard service.

Frequently Asked Questions

Will holding the driver prevent security updates?

No. Holding the nvidia-driver package only prevents the driver binary itself from updating. Security patches for the Linux kernel, glibc, and other system components will still be applied normally through Unattended Upgrades.

Can I update manually later?

Yes. To update manually, first remove the hold with sudo apt-mark unhold [driver-version], perform your standard upgrade with sudo apt upgrade, and then re-apply the hold if you wish to freeze it again at the new version.

Does this work for Wayland sessions?

Yes. The APT hold mechanism operates at the package management level, independent of whether you are using X11 or Wayland. The driver installation process remains the same regardless of the display server.

What if I accidentally upgraded?

If you have already upgraded and the new driver causes issues, you can downgrade by removing the hold, installing the previous version specifically (e.g., sudo apt install nvidia-driver-535=535.104.05-0ubuntu1), and then re-holding it immediately.

Do I need to do this for every NVIDIA package?

You primarily need to hold the main driver meta-package (e.g., nvidia-driver-xxx). However, holding the associated dkms and common packages is recommended to ensure consistency across the entire driver stack.