Errors were encountered while processing DKMS

Hello everyone.
I am facing trouble with my Ubuntu 22… sometimes its hang and it showed a black screen while the machine is working. I found out some suggestion that i need to update the driver in my laptop.
but i got this error, and installing not complete.:

Errors were encountered while processing:
 nvidia-dkms-515
 nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)

once i check $sudo apt --fix-broken install
i got this output:


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nvidia-dkms-515 (515.86.01-0ubuntu0.22.10.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Removing old nvidia-515.86.01 DKMS files...
Deleting module nvidia-515.86.01 completely from the DKMS tree.
Loading new nvidia-515.86.01 DKMS files...
Building for 5.19.0-26-generic
Building for architecture x86_64
Building initial module for 5.19.0-26-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-s
ource-515.0.crash'
Error! Bad return status for module build on kernel: 5.19.0-26-generic (x86_64)
Consult /var/lib/dkms/nvidia/515.86.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.86.01); 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.140ubuntu17
) ...
update-initramfs: Generating /boot/initrd.img-5.19.0-26-generic
Errors were encountered while processing:
 nvidia-dkms-515
 nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)

then i try to install DKMS $ sudo apt-get install dkms

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
dkms is already the newest version (3.0.6-2ubuntu2).
dkms set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 5 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.86.01-0ubuntu0.22.10.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Removing old nvidia-515.86.01 DKMS files...
Deleting module nvidia-515.86.01 completely from the DKMS tree.
Loading new nvidia-515.86.01 DKMS files...
Building for 5.19.0-26-generic
Building for architecture x86_64
Building initial module for 5.19.0-26-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-515.0.crash'
Error! Bad return status for module build on kernel: 5.19.0-26-generic (x86_64)
Consult /var/lib/dkms/nvidia/515.86.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.86.01); 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 error from a previous failure.
                                Processing triggers for initramfs-tools (0.140ubuntu17) ...
update-initramfs: Generating /boot/initrd.img-5.19.0-26-generic
Errors were encountered while processing:
 nvidia-dkms-515
 nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)

for more information of my device:
dpkg -l |grep nvidia


ii  libnvidia-cfg1-515:amd64                   515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-515                       515.86.01-0ubuntu0.22.10.1               all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-515:amd64                515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA libcompute package
ii  libnvidia-compute-515:i386                 515.86.01-0ubuntu0.22.10.1               i386         NVIDIA libcompute package
rc  libnvidia-compute-520:amd64                520.61.05-0ubuntu1                       amd64        NVIDIA libcompute package
ii  libnvidia-decode-515:amd64                 515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-515:i386                  515.86.01-0ubuntu0.22.10.1               i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-egl-wayland1:amd64               1:1.1.10-1                               amd64        Wayland EGL External Platform library -- shared library
ii  libnvidia-encode-515:amd64                 515.86.01-0ubuntu0.22.10.1               amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-515:i386                  515.86.01-0ubuntu0.22.10.1               i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-515:amd64                  515.86.01-0ubuntu0.22.10.1               amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-515:amd64                   515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-515:i386                    515.86.01-0ubuntu0.22.10.1               i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-515:amd64                     515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-515:i386                      515.86.01-0ubuntu0.22.10.1               i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
rc  linux-objects-nvidia-515-5.19.0-21-generic 5.19.0-21.21+1                           amd64        Linux kernel nvidia modules for version 5.19.0-21 (objects)
ii  linux-objects-nvidia-515-5.19.0-23-generic 5.19.0-23.24+1                           amd64        Linux kernel nvidia modules for version 5.19.0-23 (objects)
ii  linux-signatures-nvidia-5.19.0-23-generic  5.19.0-23.24+1                           amd64        Linux kernel signatures for nvidia modules for version 5.19.0-23-generic
ii  nvidia-compute-utils-515                   515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA compute utilities
iF  nvidia-dkms-515                            515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA DKMS package
iU  nvidia-driver-515                          515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-515                   515.86.01-0ubuntu0.22.10.1               amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-515                   515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.17.1                                 all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            520.61.05-0ubuntu1                       amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-515                           515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                    0.18.2                                   all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-515              515.86.01-0ubuntu0.22.10.1               amd64        NVIDIA binary Xorg driver


$ dpkg-divert --list

diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
diversion of /usr/share/vim/vim90/doc/help.txt to /usr/share/vim/vim90/doc/help.txt.vim-tiny by vim-runtime
diversion of /usr/share/vim/vim90/doc/tags to /usr/share/vim/vim90/doc/tags.vim-tiny by vim-runtime
diversion of /usr/share/aisleriot/cards/bonded.svg to /usr/share/aisleriot/cards/bonded.svg.unbranded by branding-ubuntu
diversion of /usr/share/gnome-mahjongg/themes/postmodern.svg to /usr/share/gnome-mahjongg/themes/postmodern.svg.unbranded by branding-ubuntu
diversion of /bin/sh to /bin/sh.distrib by dash
diversion of /usr/share/aisleriot/pixmaps/baize.png to /usr/share/aisleriot/pixmaps/baize.png.unbranded by branding-ubuntu
diversion of /usr/share/aisleriot/pixmaps/slot.svg to /usr/share/aisleriot/pixmaps/slot.svg.unbranded by branding-ubuntu

$sudo lshw -C display


  *-display UNCLAIMED       
       description: VGA compatible controller
       product: GA107M [GeForce RTX 3050 Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list
       configuration: latency=0
       resources: iomemory:600-5ff iomemory:610-60f memory:5f000000-5fffffff memory:6000000000-60ffffffff memory:6100000000-6101ffffff ioport:4000(size=128) memory:60080000-600fffff
  *-display UNCLAIMED
       description: VGA compatible controller
       product: TigerLake-H GT1 [UHD Graphics]
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 01
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list
       configuration: latency=0
       resources: iomemory:610-60f iomemory:400-3ff memory:6104000000-6104ffffff memory:4000000000-400fffffff ioport:5000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff
  *-graphics
       product: EFI VGA
       physical id: 2
       logical name: /dev/fb0
       capabilities: fb
       configuration: depth=32 resolution=1920,1080

can you help me to fix this issue please

Hello,

I have moved your topic from the Networking category to the Drivers forum for better visibility.

Best,
Tom

I have the same problem. Can anyone help please? I have GeForce RTX 2060 with Max Q Design on my machine.

I ran the following command:
madil@madil-XPS-17-9700:~$ sudo apt install nvidia-driver-520 nvidia-dkms-520

And here is a part of the error trace that I got:

Setting up libnvidia-fbc1-525:i386 (525.60.11-0ubuntu0.22.04.1) …
Processing triggers for gnome-menus (3.36.0-1ubuntu3) …
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for mailcap (3.70+nmu1ubuntu1) …
Processing triggers for desktop-file-utils (0.26-1ubuntu3) …
Processing triggers for initramfs-tools (0.140ubuntu13) …
update-initramfs: Generating /boot/initrd.img-5.15.0-56-generic
Errors were encountered while processing:
nvidia-dkms-525
nvidia-dkms-520
nvidia-driver-525
nvidia-driver-520
E: Sub-process /usr/bin/dpkg returned an error code (1)

I get a similar message when I try to install 520 and 515 versions as well.

hi
I’ve solved this problem by editing the environment variables : you need to put ld library path correctly.
first you need to use bash to edit them
sudo nano .bashrc

then add these two lines:
if [ -z $LD_LIBRARY_PATH ]; then
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/usr/lib
else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/cuda/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/cuda/lib64/stubs
fi
export LD_LIBRARY_PATH

it works with me.
you need to make sure of your library paths.

3 Likes

Ahaan,
Thanks indeed for this. But what do I do after I have done these steps? Install Nvidia driver again? Which one? 515? 520? 525?

you’re welcome.
i installed 525 from additional drivers.

oic. Thanks indeed my friend. Its so nice of you. Stay blessed.

It didn’t work for me even after this. Here is what I got (the error trace).

dpkg: error processing package nvidia-driver-525 (–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.15.0-56-generic
Errors were encountered while processing:
nvidia-dkms-525
nvidia-driver-525
E: Sub-process /usr/bin/dpkg returned an error code (1)
madil@madil-XPS-17-9700:~$

Best regards,
MAdil

I just had a similar problem on 22.04 LTS.
Purging some old linux kernels somehow broke something and any attempt to install any package resulted in an attempt to build the nvidia dkms bits and failing horribly.
Rebooting landed me without any nvidia support, with fallback VGA drivers.

My fix was to:

  • reboot (and ssh from another box to continue, before 800x600 just isn’t enough pixels.)
  • remove all nvidia drivers ( I had 515, 525 and 535 laying around, for whatever reason.)
  • visit /var/lib/dkms. notice there’s a lingering nvidia folder there, with a version subfolder (which happens to be missing a symlink to a related sources folder.)
  • wipe /var/lib/dkms/nvidia folder entirely.
  • install nvidia driver again (I used sudo ubuntu-drivers install, but sudo apt install nvidia-driver-535 or some such should work too.)
  • marvel as the installation succeeds without errors.

I became aware of the /var/lib/dkms/nvidia folder by looking for relevant log files. I had something interesting under /var/crash/nvidia-dkms-535.0.crash, which mentioned Consult /var/lib/dkms/nvidia/535.113.01/build/make.log for more information.

I’m going to forget all of this now, but maybe this will help someone else down the line.

4 Likes

Hi there @Metalbot and a warm welcome to the NVIDIA developer forums!

Thank you for the detailed description, I could not have written it better myself.

A few points to add.

Use of sudo ubuntu-driversis not recommended since this has caused trouble trying to upgrae with newer drivers down the line.

If you do sudo apt purge followed by autoremove and autoclean that should also take care of residual driver pieces in the DKMS subfolders.

I hope this might also help @eh.sas.

Thank you again!

1 Like

Thanks, this was helpful. My machine was messed up by a Ubuntu 22.04 LTS update (I think but not sure), and ubuntu-drivers install plus the usual Debian/Ubuntu package cleanup-

sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
sudo apt-get -f install
sudo apt update && sudo apt upgrade -y
sudo dpkg --configure -a

-Followed by a reboot, got all displays working.

I had the same problem on Ubuntu 24.x LTS while trying to install NVIDIA 550 drivers and couldn’t fix it somehow.

I was getting the error below all the time when trying to purge and autoremove:

Setting up nvidia-dkms-545 (545.29.06-0ubuntuo~gpuz4.04.1) ... update-initramfs: deferring update (trigger activated) 
INFO: Enable nvidia 
DEBUG: Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude 
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put-your_quirks_here 
DEBUG: Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad 
Removing old nvidia-545.29.06 DKMS files... 
Deleting module nvidia-545.29.06 completely from the DKMS tree. 
Loading new nvidia-545.29.06 DKMS files... 
Building for 6.8.0-31-generic 
Building for architecture x86_64 
Building initial module for 6.8.0-31-generic 
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-545.0.crash' 
Error! Bad return status for module build on kernel: 6.8.0-31-generic (x86_64) 
Consult /var/lib/dkms/nvidia/545.29.06/build/make. log for more information. dpkg: error processing package nvidia-dkms-545 (--configure): 
installed nvidia-dkms-545 package post-installation script subprocess returned error exit status 10• opkg: dependency problems prevent configuration of nvidia-driver-545: nvidia-driver-545 depends on nvidia-dkms-545 (<= 545.29.06-11; however: 
Package nvidia-dkms-545 is not configured yet. nvidia-driver-545 depends on nvidia-dkms-545 (>= 545.29.06); however: 
Package nvidia-dkms-545 is not configured yet. dpkg: error processing package nvidia-driver-545 (--configure): 
dependency problems - leaving unconfigured 
No apport report written because the error message indicates its a followup error from a previous failure. 
Processing trigge 
update-initramfs: Generating /boot/initrd, img-6,8,0-31-generic 
Errors were encountered while processing: 
nvidia-dkms-545
E: Sub-process /us/bin/dpkg returned an error code (1)

So steps I have followed are like these:

  • First of all, I wiped “/var/lib/dkms/nvidia” folder just like @Metalbot indicated in his post.

And then,

  • Purged anything related to nvidia drivers:
sudo apt-get purge 'nvidia-*'
sudo apt-get autoremove
sudo apt-get autoclean
  • Removed residual configuration files
sudo dpkg --purge $(dpkg -l | grep nvidia | awk '{print $2}')

There were bunch of leftovers from old drivers, like 510/535/545. So I got rid of them by the codes above.

  • Installed/Re-Installed build-essential and other dependencies
sudo apt-get install build-essential dkms
sudo apt-get install linux-headers-$(uname -r)
  • Installed the drivers I’ve been trying to
sudo apt-get install nvidia-driver-550
  • Rebuilt the initramfs image
sudo update-initramfs -u
  • And rebooted
sudo reboot

and I got it working without any problems afterwards.

Edit:
I’ve done all of that in recovery mode of Ubuntu, from shell with no graphical interface to avoid any gpu usage by nvidia drivers.

6 Likes

I followed the same steps what mentioned the above I try to install nvidia-530.30.02 but till I cant able to install the driver the error is


pls any one help me

Thanks! The cleanup commands worked great for my hard time stuck on commandline after a system update, had to reinstall nvidia-drivers after that, by the way for me it only worked getting into graphical interface by doing ONLY THE CLEANUP COMMANDS and then installing nvidia drivers :)

This worked a treat thank you

I have had the same issue on Linux Mint 21.3 Cinnamon. I have been trying to install any of the Nvidia drivers available to me with my current kernel (545, 535, 470, 390). I was getting the following error when trying to install the 545 driver:

dpkg: error processing package nvidia-driver-545 (–configure):
dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.26+mint3+victoria) …
Processing triggers for initramfs-tools (0.140ubuntu13.4) …
update-initramfs: Generating /boot/initrd.img-5.15.0-118-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/vgmint-swap_1)
I: Set the RESUME variable to override this.
Processing triggers for gnome-menus (3.36.0-1ubuntu3) …
Processing triggers for libc-bin (2.35-0ubuntu3.8) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for mailcap (3.70+nmu1ubuntu1) …
Errors were encountered while processing:
nvidia-dkms-545
nvidia-driver-545
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried doing the process that @furkanzdm suggested. I was able to remove the Nvidia dkms and drivers just fine, as well as purge the residual configuration files. Then, I reinstalled the build-essential and other dependencies.

