Removing Nvidia Drivers on CentOS 7 for Upgrading

Phillip Lakis
3 min readDec 14, 2017

--

Simply just installing a new driver on linux does not work 100% of the time, A best practise would be to completely remove the old driver first to prevent conflicts and issues. There are times when I have tried to simply upgrade and gotten the

# failed to initialize nvml driver/library version mismatch

After installing and there are instances where simply installing the new driver has worked.

To avoid problems I have resorted to simply removing the old driver first every time and since then I have never encountered an issue.

This guide is intended to be executed over SSH, As you are required to disable the GUI and some users may not be very comfortable. In any case if you are not familiar in Terminal/SSH I recommend contacting a professional to to this.

Find Your Current Driver

We need to temporarily disable desktop manager ( if you ar running kdm that updated the below command with kdm ):

# modinfo nvidia
version: 331.11

Now we have the version number, Nvidia stores its driver in the following way — http://us.download.nvidia.com/XFree86/Linux-x86_64/XXX.XX/NVIDIA-Linux-x86_64-XXX.XX.run
By knowing both the above we can download the old driver to uninstall correctly.

# wget http://us.download.nvidia.com/XFree86/Linux-x86_64/331.11/NVIDIA-Linux-x86_64-331.11.run
# bash NVIDIA-Linux-x86_64-331.11.run --uninstall
Verifying archive integrity... OK

Continue through the process to uninstall.

Disable Desktop Manager

We need to temporarily disable desktop manager ( if you ar running kdm that updated the below command with kdm ):

# systemctl disable gdm

Now reboot your system. Next time your system boots it will boot to terminal only with no GUI. As a result it is suggested to take some notes of the bellow commands as you will not be able to access this page with your GUI browser after you reboot:

# reboot

Download NVIDIA Driver

Now we have to download the actual new NVidia driver, We navigate to the /home directory and use wget to download the driver there:

# cd /home
# wget http://us.download.nvidia.com/XFree86/Linux-x86_64/384.98/NVIDIA-Linux-x86_64-384.98.run

NVIDIA Driver Installation

Now we have come to the actual NVidia driver installation. We must install the GCC first then navigate to the /home directory to execute the install:

# yum install gcc kernel-devel kernel-headers
# cd /home
# bash NVIDIA-Linux-x86_64-384.98.run
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.98..................................................

NVidia driver is now installed. If you have not configured your X11 during the driver install you can do it now:

# nvidia-xconfig WARNING: Unable to locate/open X configuration file.New X configuration file written to '/etc/X11/xorg.conf'

As a last step enable again your desktop manager and reboot to GUI with new NVidia driver:

# systemctl enable gdm
# reboot

Test Driver

Now lets test the installation:

# nvidia-smi
NVIDIA-SMI 384.98 Driver Version: 384.98

NVidia driver is now installed.

--

--