5

I have a Lenovo Z70-80 and upgraded the Ubuntu from v20.04 to v22.04.

While upgrading, it showed downloading the latest nvidia-drivers-525 but it could not install. To note, I have

product: GM108M [GeForce 840M] vendor: NVIDIA Corporation

Whenever I try to install the drivers using the following command:

sudo apt install nvidia-driver-525 nvidia-dkms-525

it is throwing the following error:

user@Lenovo-Z70-80:~$ sudo apt install nvidia-driver-525 nvidia-dkms-525
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nvidia-dkms-525 is already the newest version (525.60.11-0ubuntu0.22.04.1).
nvidia-driver-525 is already the newest version (525.60.11-0ubuntu0.22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 3 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-525 (525.60.11-0ubuntu0.22.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-525.60.11 DKMS files...
Deleting module nvidia-525.60.11 completely from the DKMS tree.
Loading new nvidia-525.60.11 DKMS files...
Building for 5.15.0-56-generic
Building for architecture x86_64
Building initial module for 5.15.0-56-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-525.0.crash'
Error! Bad return status for module build on kernel: 5.15.0-56-generic (x86_64)
Consult /var/lib/dkms/nvidia/525.60.11/build/make.log for more information.
dpkg: error processing package nvidia-dkms-525 (--configure):
 installed nvidia-dkms-525 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-525:
 nvidia-driver-525 depends on nvidia-dkms-525 (<= 525.60.11-1); however:
  Package nvidia-dkms-525 is not configured yet.
 nvidia-driver-525 depends on nvidia-dkms-525 (>= 525.60.11); however:
  Package nvidia-dkms-525 is not configured yet.

dpkg: error processing package nvidia-driver-525 (--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.140ubuntu13.1) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-56-generic
I: The initramfs will attempt to resume from /dev/sda9
I: (UUID=b839824a-2800-4868-b38c-064d54ed0eb9)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-dkms-525
 nvidia-driver-525
E: Sub-process /usr/bin/dpkg returned an error code (1)

The command nvidia-smi gives the following output

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Can anyone let me know what else can be done to get the latest drivers installed and get them working?

Thank you.

3
  • Try switching GPU to nvidia, sudo prime-select nvidia and reboot. Commented Dec 23, 2022 at 2:41
  • This is the problem : 5.15.0-56-generic. I went back to 5.15.0-52-generic and it works.
    – gxtaillon
    Commented Dec 24, 2022 at 0:17
  • working with linux sometimes becomes so awful! one day you wake up and you system doesn't work. you don't know why! event you didn't update the system. nothing wrong you did but your system shows you a black screen! it might take you several days (and with very good documents!!!) best solution is to re-install your OS. it's worth thing about unix like systems. Commented Jan 15 at 10:31

3 Answers 3

4

In my case, the issue was with wrong GCC compiler version. This is how I found out:

  1. Downloading an installer from https://www.nvidia.com/Download/index.aspx?lang=en-us

  2. Running the installer

  3. When the installer fails, it creates a log under /var/log/nvidia-installer.log. Reading the log revealed the error:

    warning: the compiler differs from the one used to build the kernel
      The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-3ubuntu1) 12.2.0
      You are using:           cc (Ubuntu 10.4.0-5ubuntu2) 10.4.0
    
    Warning: Compiler version check failed:
    
    The major and minor number of the compiler used to
    compile the kernel:
    
    x86_64-linux-gnu-gcc-12 (Ubuntu 12.2.0-3ubuntu1) 12.2.0, GNU ld (GNU Binutils for Ubuntu) 2.39
    
    does not match the compiler used here:
    
    cc (Ubuntu 10.4.0-5ubuntu2) 10.4.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    
    It is recommended to set the CC environment variable
    to the compiler that was used to compile the kernel.
    

Based on the error, changing the GCC version back to 12 in my system configs and running the command:

sudo apt install nvidia-driver-525

led to a successful installation.

1
  • 1
    How to change GCC version?
    – Crantisz
    Commented Jan 12 at 8:15
1

Remove all the nvidia packages... then update the kernel...

sudo update-initramfs -u

reboot...

install the driver again:

sudo apt install nvidia-driver-525

(do not add anything else)

It should be working after that... Pay special attention as to whether the initramfs built and finished. If it did not, you have to manually rebuild it again or possibly the machine will not boot.

4
  • 1
    Hi @sean, I tried the above (updated kernel to v5.19.17. I am still getting the error while installing the drivers. /var/lib/dkms/nvidia/525.60.11/build/make.log contain the following: >>>> 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.<<<< Commented Dec 27, 2022 at 17:55
  • @UreshKuruhuri Confirm that you have the headers that match: (run these) uname -r Then do, apt search linux-headers-$(uname -r) Optionally, or if they're not installed... apt install linux-headers-$(uname -r) Make sure they're there. That's about the only thing that could be missing and keeping it from working. It should build nvidia modules in ls -la /lib/modules/$(uname -r)/updates/dkms/nvidia Also make sure, build-essential is installed if you do not know it.
    – sean
    Commented Dec 28, 2022 at 0:53
  • 1
    uname -r returned 5.19.17-051917-generic. Also apt search linux-headers-$(uname -r) returned linux-headers-5.19.17-051917-generic/now 5.19.17-051917.202210240939 amd64 [installed,local] Linux kernel headers for version 5.19.17 on 64 bit x86 SMP. I then tried sudo apt install linux-headers-$(uname -r) and I observed these on the console Building initial module for 5.19.17-051917-generic ERROR (dkms apport): kernel package linux-headers-5.19.17-051917-generic is not supported Error! Bad return status for module build on kernel: 5.19.17-051917-generic (x86_64). Commented Dec 29, 2022 at 3:31
  • Also tried installing build-essential and I see build-essential is already the newest version (12.9ubuntu3). Commented Dec 29, 2022 at 3:35
1

sudo mv /var/lib/dpkg/info/nvidia-dkms-535* /tmp

sudo dpkg --configure -a

Worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .