Ubuntu18.04:NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver

After I updated the system kernel, I checked whether the graphics card driver can still be used. Sure enough, it can’t be used.

Why do you say no more than no more, you can enter nvcc -V to check:

nvcc -V

So the graphics card driver is still there.

But there is still a problem, so we can only find a way to solve it

1. Install dkms:

sudo apt-get install dkms

2. Check the driver version that the machine cannot connect to:

ls -l /usr/src/

Mine is nvidia-470.129.06

3. Use dkms to reinstall the graphics card driver:

sudo dkms install -m nvidia -v 470.129.06

4. Check whether it is successful

nvidia-smi

Oh, no! failed

It may be a gcc version problem. The graphics card driver I installed is version 470. The gcc version was the initial version 7.5 of ubuntu18.04 when I installed it. I later upgraded to version 9.1.

So I changed the gcc version back to version 7.5, instead of deleting version 9, just modify the priority

5.gcc is in the /usr/bin directory, enter the command to view all versions of gcc:

ls /usr/bin/gcc*
ls /usr/bin/g++*
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100

6. Then you can select different versions of gcc and g++ through the following instructions

sudo update-alternatives --config gcc

 Here select the manual mode gcc-7 is option 1

success!

 

Guess you like

Origin blog.csdn.net/weixin_51995147/article/details/126754175