dpkg: error processing package nvidia-driver after install ubuntu 20.10

After install ubuntu 20.10 the nvidia drive was throwing errors on each usages / update I am always receiving the following error

Error! Bad return status for module build on kernel: 5.8.0-55-generic (x86_64) Consult /var/lib/dkms/nvidia/460.80/build/make.log for more information.

and in the make.log

ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it.

I tried to locate autoconf.h files but could not find it

this error happens almost on every update also when I tried to

sudo apt-get install linux-headers-$(uname -r) or any install of new nvidia drivers or the dpkg packages

I waited patiently to upgrade to 21.04 - but I was not able to upgrade from the same reason

I run sudo apt upgrade received the followin error

Errors were encountered while processing: postfix nvidia-dkms-460 evdi-dkms nvidia-driver-460 nvidia-driver-455

I tried to install it from the software updates I received enter image description here

I tried several solutions https://forums.developer.nvidia.com/t/nvidia-dkms-460-error/173424/25 https://www.reddit.com/r/pop_os/comments/n59ksz/dkms_errors_with_nvidiadkms460/ non worked

dkms status

evdi, 1.7.0: added
evdi, 1.9.1: added
evdi, 5.2.14, 5.3.0-53-generic, x86_64: installed
nvidia, 460.80: added

uname -r

5.11.0-18-generic

dpkg -l | grep nvidia

ii  libnvidia-cfg1-460:amd64                   460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-460                       460.80-0ubuntu0.21.04.2                                              all          Shared files used by the NVIDIA libraries
ic  libnvidia-compute-390:amd64                390.132-0ubuntu0.18.04.1                                             amd64        NVIDIA libcompute package
rc  libnvidia-compute-390:i386                 390.132-0ubuntu0.18.04.1                                             i386         NVIDIA libcompute package
ic  libnvidia-compute-450:amd64                450.80.02-0ubuntu1                                                   amd64        NVIDIA libcompute package
ii  libnvidia-compute-460:amd64                460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA libcompute package
ii  libnvidia-compute-460:i386                 460.80-0ubuntu0.21.04.2                                              i386         NVIDIA libcompute package
rc  libnvidia-compute-460-server:amd64         460.73.01-0ubuntu1                                                   amd64        NVIDIA libcompute package
rc  libnvidia-compute-465:amd64                465.27-0ubuntu0.21.04.2                                              amd64        NVIDIA libcompute package
ii  libnvidia-decode-460:amd64                 460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-460:i386                  460.80-0ubuntu0.21.04.2                                              i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-460:amd64                 460.80-0ubuntu0.21.04.2                                              amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-460:i386                  460.80-0ubuntu0.21.04.2                                              i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-460:amd64                  460.80-0ubuntu0.21.04.2                                              amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-460:amd64                   460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-460:i386                    460.80-0ubuntu0.21.04.2                                              i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-460:amd64                     460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-460:i386                      460.80-0ubuntu0.21.04.2                                              i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-ifr1-460:amd64                   460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA OpenGL-based Inband Frame Readback runtime library
ii  libnvidia-ifr1-460:i386                    460.80-0ubuntu0.21.04.2                                              i386         NVIDIA OpenGL-based Inband Frame Readback runtime library
ic  linux-modules-nvidia-455-5.8.0-29-generic  5.8.0-29.31                                                          amd64        Linux kernel nvidia modules for version 5.8.0-29
ic  linux-modules-nvidia-455-5.8.0-31-generic  5.8.0-31.33                                                          amd64        Linux kernel nvidia modules for version 5.8.0-31
ic  linux-modules-nvidia-460-5.8.0-36-generic  5.8.0-36.40                                                          amd64        Linux kernel nvidia modules for version 5.8.0-36
ic  linux-modules-nvidia-460-5.8.0-40-generic  5.8.0-40.45                                                          amd64        Linux kernel nvidia modules for version 5.8.0-40
ic  linux-modules-nvidia-460-5.8.0-41-generic  5.8.0-41.46                                                          amd64        Linux kernel nvidia modules for version 5.8.0-41
ic  linux-modules-nvidia-460-5.8.0-44-generic  5.8.0-44.50                                                          amd64        Linux kernel nvidia modules for version 5.8.0-44
ic  nvidia-compute-utils-450                   450.80.02-0ubuntu1                                                   amd64        NVIDIA compute utilities
ii  nvidia-compute-utils-460                   460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA compute utilities
rc  nvidia-compute-utils-460-server            460.73.01-0ubuntu1                                                   amd64        NVIDIA compute utilities
rc  nvidia-compute-utils-465                   465.27-0ubuntu0.21.04.2                                              amd64        NVIDIA compute utilities
ic  nvidia-dkms-450                            450.80.02-0ubuntu1                                                   amd64        NVIDIA DKMS package
ic  nvidia-dkms-455                            455.38-0ubuntu0.20.10.1                                              amd64        NVIDIA DKMS package
iF  nvidia-dkms-460                            460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA DKMS package
rc  nvidia-dkms-460-server                     460.73.01-0ubuntu1                                                   amd64        NVIDIA DKMS package
rc  nvidia-dkms-465                            465.27-0ubuntu0.21.04.2                                              amd64        NVIDIA DKMS package
iU  nvidia-driver-460                          460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA driver metapackage
ic  nvidia-kernel-common-450                   450.80.02-0ubuntu1                                                   amd64        Shared files used with the kernel module
ii  nvidia-kernel-common-460                   460.80-0ubuntu0.21.04.2                                              amd64        Shared files used with the kernel module
rc  nvidia-kernel-common-460-server            460.73.01-0ubuntu1                                                   amd64        Shared files used with the kernel module
rc  nvidia-kernel-common-465                   465.27-0ubuntu0.21.04.2                                              amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-460                   460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.16.1                                                             all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            460.73.01-0ubuntu0.21.04.1                                           amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-460                           460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                    0.18build2                                                           all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-460              460.80-0ubuntu0.21.04.2                                              amd64        NVIDIA binary Xorg driver

and when I am trying to upgrade I am receiving the following error enter image description here


A pretty similar, if not the exact same issue, got fixed for me when i upgraded the gcc package. That's the compiler that is actually make-ing and configure-ing and etc. It would also break at the post-install script for nvidia-dkms and wouldn't continue to installing the actual nvidia-driver that i needed.

The fix was running sudo apt install gcc.

That updated the gcc version that was used to run the installation packages, thus no more compilation errors.

The nvidia post where i found this: https://forums.developer.nvidia.com/t/nvidia-dkms-460-error/173424/4

Cheers