NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver after updating Ubuntu 20.04

I know this is an old thread, but I have faced this issue only after updating to Ubuntu 24 LTS.
Many solutions recommend to turn off Secure Boot, which feels very nonsensical to me. So I kept looking and finally the following sequence worked:
This code, but modified for the 550.120 driver:

sudo dkms remove nvidia/460.39 --all
sudo dkms install --force nvidia/460.39 -k $(uname -r)
sudo update-initramfs -u

But this was not enough, as the MOK util tool was not booting to sign the driver. To trigger the util on reboot, I have followed this solution:

In the second steps (import of key), you need to add the driver mok key to the list. If look carefully through the logs from the dkms reinstall, you will see the location to the key - use that. Set the password, follow rest of steps from solution, reboot. Enroll the keys using the set password and reboot.
After these, the driver works again, and my display is fixed.

My apologies for necroing the post. But thank you so much this solved my problems i’ve been having for half a year with nvidia driver getting unsigned upon kernel update on Ubuntu 24.04LTS