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.

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