我正在尝试安装 Cuda 并一直遵循 Cuda 文档,但我正处于需要安装 cuda 包的部分,因此我运行sudo apt-get install cuda
。
输出:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cuda is already the newest version (12.2.2-1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-drivers-535 : Depends: nvidia-kernel-common-535 (>= 535.104.12) but it is not going to be installed
nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.104.12-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
所以我尝试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:
linux-image-5.15.0-84-generic linux-modules-5.15.0-84-generic linux-modules-extra-5.15.0-84-generic nvidia-firmware-535-server-535.104.12
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
nvidia-kernel-common-535
The following NEW packages will be installed:
nvidia-kernel-common-535
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
20 not fully installed or removed.
Need to get 0 B/38.2 MB of archives.
After this operation, 61.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 245994 files and directories currently installed.)
Preparing to unpack .../nvidia-kernel-common-535_535.104.12-0ubuntu1_amd64.deb ...
Unpacking nvidia-kernel-common-535 (535.104.12-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-kernel-common-535_535.104.12-0ubuntu1_amd64.deb (--unpack):
trying to overwrite '/lib/firmware/nvidia/535.104.12/gsp_ga10x.bin', which is also in package nvidia-firmware-535-server-535.104.12 535.104.12-0ubuntu0.22.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-kernel-common-535_535.104.12-0ubuntu1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
似乎存在一些依赖冲突,但我不确定如何解决这些问题,因为 nvidia-firmware 包对于与 GPU 交互似乎很重要,但也需要 cuda 的 nvidia 通用包。
我使用以下系统:
- 操作系统:Ubuntu 22.04.3 LTS x86_64
- 内核:6.5.5-060505-generic
- GPU:NVIDIA A100 PCIe 40GB
- Nvidia 驱动程序 535
答案1
您需要从 apt 传递一个覆盖标志:这可能会起作用:
apt --fix-broken install -o DPkg::options::="--force-overwrite"
祝你好运!