Nvidia drivers don't work but nouveau does

I am running Ubuntu 24.04 on a Lenovo 15ach6h with an rtx 3060 mobile

I installed the latest Nvidia drivers on windows and when i tried to boot into Ubuntu the Nvidia drivers there stopped working. I had been using Nvidia driver version 570 on Ubuntu. So I tried uninstalling the Nvidia drivers on Ubuntu and my GPU worked again but with nouveau drivers. Then I tried installed Nvidia driver 570 on Ubuntu and the GPU would once again not work.

I solved the issue by installing the server version of the drivers running sudo ubuntu-drivers install Nvidia:570-server-open

It seems there is a bug with the Nvidia drivers in Ubuntu so I had to uninstall them like this NVIDIA drivers installation - Ubuntu Server documentation and install them from the Nvidia website