Nvidia driver 515 installation issues on custom surface kernel

Hey everyone,

when trying to install the nvidia-driver-515 on Ubuntu 22.04 LTS I get the following error message:

update-initramfs: Generating /boot/initrd.img-5.18.16-surface
Errors were encountered while processing:
nvidia-dkms-515
nvidia-driver-515
E: Sub-process /usr/bin/dpkg returned an error code (1)

Secure boot is disabled.

Thanks in advance,

Chris

Processing: nvidia-bug-report.log.gz…

The log upload is stuck, please unzip and attach as text file.

Here’s my report
nvidia-bug-report.log (214.9 KB)

The kernel headers are not installed.

Thanks for your instant reply! I just tried to install them, but this is what i got:

chris@chris-Surface-Laptop-Studio:~$ sudo apt install linux-headers-$(uname -r)
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
linux-headers-5.18.16-surface is already the newest version (5.18.16-surface-1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

After a reboot, the error still persists
nvidia-bug-report.log (215 KB)

The kernel you’re running was built for ubuntu 20.04 with gcc 9, so there might be build problems. Please post the output of
dkms status

chris@chris-Surface-Laptop-Studio:~$ dkms status
acpi-call/1.2.2, 5.15.0-43-generic, x86_64: installed
acpi-call/1.2.2, 5.18.16-surface, x86_64: installed
ithc/0.1, 5.15.0-43-generic, x86_64: installed
ithc/0.1, 5.18.16-surface, x86_64: installed
tp_smapi/0.43, 5.15.0-43-generic, x86_64: installed
tp_smapi/0.43, 5.18.16-surface, x86_64: installed

Looks like the dkms part didn’t get installed at all, please post the output of
dpkg -l |grep nvidia

chris@chris-Surface-Laptop-Studio:~$ dpkg -l |grep nvidia
ii libnvidia-cfg1-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-515 515.65.01-0ubuntu0.22.04.1 all Shared files used by the NVIDIA libraries
ii libnvidia-compute-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA libcompute package
ii libnvidia-compute-515:i386 515.65.01-0ubuntu0.22.04.1 i386 NVIDIA libcompute package
ii libnvidia-decode-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA Video Decoding runtime libraries
ii libnvidia-decode-515:i386 515.65.01-0ubuntu0.22.04.1 i386 NVIDIA Video Decoding runtime libraries
ii libnvidia-egl-wayland1:amd64 1:1.1.9-1.1 amd64 Wayland EGL External Platform library – shared library
ii libnvidia-encode-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVENC Video Encoding runtime library
ii libnvidia-encode-515:i386 515.65.01-0ubuntu0.22.04.1 i386 NVENC Video Encoding runtime library
ii libnvidia-extra-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 Extra libraries for the NVIDIA driver
ii libnvidia-fbc1-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-fbc1-515:i386 515.65.01-0ubuntu0.22.04.1 i386 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-gl-515:amd64 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii libnvidia-gl-515:i386 515.65.01-0ubuntu0.22.04.1 i386 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii linux-modules-nvidia-515-5.15.0-43-generic 5.15.0-43.46+1 amd64 Linux kernel nvidia modules for version 5.15.0-43
ii linux-modules-nvidia-515-generic-hwe-22.04 5.15.0-43.46+1 amd64 Extra drivers for nvidia-515 for the generic-hwe-22.04 flavour
ii linux-objects-nvidia-515-5.15.0-43-generic 5.15.0-43.46+1 amd64 Linux kernel nvidia modules for version 5.15.0-43 (objects)
ii linux-signatures-nvidia-5.15.0-43-generic 5.15.0-43.46+1 amd64 Linux kernel signatures for nvidia modules for version 5.15.0-43-generic
ii nvidia-compute-utils-515 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA compute utilities
rc nvidia-dkms-515 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA DKMS package
ii nvidia-driver-515 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA driver metapackage
ii nvidia-kernel-common-515 515.65.01-0ubuntu0.22.04.1 amd64 Shared files used with the kernel module
ii nvidia-kernel-source-515 515.65.01-0ubuntu0.22.04.1 amd64 NVIDIA kernel source package
ii nvidia-prime 0.8.17.1 all Tools to enable NVIDIA’s Prime
ii nvidia-settings 510.47.03-0ubuntu1 amd64 Tool for configuring the NVIDIA graphics driver
ii nvidia-utils-515 515.65.01-0ubuntu0.22.04.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.65.01-0ubuntu0.22.04.1 amd64 NVIDIA binary Xorg driver

Please install nvidia-dkms-515 manually and post any errors.

sudo apt-get install nvidia-dkms-515
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: nvidia-dkms-515 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/30,7 kB of archives. After this operation, 139 kB of additional disk space will be used. Selecting previously unselected package nvidia-dkms-515. (Reading database ... 256520 files and directories currently installed.) Preparing to unpack .../nvidia-dkms-515_515.65.01-0ubuntu0.22.04.1_amd64.deb ... Unpacking nvidia-dkms-515 (515.65.01-0ubuntu0.22.04.1) ... Setting up nvidia-dkms-515 (515.65.01-0ubuntu0.22.04.1) ... update-initramfs: deferring update (trigger activated) INFO:Enable nvidia DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude Loading new nvidia-515.65.01 DKMS files... Building for 5.18.16-surface Building for architecture x86_64 Building initial module for 5.18.16-surface Secure Boot not enabled on this system. Done.

nvidia.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.18.16-surface/updates/dkms/

nvidia-modeset.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.18.16-surface/updates/dkms/

nvidia-drm.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.18.16-surface/updates/dkms/

nvidia-uvm.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.18.16-surface/updates/dkms/

nvidia-peermem.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.18.16-surface/updates/dkms/

depmod…
Processing triggers for initramfs-tools (0.140ubuntu13) …
update-initramfs: Generating /boot/initrd.img-5.18.16-surface

The restart took way longer due to a failure and also the bug report only ran in --safe-mode
nvidia-bug-report.log (1.4 MB)

So I reinstalled

sudo apt-get install --reinstall linux-image-5.18.16-surface 

and

sudo apt-get install --reinstall linux-headers-5.18.16-surface 

nvidia-bug-report.log (209.8 KB)

On your first attempt when installing nvidia-dkms-515, the kernel modules were compiled (mostly) fine, all you needed to do was to set kernel parameter
ibt=off
to have it load. After reinstalling image and headers, the modules are gone again. Please set the kernel parameter and post the output of
dkms status

Thank you very much for your help. This one did the trick =)