Reinstall NVIDIA drivers for CentOS 7.x

In case someone updates the Kernel on their Linux OS. It is not advised to update the packages on Linux OS unless completely necessary for your work. 

Step-by-step guide

Before you move on from this point, make sure to check if your NVIDIA driver is working using:

nvidia-smi

If it reports anything other than the status/readings of your installed graphics card, it needs to be re-installed; or to boot from an earlier kernel depending how much was done after the initial update/change to your system/OS.

If you have the NVIDIA .run file already

If Exxact originally provided the NVIDIA driver installation, it can be found in either the '/root', '/home', or 'CUDA_INSTALL*" directory.

# login/change to root permissions
su
init 3
./NVIDIA* [tab to fill in the rest]
# accept terms, and answer 'no' to everything else

If it fails to install, then it is possible something beyond updating the kernel was performed that may have installed conflicting packages that will prevent the NVIDIA driver from installing using our typical '.run' file method.


If you need to re-obtain or update the the NVIDIA driver

  • Helps if you do this via SSH from another system to copy/paste the link when using the 'wget' command
  • Requires that you know what Graphics card is installed (the command 'lspci | grep -i NVIDIA' might help identify the model# if you are remote; not guaranteed) 
  1. Visit NVIDIA's driver search website and search for the driver


  2. Click 'download'
  3. Right-click on the 'download' button here, and 'Copy link address' 


  4. On the target computer that needs the NVIDIA driver '.run' file; run this command to download the file from NVIDIA's website:

    # This is an example, please do not just copy/paste the exact contents below... It may not be the correct driver for YOUR graphics card installed
    wget http://us.download.nvidia.com/XFree86/Linux-x86_64/410.73/NVIDIA-Linux-x86_64-410.73.run
  5. Make the file executable using 'chmod +x'

    # This is an example, please do not just copy/paste the exact contents below... It may not be the correct driver for YOUR graphics card installed
    chmod +x http://us.download.nvidia.com/XFree86/Linux-x86_64/410.73/NVIDIA-Linux-x86_64-410.73.run
  6. Disable any GUI-related processes and execute the file

    # login/change to root permissions
    su
    init 3
    ./NVIDIA* [tab to fill in the rest]
    # accept terms, and answer 'no' to everything else

If you need to remove prior NVIDIA installation

You would need to first locate what NVIDIA drivers are installed. Here's a link to help you locate which NVIDIA driver version you have installed.

https://linuxconfig.org/how-to-check-nvidia-driver-version-on-your-linux-system

If you have the original .run' file, you can also just uninstall it using the command below.

./NVIDIA-Linux-x86_64-xxx.xx.run --uninstall

Additionally, the links below elaborate on removing proprietary NVIDIA driver in Ubuntu:


If you are having issues with installing the NVIDIA drivers, or your GUI is broken (like if you need to do 'ctrl+alt+F2 or F3' to get to a working command line), you may want to boot to an earlier kernel and try to remove the newest one since it may have been created when the system was altered/updated.

The below link is for Ubuntu, but the concept is the same. You need to catch the boot grub/kernel selection on CentOS and choose an earlier kernel down on the list. 

http://karlcode.owtelse.com/blog/2017/03/13/reverting-to-a-previous-kernel/