如何解决升级时未满足的依赖项错误?依赖项:nvidia-kernel-common-515 (>= 515.76) 但已安装 515.65.01-0ubuntu1

如何解决升级时未满足的依赖项错误?依赖项:nvidia-kernel-common-515 (>= 515.76) 但已安装 515.65.01-0ubuntu1

在 Ubuntu 22.04.1 LTS 上运行更新后出现此问题。

问题的核心是:我该如何处理依赖于比可用版本更新的内核的软件包?

下面我简要总结了当前的问题。如果需要更详细的信息,下面是对所发生事情的详细描述。


问题概要:

  1. 昨天我更新了系统,导致密钥被弃用。解决密钥问题后,sudo apt update现在运行会返回一条消息,提示我有未满足的依赖项:
$ 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. 运行建议的解决方案apt --fix-broken install似乎最终会删除 CUDA,这是不可接受的。

  2. 安装缺少的依赖项不起作用,因为它说最新的包已经安装,这是一个旧版本(515)。65.01-0ubuntu1)比所需的依赖项(> = 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.

但是,那Ubuntu 存储库,指出最新的套餐是 515。76-0ubuntu0.22.04.1;那么为什么不apt找到它并安装它呢?


所发生事件的详细描述:

昨天,我对我的系统进行了例行更新,今天早些时候我收到一个错误,由于弃用的密钥,两个包无法更新。sudo apt update出现了以下错误:

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

第一个错误已解决在 Ubuntu 的密钥服务器中搜索丢失的签名

$ curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9E66385D3E4D5D" | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/stefanberger.gpg

第二个方法是添加来自Nvidia 的 HPC SDK 安装说明

$ 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

之后,我运行,sudo apt update没有出现 GPG 错误。随后,我运行sudo apt upgrade,结果返回以下内容:

$ 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).

按照错误消息的建议,我尝试运行sudo apt --fix-broken install,结果返回:

$ 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.

现在,据我所知,继续下去将导致删除 CUDA 和所有依赖项.这绝对是不是我想要的,所以我堕胎了。

然后我尝试安装缺少的依赖项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

这很奇怪。我检查了Ubuntu 存储库,其中说明最新的包是515.76-0ubuntu0.22.04.1,那么为什么要apt说明这515.65.01-0ubuntu1是最新的呢?

答案1

今天早上遇到了同样的问题,我清除了所有 nvidia 软件包并从 ubuntu 存储库重新安装了它们。

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

该问题现已解决。apt选择较低的515.65.7版本而不是515.76通过自动升级安装的版本。

答案2

我找到了一个在这种特殊情况下有效的解决方案:

作为必要版本依赖项 ( nvidia-kernel-common-515 (>= 515.76)) 在 Ubuntu 存储库中可用,我下载了文件并手动安装:

$ 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

据我所知,apt upgrade现在将所有软件包升级到最新版本。但是,此解决方案并没有真正解决为什么一开始apt没有找到最新版本 ( ),因此得出结论认为已安装的软件包版本 ( ) 是最新的。515.76515.65.01

相关内容