How to Remove and Reinstall NVIDIA Drivers on Ubuntu

How to Remove and Reinstall NVIDIA Drivers on Ubuntu


This article provides step by step guide to completely remove existing NVIDIA drivers and reinstall specific version of the NVIDIA driver on the Ubuntu system

Prerequisites

  1. Administrative (sudo) access to the Ubuntu system.
  2. Internet access to download the necessary packages.

Steps

  1. Remove Existing NVIDIA Drivers
    First, we need to remove any existing NVIDIA drivers from the system.
    sudo apt-get remove --purge '^nvidia-.*'
  2. Clean Up Unused Packages
    Remove any packages that are no longer needed.
    sudo apt autoremove
    Clean up the local repository of retrieved package files.
    sudo apt autoclean
  3. Remove NVIDIA-related Files
    Next, we need to remove any remaining NVIDIA-related files from various directories.
    sudo rm -rf /usr/local/cuda*
    sudo rm -rf /usr/local/nvidia*
    sudo rm -rf /usr/lib/nvidia*
    sudo rm -rf /usr/include/nvidia*
    sudo rm -rf /etc/systemd/system/nvidia*
  4. Add the Graphics Drivers PPA
    To ensure we have access to the latest drivers, add the graphics drivers PPA (Personal Package Archive).
    sudo add-apt-repository ppa:graphics-drivers/ppa
  5. Update the Package List
    Update the package list to include the latest drivers from the added PPA.
    sudo apt update
  6. Install the Specific NVIDIA Driver Version
    Install the specific version of the NVIDIA driver. In this example, we are installing version 535.161.08-0ubuntu2.22.04.1.
    sudo apt install nvidia-driver-535-server=535.161.08-0ubuntu2.22.04.1
  7. Check the APT Sources 
    Verify the /etc/apt/sources.list file  to ensure all repositories are correctly listed .If not edit your sudo nano /etc/apt/sources.list to ensure the updates and security repositories are enabled. It should contain lines similar to these:
    deb http://archive.ubuntu.com/ubuntu jammy main restricted
    deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted
    deb http://archive.ubuntu.com/ubuntu jammy universe
    deb http://archive.ubuntu.com/ubuntu jammy-updates universe
    deb http://archive.ubuntu.com/ubuntu jammy multiverse
    deb http://archive.ubuntu.com/ubuntu jammy-updates multiverse
    deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu jammy-security main restricted
    deb http://security.ubuntu.com/ubuntu jammy-security universe
    deb http://security.ubuntu.com/ubuntu jammy-security multiverse
  8. Update and Upgrade the System (Optional)
  9. Update and upgrade all packages to ensure the system is up-to-date.
    sudo apt update
    sudo apt upgrade
  10. Install the NVIDIA Driver Again (Optional)
    If needed, reinstall the NVIDIA driver to ensure it's correctly installed.
    sudo apt install nvidia-driver-535-server=535.161.08-0ubuntu2.22.04.1
  11. Reboot the System
    Finally, reboot the system to apply all changes.
    sudo reboot
  12. Verify the Installation
    After rebooting, verify that the NVIDIA driver is loaded and nvidia-smi works.

Conclusion

