nvidia driver not detected. Screen is on low resolution

It seems multiple people have trouble with this right now. Myself included, but I managed to fix it. I will give you a long explanation with as much data as possible, although I'm not an expert on Linux. Everything I know is essentially copy pasting code from the internet, hoping it works.

I'm running nvidia gtx 960, 460.39 driver, and dualbooting ubuntu 20.04 with windows 10. No issues on windows. When I boot ubuntu, I immediately experience heavy stuttering, my secondary monitor isn't working and all windows are drawing slowly on screen from top to bottom.

Last time I had this issue (~2 months ago), simple driver reinstall worked for me.

sudo apt install --reinstall nvidia-driver-460

That didn't work for me today. I attempted to purge the drivers with:

sudo apt autoremove --purge nvidia-driver-460 && sudo apt install nvidia-driver-460

But that didn't work either. Using nvidia-smi I got following result:

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

Using sudo dkms status I got following result:

nvidia, 460.39, 5.8.0-45-generic, x86_64: installed (WARNING! Diff between built and installed module!) (WARNING! Diff between built and installed module!) (WARNING! Diff between built and installed module!)

Googling led me to this nvidia forum post, which seems to had the same issues. Coincidentally, the post is less than 20 hours old as of writing this response. From the forum post (specifically comment #7) I used following code:

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

Like a typical trained monkey user, I used those commands without knowing what they do. But after reboot my system works just fine. Hope this helps to somebody.