Last Updated on 2022-07-29 by Clay
Problem
Recently, when I re-configure my work environment, I install the Nvidia GPU driver. But after installation and reboot, I cannot use nvidia-smi command to get the GPU information. The only one message is:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
I try to install different version by command line and GUI, but they are not the points. Finally, I found I have not use MOK manager correctly, so my driver cannot work
What is MOK?
MOK stands for Machine Owner Key, which is boot process that protects operating system components and drivers.
Of course, it is implemented by BIOS.
We need to create a pair of keys, the private key is used to sign the driver to be allowed to execute, and the public key is used by the MOK system for encryption.
Solution
During the installation of the Nvidia driver, we must have the opportunity to enter our password. If you want to reinstall the driver, you can refer the following command to remove the currently installed nvidia package.
sudo apt purge nvidia-*
Now maybe you want to search the Nvidia driver you can install:
sudo apt search nvidia-driver*
If you find the version you want to use, key in:
sudo apt install nvidia-driver<NVIDIA DRIVER VERSION>
For related apt
command operations, please refer the link at the bottom of the article.
And in case you missed the MOK screen and did not enter the MOK screen on the next reboot, maybe you can execute the following commands to re-do these procedures:
sudo mokutil --import /var/lib/shim-signed/mok/MOK.der
You'll be prompted for your password, and you'll be taken to the MOK screen upon reboot.
Operation steps in MOK screen
- Set the password in the configure secure boot stage, and remember your password
- If you enter the screen of Perform MOK management, please select Enroll MOK > Continue > Yes
- Enter the password at the screen of Enroll the key(s)?
- Select OK to reboot
- After rebooting, use
nvidia-smi
command to check the driver is work.
Hope everyone can successfully load their drivers!
References
- https://unix.stackexchange.com/questions/535434/what-exactly-is-mok-in-linux-for
- https://gist.github.com/bitsurgeon/b0f4440984c9e60dcd8fe8bbc346c029
- https://askubuntu.com/questions/1122855/mok-manager-nvidia-driver-issue-after-cuda-install
Thank you a lot! I’m trying to solve this issue a long time ago and that have worked!
It’s my pleasure
You saved me countless hours brother! Last time I got this I was so pissed off that I installed linux from scratch.
Glad to help~
Thank you so much
Definitely saved my day. thanks
Great! I’m glad to hear that my post was helpful.
Many thanks.
Thierry
You’re welcome!
sudo apt-get purge nvidia-*
sudo apt-get update
sudo apt-get autoremove
and
apt search nvidia ( check latest version)
sudo apt install libnvidia-common-
sudo apt install libnvidia-gl-
sudo apt install nvidia-driver-