# Error installing NVIDIA drivers on Ubuntu

**URL:** <https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193>\
**Category:** Linux\
**Tags:** driver, ubuntu, kernel\
**Created:** [October 19, 2022, 12:14am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193 "2022-10-19T00:14:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucascalvet2000](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lucascalvet2000](https://forums.developer.nvidia.com/u/lucascalvet2000)\
**Post date:** [October 19, 2022, 12:14am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/1 "2022-10-19T00:14:14Z")

</div>

Hey! I can’t seem to get the NVIDIA driver on my Ubuntu machine to work. This happened after installing the 6.0 kernel, through Ubuntu Mainline. I’m back at 5.19.11, but can’t install the nvidia driver. I’ve tried many proposed things, but always with the same result. This is the output I get running `sudo apt install nvidia-driver-515`:

```auto
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nvidia-driver-515 is already the newest version (515.76-0ubuntu0.22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nvidia-dkms-515 (515.76-0ubuntu0.22.04.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
Removing old nvidia-515.76 DKMS files...
Deleting module nvidia-515.76 completely from the DKMS tree.
Loading new nvidia-515.76 DKMS files...
Building for 5.19.11-051911-generic
Building for architecture x86_64
Building initial module for 5.19.11-051911-generic
ERROR (dkms apport): kernel package linux-headers-5.19.11-051911-generic is not 
supported
Error! Bad return status for module build on kernel: 5.19.11-051911-generic (x86
_64)
Consult /var/lib/dkms/nvidia/515.76/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.76-1); however:
  Package nvidia-dkms-515 is not configured yet.
 nvidia-driver-515 depends on nvidia-dkms-515 (>= 515.76); however:
  Package nvidia-dkms-515 is not configured yet.

dpkg: error processing package nvidia-driver-515 (--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.140ubuntu13
) ...
update-initramfs: Generating /boot/initrd.img-5.19.11-051911-generic
Errors were encountered while processing:
 nvidia-dkms-515
 nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)

```

OS: Ubuntu 22.04.1 LTS  
Laptop: Lenovo Legion S7 15ACH6  
GPU: Geforce RTX 3060  
CPU: AMD Ryzen 7 5800h

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![generix](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/generix/32/16024_2.png) [@generix](https://forums.developer.nvidia.com/u/generix)\
**Post date:** [October 19, 2022, 10:14am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/2 "2022-10-19T10:14:22Z")

</div>

> [@lucascalvet2000](#):
>
> `/var/lib/dkms/nvidia/515.76/build/make.log`

Please attach it.

---

<div class="post-metadata">

**Author:** ![lucascalvet2000](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lucascalvet2000](https://forums.developer.nvidia.com/u/lucascalvet2000)\
**Post date:** [October 19, 2022, 11:36pm UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/3 "2022-10-19T23:36:00Z")

</div>

Here it is  
[make.log](https://forums.developer.nvidia.com/uploads/short-url/xvnYQ5qqE2BhKjXnU9QIChYVnrg.log) (36.0 KB)

---

<div class="post-metadata">

**Author:** ![generix](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/generix/32/16024_2.png) [@generix](https://forums.developer.nvidia.com/u/generix)\
**Post date:** [October 20, 2022, 7:06am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/4 "2022-10-20T07:06:49Z")

</div>

The kernel was compiled with gcc 12.2 so the headers are incompatible. Please use the liquorix ppa get get a compatible kernel.

---

<div class="post-metadata">

**Author:** ![zolstarym](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@zolstarym](https://forums.developer.nvidia.com/u/zolstarym)\
**Post date:** [October 21, 2022, 8:59pm UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/5 "2022-10-21T20:59:28Z")

</div>

I installed nvidia 515, but it gave the same error (I think) for the 6.0 kernel and won’t work with that.  
But, it is working with kernel 5.19, which seems to also be built with gcc 12.2 . The make.log says that the kernel was built with 12.1.0, but cat /proc/version says 12.2.0 so I don’t know why it would work with one but not the other for me if gcc being version 11 is important. nvidia 520 doesn’t seem to work with either.

Is there a place where I can find the 520 nvidia driver built with a current gcc version so it will work with an up to date kernel?

nvidia driver 515.76  
$ cat /proc/version  
Linux version 5.19.5-051905-generic (kernel@kathleen) (x86\_64-linux-gnu-gcc (Ubuntu 12.2.0-1ubuntu1) 12.2.0, GNU ld (GNU Binutils for Ubuntu) 2.39) #202208291036 SMP PREEMPT\_DYNAMIC Mon Aug 29 10:47:31 UTC 2022

---

<div class="post-metadata">

**Author:** ![dabblerA](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dabblerA](https://forums.developer.nvidia.com/u/dabblerA)\
**Post date:** [February 15, 2024, 10:28am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/6 "2024-02-15T10:28:29Z")

</div>

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](https://forums.developer.nvidia.com/uploads/short-url/bAFkD4jRy49hUpaJM7v9Q6lAhsn.log) (137.5 KB)

---

<div class="post-metadata">

**Author:** ![dabblerA](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dabblerA](https://forums.developer.nvidia.com/u/dabblerA)\
**Post date:** [February 15, 2024, 11:45am UTC](https://forums.developer.nvidia.com/t/error-installing-nvidia-drivers-on-ubuntu/231193/7 "2024-02-15T11:45:39Z")

</div>

Well my problem is now fixed…for anyone if it helps  
I tried to unistall and reinstall again a different version of nvidia …removed nvidia 515 and replaced it with 535 version.

what I used were these commands  
sudo apt update  
sudo apt install nvidia-driver-535  
sudo apt update  
sudo apt install libnvidia-common-515 libnvidia-gl-515 nvidia-driver-515

I am not sure what was the problem but it is working now when I check with  
nvidia-smi or nvcc --version  
both return the expected output of nvidia driver and cuda version

And Using torch is going well also

However I am unaware of the status of the nvidia-dkms-\<version\_number\> package or whether this issue will appear again