However, when I try to install Nvidia-driver-545, I continue to get the same error. I have tried several ways of fixing this error including following the methods here: Fix ”sub-process /usr/bin/dpkg returned an error code (1)" (except the last method, I didn’t have the file in my directory apparently.)

I got another error while trying to do the “sudo apt update && sudo apt update” command:

Error! Bad return status for module build on kernel: 5.15.0-118-generic (x86_64)
Consult /var/lib/dkms/nvidia/545.29.06/build/make.log for more information.
dpkg: error processing package nvidia-dkms-545 (–configure):
installed nvidia-dkms-545 package post-installation script subprocess returned
error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-545:
nvidia-driver-545 depends on nvidia-dkms-545 (<= 545.29.06-1); however:
Package nvidia-dkms-545 is not configured yet.
nvidia-driver-545 depends on nvidia-dkms-545 (>= 545.29.06); however:
Package nvidia-dkms-545 is not configured yet.

I looked up the log it suggests in the second line and it gave me this suggestion:

DKMS make.log for nvidia-545.29.06 for kernel 5.15.0-118-generic (x86_64)
make[1]: Entering directory ‘/usr/src/linux-headers-5.15.0-118-generic’
test -e include/generated/autoconf.h -a -e include/config/auto.conf || (
echo >&2;
echo >&2 " ERROR: Kernel configuration is invalid.“;
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.”;
echo >&2 " Run ‘make oldconfig && make prepare’ on kernel src to fix it.";
echo >&2 ;
/bin/false)

I’m really not sure how to run the command it suggests. I just got a tutorial message on how to use sudo commands when I tried them…

Does anyone know what next steps I can take? I am pretty out of my depth here. Thank you!

it looks like either something is wrong with your kernel or because its an old version that nvidia drivers not compatible. could you try to update your kernel first and try again?

also, could you let us know what gpu do you use just in case?

I updated my kernel to 6.8 and tried again, but kept getting the same error with every NVIDIA driver I tried. I have a NVIDIA GP106M (GeForce GTX 1060 Mobile). I read on other forums that people were having issues installing Nvidia drivers. One of the commenters suggested turning off secure boot since it seems to block Nvidia installs. I turned off my secure boot and I was able to install NVIDIA 535 and 470. I am still unable to install NVIDIA 545, but that’s okay! At least I can use my GPU now instead of the CPU. I did ensure I removed old drivers using the purge, autoremove, and autoclean commands. Thank you for your suggestions!

Glad to hear that your GPU works.

In that case, it might be some compatibility issue with your specific device and drivers. And if you’re on ubuntu or any debian based distro, 535 is the officially supported one. That might be why there’s a compatibility issue occurring.