Following these steps will completely remove any existing NVIDIA drivers and reinstall the specified version on your Ubuntu system. This can help resolve issues related to driver conflicts or corrupt installations.
If you encounter any issues or need further assistance, please consult the official NVIDIA documentation or reach out to your system administrator.

    • Related Articles

    • KB 148484 - Installing NVIDIA Drivers on Ubuntu

      Ubuntu doesn't come with NVIDIA drivers installed by default as they are proprietary and closed-source. This means that you'll have issues like poor performance, displays not working, artifacts etc... while using the FOSS nouveau drivers. Graphical ...
    • KB 090825 - How to Set NVIDIA GPU Power Limit on Ubuntu using nvidia-smi

      Managing the power consumption of your NVIDIA GPU on Ubuntu is a practical way to optimize energy efficiency, especially for workloads that do not require full GPU performance. This guide explains how to check and set power limits for your NVIDIA GPU ...
    • Nvidia Quadro Sync Installation

      The NVIDIA Quadro Sync card is designed as an add-on card for NVIDIA RTX/Quadro series GPUs. The NVIDIA Quadro Sync II card fits into a free PCI Express slot within the system. Hardware Installation Steps to Install the NVIDIA Quadro Sync Card Power ...
    • KB 933073 - Using dmesg and Kernel Module Checks to Troubleshoot NVIDIA GPU Issues

      Overview This article outlines how to use dmesg logs and kernel module commands to diagnose issues where the operating system fails to detect NVIDIA GPUs—even though they appear in the system's BMC (Baseboard Management Controller). When to Use This ...
    • KB 265938 - Nvidia-smi Tool Alert - Troubleshooting Guide

      Purpose This document provides a standardized approach for handling and troubleshooting the Nvidia-smi Tool alert, including L1 and L2 actions, escalation guidelines, and resolution criteria. Alert Name Nvidia-smi Tool Alert Description This alert is ...
    • Recent Articles

    • KB-630208 | How to use Find and Locate to search for files in Linux

      Purpose To provide Linux administrators and Field Engineers with guidance on using the find and locate utilities to efficiently search for files and directories within a Linux filesystem based on criteria such as name, type, size, timestamps, ...
    • KB-630164 | How to use rsync to Synchronize Files

      Purpose To provide a clear and practical procedure for using the rsync utility to synchronize files and directories between local systems and remote hosts, including push and pull operations, while preserving file attributes and optimizing data ...
    • KB-630107 | How to create a Linux swap file

      Purpose To provide Field Engineers and Linux administrators with a standardized procedure for creating, configuring, and validating a Linux swap file. This procedure helps ensure sufficient virtual memory is available when physical RAM is exhausted ...
    • MSI All-in-One (AIO) PC – Physical Damage Policy for Warranty Claims

      MSI All-in-One (AIO) PC – Physical Damage Policy for Warranty Claims MSI's standard warranty does not cover physical or accidental damage to an All-in-One (AIO) PC. If the damage is determined to be caused by external factors rather than a ...
    • KB 134833 - Troubleshooting NVSM Alert NV-CPU-XX – Unrecoverable CPU Internal Error

      Purpose This document provides a general troubleshooting procedure for the NVIDIA System Management (NVSM) alert NV-CPU-XX, which indicates that a CPU has reported an internal error. The article outlines how to verify whether the alert represents an ...
    • Popular Articles

    • CP Plus Camera and NVR Configuration

      NVR Configuration The CP Plus Pro Series of NVRs have been meticulously designed for providing you with upgraded performance and higher recording quality in your IP video surveillance solution. The robust processor that has been inculcated in this ...
    • KB 775235 - Kerberos Authentication – Overview

      What is Kerberos? Kerberos is a secure authentication method used in our Active Directory (AD) environment (mbuzztech.com). It allows users to: Access multiple systems without re-entering passwords (Single Sign-On – SSO) Log in once Where We Use It ...
    • How to Remove and Reinstall NVIDIA Drivers on Ubuntu

      This article provides step by step guide to completely remove existing NVIDIA drivers and reinstall specific version of the NVIDIA driver on the Ubuntu system Prerequisites Administrative (sudo) access to the Ubuntu system. Internet access to ...
    • KB 692001 - Personal Computers and Servers - Classification and Point of Contact

      We can classify the computers that MBUZZ handles based on their form-factor as below: Tower Workstations, Desktops, Gaming PCs and SFF (Small form factor) PCs fall under this category. These are computers people would use on a desk and rarely move. ...
    • KB 298031 - M.2 SSD Tier List

      The sequential read and write speeds, which are usually the most advertised number, are not a proper benchmark of real-world performance or the quality of an SSD. This article categorizes and tiers SSDs based on factors like the type of NAND flash, ...