几个月前,我用 将系统从 16.04 更新到 18.04 sudo do-release-upgrade
。很多东西都坏了,我无法使用 Nvidia 驱动程序等登录,但不知何故设法让一切正常运行。
但是现在当我尝试更新 GPU 驱动程序时sudo ubuntu-drivers autoinstall
出现以下问题:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-driver-440 : Depends: libnvidia-gl-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: nvidia-dkms-440 (= 440.82-0ubuntu0~0.18.04.1)
Depends: nvidia-kernel-source-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: nvidia-compute-utils-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: libnvidia-decode-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: libnvidia-encode-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: libnvidia-cfg1-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Depends: libnvidia-ifr1-440 (= 440.82-0ubuntu0~0.18.04.1) but it is not going to be installed
Recommends: libnvidia-compute-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
Recommends: libnvidia-decode-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
Recommends: libnvidia-encode-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
Recommends: libnvidia-ifr1-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
Recommends: libnvidia-fbc1-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
Recommends: libnvidia-gl-440:i386 (= 440.82-0ubuntu0~0.18.04.1)
E: Unable to correct problems, you have held broken packages.
我对包管理器不太了解,非常希望得到一些帮助!
笔记:我尝试手动安装推荐的软件包,但软件包管理器删除了大量已安装的软件包,这让我很担心。所以我取消了安装。
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
apturl cuda-cudart-10-1 cuda-cudart-dev-10-1 cuda-cufft-10-1 cuda-cufft-dev-10-1 cuda-cuobjdump-10-1 cuda-curand-10-1 cuda-curand-dev-10-1 cuda-cusolver-10-1 cuda-cusolver-dev-10-1
cuda-cusparse-10-1 cuda-cusparse-dev-10-1 cuda-driver-dev-10-1 cuda-gdb-10-1 cuda-gpu-library-advisor-10-1 cuda-libraries-10-1 cuda-libraries-dev-10-1 cuda-license-10-1 cuda-memcheck-10-1
cuda-misc-headers-10-1 cuda-npp-10-1 cuda-npp-dev-10-1 cuda-nsight-10-1 cuda-nsight-compute-10-1 cuda-nsight-systems-10-1 cuda-nvdisasm-10-1 cuda-nvgraph-10-1 cuda-nvgraph-dev-10-1
cuda-nvjpeg-10-1 cuda-nvjpeg-dev-10-1 cuda-nvml-dev-10-1 cuda-nvprof-10-1 cuda-nvprune-10-1 cuda-nvrtc-10-1 cuda-nvrtc-dev-10-1 cuda-nvtx-10-1 cuda-nvvp-10-1 cuda-sanitizer-api-10-1
cuda-visual-tools-10-1 freeglut3 freeglut3-dev gstreamer1.0-gtk3 i965-va-driver ibverbs-providers libaacs0 libaio1 libavcodec-dev libavcodec57 libavutil-dev libavutil55 libbdplus0 libblas-dev
libblas3 libbluray2 libcrystalhd3 libcublas-dev libcublas10 libdrm-dev libetonyek-0.1-1 libgl1-mesa-dev libgles1 libglu1-mesa-dev libglvnd-core-dev libglvnd-dev libgnome-autoar-0-0
libgoogle-perftools4 libgsm1 libibverbs1 libiscsi7 libnl-route-3-200 libnvidia-common-418 libopengl0 libopenjp2-7 libshine3 libsnappy1v5 libsoxr0 libssh-gcrypt-4 libswresample-dev libswresample2
libtcmalloc-minimal4 libva-drm2 libva-x11-2 libva2 libwpd-0.10-10 libx11-xcb-dev libx264-152 libx265-146 libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0-dev
libxcb-render0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxshmfence-dev libxvidcore4 libxxf86vm-dev libyaml-cpp0.5v5 libzvbi-common libzvbi0 mesa-common-dev
mesa-va-drivers mongo-tools nsight-compute-2019.4.0 nsight-systems-2019.3.7 nvidia-modprobe ocl-icd-libopencl1 va-driver-all x11proto-damage-dev x11proto-xf86vidmode-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libnvidia-common-440 libnvidia-compute-440 libnvidia-fbc1-440 nvidia-utils-440
Recommended packages:
libnvidia-compute-440:i386 libnvidia-decode-440:i386 libnvidia-encode-440:i386 libnvidia-ifr1-440:i386 libnvidia-fbc1-440:i386 libnvidia-gl-440:i386
The following packages will be REMOVED:
build-essential compiz-core compiz-plugins-default cuda cuda-10-1 cuda-command-line-tools-10-1 cuda-compiler-10-1 cuda-cupti-10-1 cuda-demo-suite-10-1 cuda-documentation-10-1 cuda-drivers
cuda-nvcc-10-1 cuda-runtime-10-1 cuda-samples-10-1 cuda-toolkit-10-1 cuda-tools-10-1 eog firefox g++ g++-7 gnome-sudoku google-chrome-stable libabw-0.1-1 libavformat-dev libavformat57
libboost-program-options1.65.1 libcdr-0.1-1 libchromaprint1 libe-book-0.1-1 libepubgen-0.1-1 libexempi3 libexiv2-14 libfreehand-0.1-1 libgexiv2-2 libgfortran4 libglibmm-2.4-1v5 libgme0
liblapack-dev liblapack3 liblua5.2-0 libmspub-0.1-1 libnvidia-cfg1-418 libnvidia-compute-418 libnvidia-decode-418 libnvidia-encode-418 libnvidia-fbc1-418 libnvidia-gl-418 libnvidia-ifr1-418
libopenmpt0 libpagemaker-0.0-0 libpcrecpp0v5 libproxy1-plugin-gsettings libproxy1-plugin-networkmanager libqqwing2v5 libqt4-dbus libqt4-declarative libqt4-network libqt4-script libqt4-sql
libqt4-xmlpatterns libqt5qml5 libqt5quick5 libqt5sql5 libqt5sql5-sqlite libqtgui4 libquvi7 librados2 libraw16 librbd1 libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc
libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-writer libsigc++-2.0-0v5 libsignon-extension1 libsignon-plugins-common1
libsignon-qt5-1 libstdc++-7-dev libvisio-0.1-1 libwpg-0.3-3 libwps-0.4-4 mongodb mongodb-clients mongodb-server mongodb-server-core nautilus nautilus-share nvidia-compute-utils-418
nvidia-dkms-418 nvidia-driver-418 nvidia-kernel-common-418 nvidia-kernel-source-418 nvidia-utils-418 printer-driver-brlaser printer-driver-splix qdbus qemu-block-extra qemu-utils
qml-module-qtquick2 qt-at-spi qtchooser qtdeclarative5-qtquick2-plugin shotwell telnet thunderbird thunderbird-gnome-support ubuntu-desktop xserver-xorg-video-nvidia-418
The following NEW packages will be installed:
libnvidia-cfg1-440 libnvidia-common-440 libnvidia-compute-440 libnvidia-decode-440 libnvidia-encode-440 libnvidia-fbc1-440 libnvidia-gl-440 libnvidia-ifr1-440 nvidia-compute-utils-440
nvidia-dkms-440 nvidia-driver-440 nvidia-kernel-common-440 nvidia-kernel-source-440 nvidia-utils-440 xserver-xorg-video-nvidia-440
0 upgraded, 15 newly installed, 114 to remove and 0 not upgraded.
答案1
我刚刚在尝试安装 Kubuntu 20.04 时遇到了同样的问题nvidia-driver-465
。
derek@ds-p51-l:~$ sudo apt install nvidia-driver-465
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-driver-465 : Depends: libnvidia-gl-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-decode-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-encode-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: xserver-xorg-video-nvidia-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-cfg1-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-ifr1-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Depends: libnvidia-fbc1-465 (= 465.27-0ubuntu0.20.04.1) but it is not going to be installed
Recommends: libnvidia-compute-465:i386 (= 465.27-0ubuntu0.20.04.1)
Recommends: libnvidia-decode-465:i386 (= 465.27-0ubuntu0.20.04.1)
Recommends: libnvidia-encode-465:i386 (= 465.27-0ubuntu0.20.04.1)
Recommends: libnvidia-ifr1-465:i386 (= 465.27-0ubuntu0.20.04.1)
Recommends: libnvidia-fbc1-465:i386 (= 465.27-0ubuntu0.20.04.1)
Recommends: libnvidia-gl-465:i386 (= 465.27-0ubuntu0.20.04.1)
E: Unable to correct problems, you have held broken packages.
我的活动驱动程序是 460,因此我检查了一下安装了哪些其他驱动程序。
derek@ds-p51-l:~$ apt list -i | grep nvidia
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libnvidia-cfg1-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-common-460/focal,focal,now 460.73.01-0ubuntu0.20.04.2 all [installed,automatic]
libnvidia-compute-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-compute-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-decode-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-decode-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-encode-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-encode-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-extra-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-fbc1-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-fbc1-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-gl-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-gl-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-ifr1-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-ifr1-460/focal,now 460.73.01-0ubuntu0.20.04.2 i386 [installed,automatic]
nvidia-compute-utils-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-dkms-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-driver-440/focal-updates,focal-security,focal,now 450.119.03-0ubuntu0.20.04.1 amd64 [installed]
nvidia-driver-450/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-driver-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-kernel-common-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-kernel-source-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-prime/focal-updates,focal-updates,now 0.8.16~0.20.04.1 all [installed,automatic]
nvidia-settings/focal-updates,focal,now 460.39-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-utils-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
xserver-xorg-video-nvidia-460/focal,now 460.73.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
...我决定清除 450 驱动程序,这样一来 440 驱动程序也一并被删除。
derek@ds-p51-l:~$ sudo apt purge nvidia-*-450
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'nvidia-kernel-common-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-utils-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-dkms-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-headless-no-dkms-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-compute-utils-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-driver-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-headless-450' for glob 'nvidia-*-450'
Note, selecting 'nvidia-kernel-source-450' for glob 'nvidia-*-450'
Package 'nvidia-compute-utils-450' is not installed, so not removed
Package 'nvidia-dkms-450' is not installed, so not removed
Package 'nvidia-headless-450' is not installed, so not removed
Package 'nvidia-headless-no-dkms-450' is not installed, so not removed
Package 'nvidia-kernel-common-450' is not installed, so not removed
Package 'nvidia-kernel-source-450' is not installed, so not removed
Package 'nvidia-utils-450' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libatomic1:i386 libbsd0:i386 libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386 libffi7:i386 libgl1:i386
libgl1-mesa-dri:i386 libglapi-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libllvm11:i386 libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460:i386 libnvidia-decode-460
libnvidia-decode-460:i386 libnvidia-encode-460 libnvidia-encode-460:i386 libnvidia-extra-460 libnvidia-fbc1-460 libnvidia-fbc1-460:i386 libnvidia-gl-460 libnvidia-gl-460:i386 libnvidia-ifr1-460
libnvidia-ifr1-460:i386 libpciaccess0:i386 libsensors5:i386 libstdc++6:i386 libvulkan1:i386 libwayland-client0:i386 libx11-6:i386 libx11-xcb1:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
libxcb-glx0:i386 libxcb-present0:i386 libxcb-randr0:i386 libxcb-sync1:i386 libxcb-xfixes0:i386 libxcb1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxnvctrl0 libxshmfence1:i386
libxxf86vm1:i386 mesa-vulkan-drivers:i386 nvidia-compute-utils-460 nvidia-dkms-460 nvidia-driver-460 nvidia-kernel-common-460 nvidia-kernel-source-460 nvidia-prime nvidia-settings nvidia-utils-460
screen-resolution-extra xserver-xorg-video-nvidia-460
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
nvidia-driver-440* nvidia-driver-450*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 39.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 263199 files and directories currently installed.)
Removing nvidia-driver-440 (450.119.03-0ubuntu0.20.04.1) ...
Removing nvidia-driver-450 (460.73.01-0ubuntu0.20.04.2) ...
... 然后我就可以安装 465 驱动程序了。
derek@ds-p51-l:~$ sudo apt install nvidia-driver-465
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libnvidia-cfg1-465 libnvidia-common-465 libnvidia-compute-465 libnvidia-compute-465:i386 libnvidia-decode-465 libnvidia-decode-465:i386 libnvidia-encode-465 libnvidia-encode-465:i386 libnvidia-extra-465
libnvidia-fbc1-465 libnvidia-fbc1-465:i386 libnvidia-gl-465 libnvidia-gl-465:i386 libnvidia-ifr1-465 libnvidia-ifr1-465:i386 nvidia-compute-utils-465 nvidia-dkms-465 nvidia-kernel-common-465
nvidia-kernel-source-465 nvidia-utils-465 xserver-xorg-video-nvidia-465
The following packages will be REMOVED:
libnvidia-cfg1-460 libnvidia-common-460 libnvidia-compute-460 libnvidia-compute-460:i386 libnvidia-decode-460 libnvidia-decode-460:i386 libnvidia-encode-460 libnvidia-encode-460:i386 libnvidia-extra-460
libnvidia-fbc1-460 libnvidia-fbc1-460:i386 libnvidia-gl-460 libnvidia-gl-460:i386 libnvidia-ifr1-460 libnvidia-ifr1-460:i386 nvidia-compute-utils-460 nvidia-dkms-460 nvidia-driver-460
nvidia-kernel-common-460 nvidia-kernel-source-460 nvidia-utils-460 xserver-xorg-video-nvidia-460
The following NEW packages will be installed:
libnvidia-cfg1-465 libnvidia-common-465 libnvidia-compute-465 libnvidia-compute-465:i386 libnvidia-decode-465 libnvidia-decode-465:i386 libnvidia-encode-465 libnvidia-encode-465:i386 libnvidia-extra-465
libnvidia-fbc1-465 libnvidia-fbc1-465:i386 libnvidia-gl-465 libnvidia-gl-465:i386 libnvidia-ifr1-465 libnvidia-ifr1-465:i386 nvidia-compute-utils-465 nvidia-dkms-465 nvidia-driver-465
nvidia-kernel-common-465 nvidia-kernel-source-465 nvidia-utils-465 xserver-xorg-video-nvidia-465
0 upgraded, 22 newly installed, 22 to remove and 0 not upgraded.
Need to get 234 MB of archives.
After this operation, 102 MB of additional disk space will be used.
Do you want to continue? [Y/n]
答案2
在安装了最新 Nvidia 驱动程序(435 或 440,具体取决于内核,无需图形驱动程序 ppa)的 Ubuntu 18.04 中,所述问题是由于安装了带有旧 Nvidia 418 驱动程序(就在软件包名称中)的 CUDA deb 文件而导致的。
这会删除(但不会清除)Nvidia 440,并且对 440 进行简单的重新安装尝试将失败,并出现上述缺少依赖项的错误。
- 您可以将 nvida-driver-435 和所有缺失的依赖项放在一行:
sudo apt-get install nvidia-driver-440 libnvidia-gl-440
等),然后 440 驱动程序就会安装。 当 418 驱动程序被移除时,您将收到有关所有依赖它的 Cuda deb 的通知,并且现在将自动移除。这实际上是一个可运行状态,但您真的不希望随机自动移除删除所有 CUDA 文件。
在执行自动删除之前,只需复制已安装的整个 cuda 目录。使用保留链接的副本。
然后,自动删除,清理包信息,删除所有 CUDA 包,并将 CUDA 目录复制回来(或者如果您不想将其作为备份保留,只需将其 mv 即可)。
您现在拥有的 CUDA 安装与软件包系统无关,因此不要指望任何更新。考虑到与 DNN 和 Tensorflow 等其他产品的版本紧密相关,这也许是件好事。
刚刚在 20.04B 上经历过这个问题后,我认为使用 .run 文件可以避免这些问题,并可以跳过 Nvidia 驱动程序混乱的问题。
还有其他 CUDA 软件包不包含 Nvidia 驱动程序。查找 .deb 文件的完整列表,也许顶层文件(包含所有其他文件)可以正常工作。有些 deb 文件的名称中没有“nvidia”,所以我认为这应该可以正常工作。
我可以理解为什么 Nvidia 这样做,这就是他们构建和测试的,并且真的不想花任何精力来支持未经测试的配置,但 CUDA 只是一个应用程序,用户可以在不触及任何系统文件的情况下安装它。
我认为旧版 CUDA 仅在其顶层 deb 中拥有文件,因此只需简单提取并更改 PATH 和 LD_LIBRARY_PATH 即可。