cuda 10.1 安装出现 E: 子进程 /usr/bin/dpkg 返回错误代码 (1)

cuda 10.1 安装出现 E: 子进程 /usr/bin/dpkg 返回错误代码 (1)

我正在尝试在我的 ubuntu 20.04 系统中安装 cuda 10.1。我在 nvidia 官方网站上查找了此信息。但是,我需要的 cuda 版本不适用于我拥有的 ubuntu 版本。因此,我想继续 ubuntu 18 的安装过程。我使用的链接是

https://developer.nvidia.com/cuda-10.1-download-archive-update2?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

在最后一步中我收到以下错误。

Errors were encountered while processing:
 nvidia-dkms-418
 nvidia-driver-418
 cuda-drivers
 cuda-runtime-10-1
 cuda-demo-suite-10-1
 cuda-10-1
 cuda
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过在这篇文章中接受的答案https://askubuntu.com/a/1119232/1191829但仍然出现相同的错误。有人能给我提供解决方案吗?

原始错误的完整回溯

Reading package lists... Done
Building dependency tree       
Reading state information... Done
cuda is already the newest version (10.1.243-1).
The following packages were automatically installed and are no longer required:
  g++-8 libaccinj64-10.1 libatomic1:i386 libbsd0:i386 libcublaslt10 libcudart10.1 libcufft10 libcufftw10 libcupti-dev libcupti-doc libcupti10.1
  libcurand10 libcusolver10 libcusolvermg10 libcusparse10 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 libncurses5 libnppc10 libnppial10 libnppicc10 libnppicom10 libnppidei10 libnppif10 libnppig10
  libnppim10 libnppist10 libnppisu10 libnppitc10 libnpps10 libnvblas10 libnvgraph10 libnvjpeg10 libnvrtc10.1 libnvtoolsext1 libnvvm3
  libpciaccess0:i386 libsensors5:i386 libstdc++-8-dev libstdc++6:i386 libthrust-dev libtinfo5 libvdpau-dev 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 libxshmfence1:i386
  libxxf86vm1:i386 mesa-vulkan-drivers:i386 ocl-icd-libopencl1 ocl-icd-opencl-dev opencl-c-headers openjdk-8-jre
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
7 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up nvidia-dkms-418 (418.87.00-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)

A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau
from loading. This can be reverted by deleting the following file:
/etc/modprobe.d/nvidia-graphics-drivers.conf

A new initrd image has also been created. To revert, please regenerate your
initrd by running the following command after deleting the modprobe.d file:
`/usr/sbin/initramfs -u`

*****************************************************************************
*** Reboot your computer and verify that the NVIDIA graphics driver can   ***
*** be loaded.                                                            ***
*****************************************************************************

INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Removing old nvidia-418.87.00 DKMS files...

------------------------------
Deleting module version: 418.87.00
completely from the DKMS tree.
------------------------------
Done.
Loading new nvidia-418.87.00 DKMS files...
Building for 5.8.0-59-generic
Building for architecture x86_64
Building initial module for 5.8.0-59-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-kernel-source-418.0.crash'
Error! Bad return status for module build on kernel: 5.8.0-59-generic (x86_64)
Consult /var/lib/dkms/nvidia/418.87.00/build/make.log for more information.
dpkg: error processing package nvidia-dkms-418 (--configure):
 installed nvidia-dkms-418 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-418:
 nvidia-driver-418 depends on nvidia-dkms-418 (= 418.87.00-0ubuntu1); however:
  Package nvidia-dkms-418 is not configured yet.

dpkg: error processing package nvidia-driver-418 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-drivers:
 cuda-drivers depends on nvidia-dkms-418 (>= 418.87.00); however:
  Package nvidia-dkms-418 is not configured yet.
 cuda-drivers depends on nvidia-driver-418 (>= 418.87.00); however:
  Package nvidia-driver-418 is not configured yet.

No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                              dpkg: error processing package cuda-drivers (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-runtime-10-1:
 cuda-runtime-10-1 depends on cuda-drivers (>= 418.87); however:
  Package cuda-drivers is not configured yet.

dpkg: error processing package cuda-runtime-10-1 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-demo-suite-10-1:
 cuda-demo-suite-10-1 depends on cuda-runtime-10-1; however:
  Package cuda-runtime-10-1 is not configured yet.

dpkg: error processing package cuda-demo-suite-10-1 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-10-1:
 cuda-10-1 depends on cuda-runtime-10-1 (>= 10.1.243); however:
  Package cuda-runtime-10-1 is not configured yet.
 cuda-10-1 depends on cuda-demo-suite-10-1 (>= 10.1.243); however:
  Package cuda-demo-suite-10-1 is not configured yet.

dpkg: error proNo apport report written because MaxReports is reached already
                                                                             No apport report written because MaxReports is reached already
                                                                                                                                           No apport report written because MaxReports is reached already
                                                   No apport report written because MaxReports is reached already
                                                                                                                 cessing package cuda-10-1 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda:
 cuda depends on cuda-10-1 (>= 10.1.243); however:
  Package cuda-10-1 is not configured yet.

dpkg: error processing package cuda (--configure):
 dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.8.0-59-generic
Errors were encountered while processing:
 nvidia-dkms-418
 nvidia-driver-418
 cuda-drivers
 cuda-runtime-10-1
 cuda-demo-suite-10-1
 cuda-10-1
 cuda
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑:cuda 10.1 需要 418 以上的 nvidia 驱动程序。因此我将其更改为nvidia-driver-465(软件和更新 --> 附加驱动程序)。但是,它总是恢复到nvidia-driver-418

答案1

我遇到了同样的错误,我认为问题在于该版本的 CUDA 是适用于 18.04 的,而我试图在 20.04 上运行。

我发现的解决方法是在 20.04 ubuntu 主机上使用带有 cuda 的 18:04 docker 镜像。NVIDIA 有现成的 cuda docker 镜像可供您使用。

可以从这里下载 CUDA docker。 https://hub.docker.com/r/nvidia/cuda

它可以在主机上完成您想要做的所有事情,无需复杂的安装和配置。

CUDA Toolkit 11.4 适用于 ubuntu 20.04,但它尚未通过我的 tensorflow 版本认证。

因此,最好的选择是使用 nvidia cuda docker 镜像(主机上唯一需要的就是 nvidia 驱动程序)

或者

将你的 Ubuntu 版本降级到 18.04

相关内容