apt 告诉我 NVIDIA 驱动程序和 CUDA“不再需要”

apt 告诉我 NVIDIA 驱动程序和 CUDA“不再需要”

我已经通过以下方式安装了 NVIDIA 专有驱动程序 (v450) 和 CUDA (v11)这个存储库(我通过将其包含在目录中来安装它/etc/apt/sources.list.d),但现在我注意到apt建议删除它们,因为它们“不再需要”。具体来说,当我执行sudo apt upgrade(不会产生任何消息)然后执行时sudo apt upgrade,后一个命令会产生以下输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  cuda-command-line-tools-11-0 cuda-compiler-11-0 cuda-cudart-11-0 cuda-cudart-dev-11-0 cuda-cuobjdump-11-0 cuda-cupti-11-0 cuda-cupti-dev-11-0 cuda-documentation-11-0 cuda-driver-dev-11-0
  cuda-drivers-450 cuda-gdb-11-0 cuda-libraries-11-0 cuda-libraries-dev-11-0 cuda-memcheck-11-0 cuda-nsight-11-0 cuda-nsight-compute-11-0 cuda-nsight-systems-11-0 cuda-nvcc-11-0 cuda-nvdisasm-11-0
  cuda-nvml-dev-11-0 cuda-nvprof-11-0 cuda-nvprune-11-0 cuda-nvrtc-11-0 cuda-nvrtc-dev-11-0 cuda-nvtx-11-0 cuda-nvvp-11-0 cuda-samples-11-0 cuda-sanitizer-11-0 cuda-toolkit-11-0 cuda-tools-11-0
  cuda-visual-tools-11-0 dkms freeglut3 freeglut3-dev libcublas-11-0 libcublas-dev-11-0 libcufft-11-0 libcufft-dev-11-0 libcurand-11-0 libcurand-dev-11-0 libcusolver-11-0 libcusolver-dev-11-0
  libcusparse-11-0 libcusparse-dev-11-0 libglu1-mesa-dev libice-dev libnpp-11-0 libnpp-dev-11-0 libnvidia-cfg1-450 libnvidia-common-450 libnvidia-decode-450 libnvidia-encode-450 libnvidia-extra-450
  libnvidia-fbc1-450 libnvidia-gl-450 libnvidia-ifr1-450 libnvjpeg-11-0 libnvjpeg-dev-11-0 libsm-dev libxi-dev libxmu-dev libxmu-headers libxnvctrl0 libxt-dev nsight-compute-2019.4.0
  nsight-systems-2020.3.2 nvidia-compute-utils-450 nvidia-dkms-450 nvidia-driver-450 nvidia-kernel-common-450 nvidia-kernel-source-450 nvidia-modprobe nvidia-prime nvidia-settings nvidia-utils-450
  pkg-config screen-resolution-extra xserver-xorg-video-nvidia-450
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

此外,如果我尝试这样做,sudo apt autoremove我会得到以下结果:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  cuda-command-line-tools-11-0 cuda-compiler-11-0 cuda-cudart-11-0 cuda-cudart-dev-11-0 cuda-cuobjdump-11-0 cuda-cupti-11-0 cuda-cupti-dev-11-0 cuda-documentation-11-0 cuda-driver-dev-11-0
  cuda-drivers-450 cuda-gdb-11-0 cuda-libraries-11-0 cuda-libraries-dev-11-0 cuda-memcheck-11-0 cuda-nsight-11-0 cuda-nsight-compute-11-0 cuda-nsight-systems-11-0 cuda-nvcc-11-0 cuda-nvdisasm-11-0
  cuda-nvml-dev-11-0 cuda-nvprof-11-0 cuda-nvprune-11-0 cuda-nvrtc-11-0 cuda-nvrtc-dev-11-0 cuda-nvtx-11-0 cuda-nvvp-11-0 cuda-samples-11-0 cuda-sanitizer-11-0 cuda-toolkit-11-0 cuda-tools-11-0
  cuda-visual-tools-11-0 dkms freeglut3 freeglut3-dev libcublas-11-0 libcublas-dev-11-0 libcufft-11-0 libcufft-dev-11-0 libcurand-11-0 libcurand-dev-11-0 libcusolver-11-0 libcusolver-dev-11-0
  libcusparse-11-0 libcusparse-dev-11-0 libglu1-mesa-dev libice-dev libnpp-11-0 libnpp-dev-11-0 libnvidia-cfg1-450 libnvidia-common-450 libnvidia-decode-450 libnvidia-encode-450 libnvidia-extra-450
  libnvidia-fbc1-450 libnvidia-gl-450 libnvidia-ifr1-450 libnvjpeg-11-0 libnvjpeg-dev-11-0 libsm-dev libxi-dev libxmu-dev libxmu-headers libxnvctrl0 libxt-dev nsight-compute-2019.4.0
  nsight-systems-2020.3.2 nvidia-compute-utils-450 nvidia-dkms-450 nvidia-driver-450 nvidia-kernel-common-450 nvidia-kernel-source-450 nvidia-modprobe nvidia-prime nvidia-settings nvidia-utils-450
  pkg-config screen-resolution-extra xserver-xorg-video-nvidia-450
0 upgraded, 0 newly installed, 78 to remove and 0 not upgraded.
After this operation, 4.960 MB disk space will be freed.
Do you want to continue? [Y/n]

我没有安装更新的版本,而且我非常确定这些是我目前正在使用的软件包。那么,apt既然这样的操作几乎肯定会破坏某些东西,为什么建议这样做呢?还是我遗漏了什么?

答案1

Nvidia 可以利用依赖项做出奇怪的事情,比如让所有 cuda 内容都依赖于他们提供的某个(旧)Nvidia 驱动程序。下一次 Nvidia 驱动程序更新会删除它们所依赖的驱动程序,并使它们受自动删除的约束。如果您使用 cuda deb,请为此做好准备 - 要么只解压所需的 deb 部分,要么复制 cuda 文件,让自动删除执行其操作,然后恢复 cuda 文件。

更好的方法是使用运行文件方法安装 cuda,这样您可以跳过 Nvidia 驱动程序安装,直接使用 Ubuntu 默认驱动程序。在此站点搜索每种方法的具体说明。例如如何在 Ubuntu 中安装 NVIDIA 和 CUDA 驱动程序?

相关内容