sudo ubuntu-drivers autoinstall

That fails with

Setting up nvidia-dkms-440 (440.59-0ubuntu0~ ...
update-initramfs: deferring update (trigger activated)
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
Loading new nvidia-440.59 DKMS files...
Building for 5.3.0-40-generic
Building for architecture x86_64
Building initial module for 5.3.0-40-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-440.0.crash'
Error! Bad return status for module build on kernel: 5.3.0-40-generic (x86_64)
Consult /var/lib/dkms/nvidia/440.59/build/make.log for more information.
dpkg: error processing package nvidia-dkms-440 (--configure):
 installed nvidia-dkms-440 package post-installation script subprocess returned error exit status 10

Ok, let's check out /var/lib/dkms/nvidia/440.59/build/make.log:

DKMS make.log for nvidia-440.59 for kernel 5.3.0-40-generic (x86_64)
Mon 17 Feb 2020 12:33:02 PM CST
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-40-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 ;                          \
make -f ./scripts/Makefile.build obj=/var/lib/dkms/nvidia/440.59/build need-modorder=1
clang: error: unsupported option '-dumpspecs'
clang: error: no input files

make oldconfig && make prepare fails with:

Wait a second... It's throwing clang errors under that? See below:


sudo update-alternatives --all

Change everything with clang selected back to gcc

It works. Finally.

  • 1
    Unbelievable. Thanks!
    – athos
    Apr 26 '20 at 3:52
  • I don't see anything with clang or gcc in that menu. Looks like this. i.postimg.cc/6Q8dzH71/update-alternatives.png Jun 22 '20 at 12:59
  • @Deleet There's multiple options in update-alternatives, just press ENTER to leve the non-compiler ones as they are.
    – Aido
    Jun 22 '20 at 15:16
  • 1
    Thanks a lot! I'd changed 2 out of the 3 gcc/clang references before but missed the 3rd. Setting that as well and reinstalling the drivers finally made it work.
    – Fredrik H
    Nov 12 '20 at 10:34
  • Glad I could help! It's a really weird issue.
    – Aido
    Nov 16 '20 at 15:39

I ended up rolling back to the default Kernel (for me, was 5.0.0-32-generic). On this, had no problems installing the Nvidia drivers. Beware that you need to uninstall the later kernels, not merely run an older one. The Nvidia installer will try to use the newest kernel you have installed, not the one you are running, so you have to uninstall the newer ones.

It may work with other newer kernels below 5.7.4 that I originally tried with. I tried with 5.4.48 (the latest of the LTS kernel) but this gave an unusual green screen of death when booting.

enter image description here

  • This issue's been plaguing me for at least the last 6 years, long before kernel 5.0.0. It could be that things don't have to be rebuilt on the default kernel or you could simply have a different issue.
    – Aido
    Jun 22 '20 at 15:19
  • Did you check the log it directed you to?
    – Aido
    Jun 22 '20 at 15:20
  • Yes, it goes to this bug (in OP). It's a kernel driver incompatibility problem. Jun 22 '20 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.