Error installing NVIDIA drivers on Ubuntu

Hi @generix,
I am facing a similar problem to this thread and would appreciate if you can help me solve it. I want to install the nvidia driver but I receive this error
update-initramfs: Generating /boot/initrd.img-6.5.0-17-generic
Errors were encountered while processing:
nvidia-dkms-515
nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)
if I run: sudo dpkg --configure -a
I get this issue:

Setting up nvidia-dkms-515 (515.105.01-0ubuntu1) …
update-initramfs: deferring update (trigger activated)

A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau
from loading. This can be reverted by deleting the following file:
/etc/modprobe.d/nvidia-graphics-drivers.conf

A new initrd image has also been created. To revert, please regenerate your
initrd by running the following command after deleting the modprobe.d file:
/usr/sbin/initramfs -u


*** Reboot your computer and verify that the NVIDIA graphics driver can ***
*** be loaded. ***


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-515.105.01 DKMS files…
Deleting module nvidia-515.105.01 completely from the DKMS tree.
Loading new nvidia-515.105.01 DKMS files…
Building for 6.5.0-17-generic
Building for architecture x86_64
Building initial module for 6.5.0-17-generic
ERROR: Cannot create report: [Errno 17] File exists: ‘/var/crash/nvidia-dkms-515.0.crash’
Error! Bad return status for module build on kernel: 6.5.0-17-generic (x86_64)
Consult /var/lib/dkms/nvidia/515.105.01/build/make.log for more information.
dpkg: error processing package nvidia-dkms-515 (–configure):
installed nvidia-dkms-515 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-515:
nvidia-driver-515 depends on nvidia-dkms-515 (= 515.105.01-0ubuntu1); however:
Package nvidia-dkms-515 is not configured yet.
I am new to linux and working with gpu is needed… at first I was trying to install cuda 118 but it was conflicting with another version that was not probably uninstalled. After going through many trials and solutions I think managed to clean all installations and I installed nvidia driver (the recommended was nvidia-driver-470) and then followed the steps on the official website to install cuda 11.8

after installing cuda11-8 I found the nvidia drivers were deleted and reverted back to the novoeu version and I am undable to install any nvidia version since
I also attached the make.log file in case it helps… thanks in advance

make.log (137.5 KB)