Error message: "kernel package linux-headers-5.11.0-25-generic is not supported" when installing nvidia-340 driver on 2008 MacBook Pro using fresh install of Ubuntu 20.04.2

Asked by Hazel Malloy

nvidia-340 package fails to install. I need to install it in order to enable sleep function to work on my laptop.

This is a fresh Ubuntu install with everything else working fine. No problems installing other packages, only nvidia-340. I have previously been able to install nvidia-340 with no issues on this same laptop, for same Ubuntu version 20.04.2, on 26 July 2021, as well as on same laptop with a previous Ubuntu (Precise Pangolin). I installed Ubuntu 20.04.2 yesterday (9 Aug 2021) using the same Ubuntu 20.04.2 live DVD that I used before (approx. 7 July 2021).

diagnostics below as requested by Launchpad Answers forum on this web page https://help.ubuntu.com/community/PackageManagerTroubleshootingProcedure

hazel@hazel-MacBookPro:~$ ubuntu-support-status || ubuntu-security-status
ubuntu-support-status: command not found
1701 packages installed, of which:
1640 receive package updates with LTS until 4/2025
  61 could receive security updates with ESM Apps until 4/2030

Enable Extended Security Maintenance (ESM Apps) to get 1 security
update (so far) and enable coverage of 61 packages.

