Error! Bad return status for module build on kernel

Hello there

I’m trying to update my nvidia-driver on ubuntu 20.04 to version 510 or 535 (currently 470) but i’m having the following errors regarding my kernel version. I’ve tried many different options to install the drivers but nothing seems to work. The full error i’m having when trying to install 510 driver via apt is this:

INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Removing old nvidia-510.39.01 DKMS files…


Deleting module version: 510.39.01
completely from the DKMS tree.

Done.
Loading new nvidia-510.39.01 DKMS files…
Building for 5.15.0-119-generic
Building for architecture x86_64
Building initial module for 5.15.0-119-generic
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/nvidia-kernel-s
ource-510.0.crash’
Error! Bad return status for module build on kernel: 5.15.0-119-generic (x86_64)
Consult /var/lib/dkms/nvidia/510.39.01/build/make.log for more information.
dpkg: error processing package nvidia-dkms-510 (–configure):
installed nvidia-dkms-510 package post-installation script subprocess returned
error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-510:
nvidia-driver-510 depends on nvidia-dkms-510 (= 510.39.01-0ubuntu1); however:
Package nvidia-dkms-510 is not configured yet.

dpkg: error processing package nvidia-driver-510 (–configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup erro
r from a previous failure.
Processing triggers for initramfs-tools (0.136ubuntu6.
7) …
update-initramfs: Generating /boot/initrd.img-5.15.0-119-generic
Errors were encountered while processing:
nvidia-dkms-510
nvidia-driver-510
E: Sub-process /usr/bin/dpkg returned an error code (1)

My gpu is a geforce gtx 1650 mobile. Any help would be appreciated!