ubuntu suddenly power off and restart the graphics card driver failure solution (no need to reinstall the driver)

Today the laboratory suddenly tripped, and the graphics card driver was found to be invalid when it was turned on. The nvidia-smidisplay is as follows:

  • NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running

This problem is usually caused by switching to a new kernel version after restarting , so just switch back to it.
You can use it to uname -rcheck the currently used kernel version, and you can use it to dpkg --get-selections | grep linuxcheck which kernel versions are installed
Insert picture description here
. As you can see from the figure, I should start 5.4.0-53 cut back 5.4.0-52 on it

But if the computer has only one ubuntu system, there is no grub selection bar, and it cannot enter the advanced mode to select the recovery mode. It needs to be reconfigured. The online methods are copied and copied, and the quality is not high. The following is mine Solution:

1. Modify the grub configuration file

Open with the following command

sudo gedit /etc/default/grub

Modify several of them as follows (the specific meaning of each item can be viewed with info -f grub -n 'Simple configuration'commands):

GRUB_TIMEOUT_STYLE=hidden
修改为
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=0
修改为
GRUB_TIMEOUT=5

Use this to update after saving and exiting:

sudo update-grub

Then restart and you will see grub, which is something like the following:
Insert picture description here
select the advanced option to enter the interface below, and then select the lower version to enter (the third line in the figure below),
Insert picture description here
and then nvidia-smi will be normal.
To prevent similar situations in the future, you can find software and updates in the settings, and find the updates to disable them.
Insert picture description here
If you want to delete the higher version of the kernel, you can Google this separately.

Guess you like

Origin blog.csdn.net/laizi_laizi/article/details/109825471