Score:8

How to resolve unmet dependencies error when upgrading? Depends: nvidia-kernel-common-515 (>= 515.76) but 515.65.01-0ubuntu1 is installed

vn flag

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:

  1. 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).
  1. Running the suggested solution apt --fix-broken install seems to end up removing CUDA, which is unacceptable.

  2. 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 aptstate that 515.65.01-0ubuntu1 is the newest?

David avatar
cn flag
I do not see a version of Ubuntu mentioned anywhere. Please add this info.
Pilot6 avatar
cn flag
You probably added some PPA for CUDA and it broke dependencies.
Jav avatar
hu flag
Jav
I have the exact same issue since the auto upgrade of `apt`. I have Ubuntu20.04.4 LTS. I have this custom PPA: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/
Jav avatar
hu flag
Jav
@Pilot6, for me, the issue came this morning aftre the auto upgrade. The PPA has been there for months (years).
Pål Bjartan avatar
vn flag
@David 22.04.1 LTS. I have included the info now.
Pål Bjartan avatar
vn flag
@Pilot6 This seem likely. It's been a few weeks since I installed CUDA (and added the PPA), and it's been running without issues since then, however.
Pål Bjartan avatar
vn flag
@Jav The weird part is that the newest package in the [Ubuntu repository](https://packages.ubuntu.com/jammy-updates/nvidia-kernel-common-515), is 515.**76**-0ubuntu0.22.04.1, so why isn't the newest version installed?
Score:5
hu flag
Jav

Having the same issue this morning, I purged all nvidia packages and reinstalled them from ubuntu repository.

sudo apt --fix-broken install
sudo apt remove *nvidia*
sudo apt install nvidia-driver-515
sudo reboot

The issue is now resolved. apt chose the lower 515.65.7 version and not the 515.76 that was installed with the automatic upgrade.

vahvero avatar
al flag
Reinstall works, but immediately installing drivers failed for me for some reason. Installing packages that apt suggested on `nvidia-driver` installation and re-attempting installation fixed the issue.
Chris Hayes avatar
cn flag
Worked for me as well, and had to what @vahvero mentioned - `sudo apt install libnvidia-compute-515 libnvidia-decode-515 libnvidia-encode-515` before the install would work.
Pål Bjartan avatar
vn flag
This is sort of what I am trying to avoid. From what I can tell, running `apt --fix-broken install` will remove CUDA from the system. Besides, v. [`515.76` is the newest version](https://packages.ubuntu.com/jammy-updates/nvidia-kernel-common-515); so, why isn't it installed?
Jav avatar
hu flag
Jav
For me it didn't remove Cuda toolkit installed
Pål Bjartan avatar
vn flag
@Jav Did you get the same message as I did when running `apt --fix-broken install`? Given that it stated that CUDA would be removed if I proceeded, I took that at face value as what would happen.
Jav avatar
hu flag
Jav
Sorry, indeed it didn't…
Score:1
vn flag

I found a solution that worked in this particular case:

As the necessary version dependency (nvidia-kernel-common-515 (>= 515.76)) is available in the Ubuntu repos, I downloaded the file and installed it manually:

$ wget http://no.archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-515/nvidia-kernel-common-515_515.86.01-0ubuntu0.22.04.1_amd64.deb
$ sudo dpkg -i nvidia-kernel-common-515_515.86.01-0ubuntu0.22.04.1_amd64.deb
$ sudo apt update
$ sudo apt upgrade

As far as I can tell, apt upgrade now upgrades all packages to their newest version. However, this solution does not really address why apt did not find the newest version (515.76) in the first place and, thus, concluded that the installed package version (515.65.01) was up to date.

Albert G Lieu avatar
pl flag
It works like a charm! Thanks for sharing your knowledge, Sir!
user5359531 avatar
ua flag
it seems that the first command (`wget ...`) no longer works, says file not found
Pål Bjartan avatar
vn flag
@user5359531 I've updated the code snippet with the correct version. It should now work. Unfortunately, I am unable to test it as I no longer have Ubuntu installed. That said, I recommend you consider Jav's [answer](https://askubuntu.com/a/1436531/800704) first, as this is the recommended approach. My solution allows for minimal change in the system. If I remember correctly, it was useful at the time as I had low bandwidth and download limit. This method saved me downloading the whole CUDA package again
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.