This machine is not attached to an Ubuntu Advantage subscription.
See https://ubuntu.com/advantage
hazel@hazel-MacBookPro:~$ cat /etc/dpkg/dpkg.cfg.d/multiarch
cat: /etc/dpkg/dpkg.cfg.d/multiarch: No such file or directory
hazel@hazel-MacBookPro:~$ dpkg --print-foreign-architectures
i386
hazel@hazel-MacBookPro:~$ sudo grep -R roxy /etc/apt/*
hazel@hazel-MacBookPro:~$ grep roxy /etc/environment
hazel@hazel-MacBookPro:~$ echo $http_proxy

hazel@hazel-MacBookPro:~$ echo $ftp_proxy

hazel@hazel-MacBookPro:~$ grep roxy /etc/bash.bashrc
hazel@hazel-MacBookPro:~$ grep roxy ~/.bashrc
hazel@hazel-MacBookPro:~$ cat /etc/apt/apt.conf
cat: /etc/apt/apt.conf: No such file or directory
hazel@hazel-MacBookPro:~$ sudo ls -la /etc/apt/apt.conf.d/
total 92
drwxr-xr-x 2 root root 4096 Aug 10 08:19 .
drwxr-xr-x 7 root root 4096 Aug 10 14:22 ..
-rw-r--r-- 1 root root 49 Aug 9 18:36 00aptitude
-rw-r--r-- 1 root root 40 Aug 9 18:35 00trustcdrom
-rw-r--r-- 1 root root 630 Apr 9 2020 01autoremove
-r--r--r-- 1 root root 1436 Aug 9 18:49 01autoremove-kernels
-rw-r--r-- 1 root root 92 Apr 9 2020 01-vendor-ubuntu
-rw-r--r-- 1 root root 129 Dec 4 2020 10periodic
-rw-r--r-- 1 root root 108 Dec 4 2020 15update-stamp
-rw-r--r-- 1 root root 604 Jul 27 23:54 20apt-esm-hook.conf
-rw-r--r-- 1 root root 85 Dec 4 2020 20archive
-rw-r--r-- 1 root root 80 Jul 22 2020 20auto-upgrades
-rw-r--r-- 1 root root 243 Dec 16 2009 20dbus
-rw-r--r-- 1 root root 1040 Sep 23 2020 20packagekit
-rw-r--r-- 1 root root 114 Nov 20 2020 20snapd.conf
-rw-r--r-- 1 root root 2592 Jan 19 2020 50appstream
-rw-r--r-- 1 root root 625 Oct 8 2019 50command-not-found
-rw-r--r-- 1 root root 5459 Jul 22 2020 50unattended-upgrades
-rw-r--r-- 1 root root 435 Jan 19 2020 60icons
-rw-r--r-- 1 root root 251 Jan 19 2020 60icons-hidpi
-rw-r--r-- 1 root root 182 Aug 3 2019 70debconf
-rw-r--r-- 1 root root 305 Dec 4 2020 99update-notifier
hazel@hazel-MacBookPro:~$ cat /etc/apt/apt.conf.d/00aptitude
Aptitude::Get-Root-Command "sudo:/usr/bin/sudo";
hazel@hazel-MacBookPro:~$ sudo cat /etc/apt/apt.conf.d/00aptitude
Aptitude::Get-Root-Command "sudo:/usr/bin/sudo";
hazel@hazel-MacBookPro:~$ ls -la /etc/apt/apt.conf.d/00aptitude
-rw-r--r-- 1 root root 49 Aug 9 18:36 /etc/apt/apt.conf.d/00aptitude
hazel@hazel-MacBookPro:~$ view /etc/apt/apt.conf.d/00aptitude
hazel@hazel-MacBookPro:~$ sudo fuser -vvv /var/lib/dpkg/lock
hazel@hazel-MacBookPro:~$ sudo fuser -vvv /var/cache/apt/archives/lock
hazel@hazel-MacBookPro:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
hazel@hazel-MacBookPro:~$ uname -a
Linux hazel-MacBookPro 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
hazel@hazel-MacBookPro:~$ sudo rm /var/lib/apt/lists/lock
hazel@hazel-MacBookPro:~$ sudo rm /var/cache/apt/archives/lock
hazel@hazel-MacBookPro:~$ sudo rm /var/lib/dpkg/lock
hazel@hazel-MacBookPro:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
hazel@hazel-MacBookPro:~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
hazel@hazel-MacBookPro:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status || sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
hazel@hazel-MacBookPro:~$ sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
hazel@hazel-MacBookPro:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
cp: cannot stat '/var/lib/dpkg/available-old': No such file or directory
hazel@hazel-MacBookPro:~$ sudo rm -rf /var/lib/dpkg/updates/*
hazel@hazel-MacBookPro:~$ sudo rm -rf /var/lib/apt/lists
hazel@hazel-MacBookPro:~$ sudo rm /var/cache/apt/*.bin
hazel@hazel-MacBookPro:~$ sudo mkdir /var/lib/apt/lists
hazel@hazel-MacBookPro:~$ sudo mkdir /var/lib/apt/lists/partial
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get clean
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
hazel@hazel-MacBookPro:~$ sudo dpkg --configure -a
Setting up libxnvctrl0:amd64 (470.57.01-0ubuntu0.20.04.1) ...
Setting up screen-resolution-extra (0.18build1) ...
Setting up libc6-i386 (2.31-0ubuntu9.2) ...
Setting up nvidia-settings (470.57.01-0ubuntu0.20.04.1) ...
Setting up libcuda1-340 (340.108-0ubuntu5.20.04.2) ...
Setting up lib32gcc-s1 (10.3.0-1ubuntu1~20.04) ...
Setting up nvidia-340 (340.108-0ubuntu5.20.04.2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-340-340.108 DKMS files...

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.11.0-25-generic
Building for architecture x86_64
Building initial module for 5.11.0-25-generic
ERROR (dkms apport): kernel package linux-headers-5.11.0-25-generic is not supported
Error! Bad return status for module build on kernel: 5.11.0-25-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=2725bc07-c6b4-45f8-872e-abc773be383d)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-340
hazel@hazel-MacBookPro:~$ sudo dpkg --clear-avail
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nvidia-340 (340.108-0ubuntu5.20.04.2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-340-340.108 DKMS files...

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.11.0-25-generic
Building for architecture x86_64
Building initial module for 5.11.0-25-generic
ERROR (dkms apport): kernel package linux-headers-5.11.0-25-generic is not supported
Error! Bad return status for module build on kernel: 5.11.0-25-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=2725bc07-c6b4-45f8-872e-abc773be383d)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-340
E: Sub-process /usr/bin/dpkg returned an error code (1)
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nvidia-340 (340.108-0ubuntu5.20.04.2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-340-340.108 DKMS files...

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.11.0-25-generic
Building for architecture x86_64
Building initial module for 5.11.0-25-generic
ERROR (dkms apport): kernel package linux-headers-5.11.0-25-generic is not supported
Error! Bad return status for module build on kernel: 5.11.0-25-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=2725bc07-c6b4-45f8-872e-abc773be383d)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-340
E: Sub-process /usr/bin/dpkg returned an error code (1)
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [970 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main Translation-en [506 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 DEP-11 Metadata [494 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main DEP-11 48x48 Icons [98.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64 Icons [163 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64@2 Icons [15.8 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [22.0 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/restricted i386 Packages [8112 B]
Get:15 http://archive.ubuntu.com/ubuntu focal/restricted Translation-en [6212 B]
Get:16 http://archive.ubuntu.com/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
Get:17 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [8628 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages [4642 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal/universe Translation-en [5124 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/universe amd64 DEP-11 Metadata [3603 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/universe DEP-11 48x48 Icons [3016 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal/universe DEP-11 64x64 Icons [7794 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/universe DEP-11 64x64@2 Icons [44.3 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [144 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal/multiverse i386 Packages [74.7 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/multiverse Translation-en [104 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 DEP-11 Metadata [48.4 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal/multiverse DEP-11 48x48 Icons [23.1 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal/multiverse DEP-11 64x64 Icons [192 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal/multiverse DEP-11 64x64@2 Icons [214 B]
Get:32 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 c-n-f Metadata [9136 B]
Get:33 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1134 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [517 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [247 kB]
Get:36 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [283 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 48x48 Icons [60.5 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 64x64 Icons [95.0 kB]
Get:39 http://archive.ubuntu.com/ubuntu focal-updates/main DEP-11 64x64@2 Icons [29 B]
Get:40 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [13.9 kB]
Get:41 http://archive.ubuntu.com/ubuntu focal-updates/restricted i386 Packages [19.2 kB]
Get:42 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [367 kB]
Get:43 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [52.9 kB]
Get:44 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 c-n-f Metadata [456 B]
Get:45 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [626 kB]
Get:46 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [844 kB]
Get:47 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [177 kB]
Get:48 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [339 kB]
Get:49 http://archive.ubuntu.com/ubuntu focal-updates/universe DEP-11 48x48 Icons [212 kB]
Get:50 http://archive.ubuntu.com/ubuntu focal-updates/universe DEP-11 64x64 Icons [374 kB]
Get:51 http://archive.ubuntu.com/ubuntu focal-updates/universe DEP-11 64x64@2 Icons [29 B]
Get:52 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [18.4 kB]
Get:53 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [28.7 kB]
Get:54 http://archive.ubuntu.com/ubuntu focal-updates/multiverse i386 Packages [8400 B]
Get:55 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [7092 B]
Get:56 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:57 http://archive.ubuntu.com/ubuntu focal-updates/multiverse DEP-11 48x48 Icons [1865 B]
Get:58 http://archive.ubuntu.com/ubuntu focal-updates/multiverse DEP-11 64x64 Icons [2498 B]
Get:59 http://archive.ubuntu.com/ubuntu focal-updates/multiverse DEP-11 64x64@2 Icons [29 B]
Get:60 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [680 B]
Get:61 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [2568 B]
Get:62 http://archive.ubuntu.com/ubuntu focal-backports/main i386 Packages [2568 B]
Get:63 http://archive.ubuntu.com/ubuntu focal-backports/main Translation-en [1120 B]
Get:64 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [400 B]
Get:65 http://archive.ubuntu.com/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
Get:66 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [5800 B]
Get:67 http://archive.ubuntu.com/ubuntu focal-backports/universe i386 Packages [4736 B]
Get:68 http://archive.ubuntu.com/ubuntu focal-backports/universe Translation-en [2068 B]
Get:69 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [10.3 kB]
Get:70 http://archive.ubuntu.com/ubuntu focal-backports/universe DEP-11 48x48 Icons [2809 B]
Get:71 http://archive.ubuntu.com/ubuntu focal-backports/universe DEP-11 64x64 Icons [5606 B]
Get:72 http://archive.ubuntu.com/ubuntu focal-backports/universe DEP-11 64x64@2 Icons [29 B]
Get:73 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [288 B]
Get:74 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:75 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [792 kB]
Get:76 http://archive.ubuntu.com/ubuntu focal-security/main i386 Packages [270 kB]
Get:77 http://archive.ubuntu.com/ubuntu focal-security/main Translation-en [156 kB]
Get:78 http://archive.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [27.6 kB]
Get:79 http://archive.ubuntu.com/ubuntu focal-security/main DEP-11 48x48 Icons [11.0 kB]
Get:80 http://archive.ubuntu.com/ubuntu focal-security/main DEP-11 64x64 Icons [21.6 kB]
Get:81 http://archive.ubuntu.com/ubuntu focal-security/main DEP-11 64x64@2 Icons [29 B]
Get:82 http://archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [8408 B]
Get:83 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [330 kB]
Get:84 http://archive.ubuntu.com/ubuntu focal-security/restricted i386 Packages [17.9 kB]
Get:85 http://archive.ubuntu.com/ubuntu focal-security/restricted Translation-en [47.6 kB]
Get:86 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 c-n-f Metadata [460 B]
Get:87 http://archive.ubuntu.com/ubuntu focal-security/universe i386 Packages [506 kB]
Get:88 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [635 kB]
Get:89 http://archive.ubuntu.com/ubuntu focal-security/universe Translation-en [98.5 kB]
Get:90 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [60.8 kB]
Get:91 http://archive.ubuntu.com/ubuntu focal-security/universe DEP-11 48x48 Icons [29.9 kB]
Get:92 http://archive.ubuntu.com/ubuntu focal-security/universe DEP-11 64x64 Icons [51.5 kB]
Get:93 http://archive.ubuntu.com/ubuntu focal-security/universe DEP-11 64x64@2 Icons [29 B]
Get:94 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [12.0 kB]
Get:95 http://archive.ubuntu.com/ubuntu focal-security/multiverse i386 Packages [7224 B]
Get:96 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [22.3 kB]
Get:97 http://archive.ubuntu.com/ubuntu focal-security/multiverse Translation-en [5072 B]
Get:98 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2464 B]
Get:99 http://archive.ubuntu.com/ubuntu focal-security/multiverse DEP-11 48x48 Icons [29 B]
Get:100 http://archive.ubuntu.com/ubuntu focal-security/multiverse DEP-11 64x64 Icons [2638 B]
Get:101 http://archive.ubuntu.com/ubuntu focal-security/multiverse DEP-11 64x64@2 Icons [29 B]
Get:102 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 c-n-f Metadata [568 B]
Fetched 45.9 MB in 1min 2s (746 kB/s)
Reading package lists... Done
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 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-340 (340.108-0ubuntu5.20.04.2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-340-340.108 DKMS files...

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.11.0-25-generic
Building for architecture x86_64
Building initial module for 5.11.0-25-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-340.0.crash'
Error! Bad return status for module build on kernel: 5.11.0-25-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=2725bc07-c6b4-45f8-872e-abc773be383d)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-340
E: Sub-process /usr/bin/dpkg returned an error code (1)
hazel@hazel-MacBookPro:~$ LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 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-340 (340.108-0ubuntu5.20.04.2) ...
dpkg: error: version '-' has bad syntax: revision number is empty
dpkg: error: version '-' has bad syntax: revision number is empty
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia-340
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-340-340.108 DKMS files...

------------------------------
Deleting module version: 340.108
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-340-340.108 DKMS files...
Building for 5.11.0-25-generic
Building for architecture x86_64
Building initial module for 5.11.0-25-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-340.0.crash'
Error! Bad return status for module build on kernel: 5.11.0-25-generic (x86_64)
Consult /var/lib/dkms/nvidia-340/340.108/build/make.log for more information.
dpkg: error processing package nvidia-340 (--configure):
 installed nvidia-340 package post-installation script subprocess returned error exit status 10
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic
I: The initramfs will attempt to resume from /dev/sda1
I: (UUID=2725bc07-c6b4-45f8-872e-abc773be383d)
I: Set the RESUME variable to override this.
Errors were encountered while processing:
 nvidia-340
E: Sub-process /usr/bin/dpkg returned an error code (1)
hazel@hazel-MacBookPro:~$ find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

/etc/apt/sources.list

     1 # deb cdrom:[Ubuntu 20.04.2.0 LTS _Focal Fossa_ - Release amd64 (20210209.1)]/ focal main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://archive.ubuntu.com/ubuntu focal main restricted
     6 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://archive.ubuntu.com/ubuntu focal-updates main restricted
    11 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal-updates main restricted
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team. Also, please note that software in universe WILL NOT receive any
    15 ## review or updates from the Ubuntu security team.
    16 deb http://archive.ubuntu.com/ubuntu focal universe
    17 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal universe
    18 deb http://archive.ubuntu.com/ubuntu focal-updates universe
    19 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 deb http://archive.ubuntu.com/ubuntu focal multiverse
    27 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal multiverse
    28 deb http://archive.ubuntu.com/ubuntu focal-updates multiverse
    29 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal-updates multiverse
    30
    31 ## N.B. software from this repository may not have been tested as
    32 ## extensively as that contained in the main release, although it includes
    33 ## newer versions of some applications which may provide useful features.
    34 ## Also, please note that software in backports WILL NOT receive any review
    35 ## or updates from the Ubuntu security team.
    36 deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
    37 # deb-src http://au.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    38
    39 ## Uncomment the following two lines to add software from Canonical's
    40 ## 'partner' repository.
    41 ## This software is not part of Ubuntu, but is offered by Canonical and the
    42 ## respective vendors as a service to Ubuntu users.
    43 # deb http://archive.canonical.com/ubuntu focal partner
    44 # deb-src http://archive.canonical.com/ubuntu focal partner
    45
    46 deb http://archive.ubuntu.com/ubuntu focal-security main restricted
    47 # deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
    48 deb http://archive.ubuntu.com/ubuntu focal-security universe
    49 # deb-src http://security.ubuntu.com/ubuntu focal-security universe
    50 deb http://archive.ubuntu.com/ubuntu focal-security multiverse
    51 # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
    52
    53 # This system was installed using small removable media
    54 # (e.g. netinst, live or single CD). The matching "deb cdrom"
    55 # entries were disabled at the end of the installation process.
    56 # For information about how to configure apt package sources,
    57 # see the sources.list(5) manual.
hazel@hazel-MacBookPro:~$ sudo dpkg --audit
The following packages are only half configured, probably due to problems
configuring them the first time. The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
 nvidia-340 NVIDIA binary driver - version 340.108

hazel@hazel-MacBookPro:~$

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Best Manfred Hampl (m-hampl) said :
#1

It seems that nvidia-340 is incompatible with the 5.11.0-25-generic kernel on Ubuntu focal.

I see the following workarounds:
- revert to the 5.4.0-* version of the kernel (by installing from the Ubuntu 20.04.0 or 20.04.1 DVD and not installing the hwe kernel)
- do not install the nvidia-340 package but a higher one, e.g. nvidia-384 (if that also is compatible with your NVidia display adapter)
- use the nvidia-340 package from https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy (standard disclaimer for PPAs applies of course)

What is the output of the command
sudo lshw -C display

Maybe relevant link:
https://nvidia.custhelp.com/app/answers/detail/a_id/3142/~/support-timeframes-for-unix-legacy-gpu-releases

Revision history for this message
Hazel Malloy (hazelmalloy) said :
#2

Thank you so much, Manfred!

The package from the nvidia-legacy PPA worked perfectly. I knew that the driver could work with the kernal on Ubuntu Focal, since I had it installed previously on the same laptop with Focal.