This issue occurred after running updates on Ubuntu 22.04.1 LTS.
The question at the core of the issue is: How do I deal with a package having a dependency on a kernel newer than the version available?
Below I have briefly summarised the issue at hand. At the bottom is a detailed description of what has transpired, should more detailed information be necessary.
Summary of the problem:
- Yesterday I updated my system, which resulted in deprecated keys. Following solving the keys issue, running
sudo apt update
now returns a message that I have unmet dependencies:
$ sudo apt upgrade
(...)
The following packages have unmet dependencies:
linux-modules-nvidia-515-5.15.0-50-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
linux-modules-nvidia-515-5.15.0-52-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
linux-modules-nvidia-515-generic-hwe-22.04 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
nvidia-dkms-515 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
nvidia-driver-515 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Running the suggested solution
apt --fix-broken install
seems to end up removing CUDA, which is unacceptable.
Installing the missing dependency didn't work because it says the newest package is already installed, which is an older version (515.65.01-0ubuntu1) than the needed dependency (>= 515.76):
$ sudo apt install nvidia-kernel-common-515
(...)
nvidia-kernel-common-515 is already the newest version (515.65.01-0ubuntu1).
nvidia-kernel-common-515 set to manually installed.
However, the Ubuntu repository, states that the newest package is 515.76-0ubuntu0.22.04.1; so why then don't apt
find this and install it?
Detailed description of what transpired:
Yesterday, I ran an routine update of my system, and earlier today I received an error that two packages failed to update due to deprecated keys. sudo apt update
rendered the following errors:
W: GPG error: http://ppa.launchpad.net/stefanberger/swtpm-focal/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1E9E66385D3E4D5D
W: GPG error: https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F338EA0E0105AB24
The first error was solved by searching for the missing signature in Ubuntu's keyserver:
$ curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9E66385D3E4D5D" | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/stefanberger.gpg
The second by adding the key from Nvidia's HPC SDK install instructions:
$ curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg
$ echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list
After that I ran sudo apt update
without the GPG error. Subsequently, I ran sudo apt upgrade
, which returned the following:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-modules-nvidia-515-5.15.0-50-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
linux-modules-nvidia-515-5.15.0-52-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
linux-modules-nvidia-515-generic-hwe-22.04 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
nvidia-dkms-515 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
nvidia-driver-515 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Following the error message's advice, I tried to run sudo apt --fix-broken install
, which returned:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
cuda-cccl-11-7 cuda-command-line-tools-11-7 cuda-compiler-11-7
cuda-cudart-11-7 cuda-cudart-dev-11-7 cuda-cuobjdump-11-7 cuda-cupti-11-7
cuda-cupti-dev-11-7 cuda-cuxxfilt-11-7 cuda-documentation-11-7
cuda-driver-dev-11-7 cuda-gdb-11-7 cuda-libraries-11-7
cuda-libraries-dev-11-7 cuda-memcheck-11-7 cuda-nsight-11-7
cuda-nsight-compute-11-7 cuda-nsight-systems-11-7 cuda-nvcc-11-7
cuda-nvdisasm-11-7 cuda-nvml-dev-11-7 cuda-nvprof-11-7 cuda-nvprune-11-7
cuda-nvrtc-11-7 cuda-nvrtc-dev-11-7 cuda-nvtx-11-7 cuda-nvvp-11-7
cuda-sanitizer-11-7 cuda-toolkit-11-7 cuda-toolkit-11-7-config-common
cuda-toolkit-11-config-common cuda-toolkit-config-common cuda-tools-11-7
cuda-visual-tools-11-7 gds-tools-11-7 libcublas-11-7 libcublas-dev-11-7
libcufft-11-7 libcufft-dev-11-7 libcufile-11-7 libcufile-dev-11-7
libcurand-11-7 libcurand-dev-11-7 libcusolver-11-7 libcusolver-dev-11-7
libcusparse-11-7 libcusparse-dev-11-7 libgles2:i386 libnpp-11-7
libnpp-dev-11-7 libnvidia-cfg1-515 libnvidia-common-515
libnvidia-compute-515:i386 libnvidia-decode-515 libnvidia-decode-515:i386
libnvidia-egl-wayland1 libnvidia-encode-515 libnvidia-encode-515:i386
libnvidia-extra-515 libnvidia-fbc1-515 libnvidia-fbc1-515:i386
libnvidia-gl-515 libnvidia-gl-515:i386 libnvjpeg-11-7 libnvjpeg-dev-11-7
libopengl0:i386 libxnvctrl0 nsight-compute-2022.2.1 nsight-systems-2022.1.3
nvidia-compute-utils-515 nvidia-kernel-common-515 nvidia-kernel-source-515
nvidia-modprobe nvidia-prime nvidia-settings nvidia-utils-515
screen-resolution-extra xserver-xorg-video-nvidia-515
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
cuda cuda-11-7 cuda-demo-suite-11-7 cuda-drivers cuda-drivers-515
cuda-runtime-11-7 linux-modules-nvidia-515-5.15.0-50-generic
linux-modules-nvidia-515-5.15.0-52-generic
linux-modules-nvidia-515-generic-hwe-22.04 nvidia-dkms-515 nvidia-driver-515
nvidia-fs nvidia-fs-dkms nvidia-gds nvidia-gds-11-7
0 upgraded, 0 newly installed, 15 to remove and 2 not upgraded.
26 not fully installed or removed.
After this operation, 15,0 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.
Now, from what I can tell, proceeding would result in the removal of CUDA and all dependecies. This is definitely not what I want, so I aborted.
I then tried to install the missing dependency, nvidia-kernel-common-515
:
$ sudo apt install nvidia-kernel-common-515
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nvidia-kernel-common-515 is already the newest version (515.65.01-0ubuntu1).
nvidia-kernel-common-515 set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-modules-nvidia-515-5.15.0-50-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is to be installed
linux-modules-nvidia-515-5.15.0-52-generic : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is to be installed
linux-modules-nvidia-515-generic-hwe-22.04 : Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is to be installed
This is strange. I checked the Ubuntu repository, where it is stated that the newest package is 515.76-0ubuntu0.22.04.1
, so why do apt
state that 515.65.01-0ubuntu1
is the newest?