The problem

During the holiday, the training mechanism was closed and GPU related commands could not be executed when I returned:

Nvidia-smi nvTop Nvidia-Docker cannot be executed

Guess and try to solve

Ubuntu kernel update causes incompatibility with existing drivers after restart. So let’s do it again

Sudo apt-get Purge nvidia* # 2 To find the machine graphics kernel sudo cat/proc/driver/nvidia/version # 3. Download the appropriate driver according to the kernel: nvidia-linux-x86_64-440.82. Run # 4. Sudo sh./ nvidia-linux-x86_64-440.82. Run --no-opengl-files --no-x-check # 6 Nvidia-docker sudo apt-get install -y nvidia-docker2Copy the code

This problem has come up before, but this time the solution, still report the same mistake

Location problem

An error message is displayed in /var/log/nvidia-installer.log during driver reinstallation

 error: unrecognized command line option '-fstack-protector-strong'
Copy the code

This error is related to the GCC version, which is too low to support the command option -fstack-protector-strong

To solve the problem

Locating the problem makes it easy to solve

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update 
sudo apt-get install gcc-7
sudo apt-get install g++-7

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100
sudo update-alternatives --config gcc
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 100
sudo update-alternatives --config g++
gcc --version
g++ --version
Copy the code

Finally, reinstall the driver and restart it

/ nvidia-linux-x86_64-440.82. Run --no-opengl-files --no-x-checkCopy the code

To prevent similar errors from being reported during the next restart, the Ubuntu kernel is automatically updated to shut down

Sudo vi/etc/apt/apt. Conf. # d / 10 Periodic from "1" to "0" apt: : Periodic: : Update Package - Lists "0".Copy the code

review

There are many similar problems and solutions on the Internet, but most of them are different from this problem. Think back to how you can solve the problem faster:

  1. It’s as simple as reporting an error message and doing a Google search. If the problem isn’t complicated, you’ll find a solution in most cases.
  2. However, if the search method does not solve the problem, you need to find detailed error logs to locate more specific problems