Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

nvidia-smi has failed error

📅 2022-Jan-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ nvidia-smi ⬩ 📚 Archive

Problem

I installed a newer version of the nvidia driver successfully. But when I ran nvidia-smi, I got this error:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver

Solution

It seemed like there was a problem with the installed driver kernel modules.

First I removed all the driver modules associated with the current driver version XXX.YY:

$ sudo dkms remove nvidia/XXX.YY --all

Then installed them again to the current kernel:

$ sudo dkms install --force nvidia/XXX.YY -k $(uname -r)

Updated the initramfs of current kernel:

$ sudo update-initramfs -u
$ sync

Restarted the machine and nvidia-smi worked:

$ sudo shutdown -r now