我想在 ubuntu 18.04 中安装 Nvidia 驱动程序,但是
在终端
$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nvidia-340
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
9 not fully installed or removed.
Need to get 0 B/51.9 MB of archives.
After this operation, 274 MB of additional disk space will be used.
(Reading database ... 277981 files and directories currently
installed.)
Preparing to unpack .../nvidia-340_340.107-0ubuntu0.18.04.2_amd64.deb
...
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to
/usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to
/usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg-divert: error: rename involves overwriting '/usr/lib/i386-linux-
gnu/libGL.so.1.distrib' with
different file '/usr/lib/i386-linux-gnu/libGL.so.1', not allowed
dpkg: error processing archive /var/cache/apt/archives/nvidia-
340_340.107-0ubuntu0.18.04.2_amd64.deb (--unpack):
new nvidia-340 package pre-installation script subprocess returned
error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-340_340.107-0ubuntu0.18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
它从来没有安装过我尝试了很多建议但它不会修复
更新
我已经关注在 18.04 上安装 nvidia 驱动程序此链接但结果仍然相同
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
dkms lib32gcc1 libc6-i386 libcuda1-340 libxnvctrl0 nvidia-opencl-icd-
340
nvidia-settings pkg-config screen-resolution-extra
Suggested packages:
menu
The following NEW packages will be installed:
dkms lib32gcc1 libc6-i386 libcuda1-340 libxnvctrl0 nvidia-340
nvidia-opencl-icd-340 nvidia-settings pkg-config screen-resolution-
extra
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/73.3 MB of archives.
After this operation, 346 MB of additional disk space will be used.
Selecting previously unselected package dkms.
(Reading database ... 277766 files and directories currently
installed.)
Preparing to unpack .../0-dkms_2.3-3ubuntu9.2_all.deb ...
Unpacking dkms (2.3-3ubuntu9.2) ...
Selecting previously unselected package libc6-i386.
Preparing to unpack .../1-libc6-i386_2.27-3ubuntu1_amd64.deb ...
Unpacking libc6-i386 (2.27-3ubuntu1) ...
Replaced by files in installed package libc6:i386 (2.27-3ubuntu1) ...
Selecting previously unselected package libcuda1-340.
Preparing to unpack .../2-libcuda1-340_340.107-
0ubuntu0.18.04.2_amd64.deb ...
Unpacking libcuda1-340 (340.107-0ubuntu0.18.04.2) ...
Selecting previously unselected package libxnvctrl0:amd64.
Preparing to unpack .../3-libxnvctrl0_418.56-
0ubuntu0~gpu18.04.1_amd64.deb ...
Unpacking libxnvctrl0:amd64 (418.56-0ubuntu0~gpu18.04.1) ...
Selecting previously unselected package lib32gcc1.
Preparing to unpack .../4-lib32gcc1_1%3a8.3.0-6ubuntu1~18.04_amd64.deb
...
Unpacking lib32gcc1 (1:8.3.0-6ubuntu1~18.04) ...
Preparing to unpack .../5-nvidia-340_340.107-
0ubuntu0.18.04.2_amd64.deb
...
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to
/usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg-divert: error: rename involves overwriting '/usr/lib/x86_64-
linux-
gnu/libGL.so.1.distrib' with
different file '/usr/lib/x86_64-linux-gnu/libGL.so.1', not allowed
dpkg: error processing archive /tmp/apt-dpkg-install-61TLve/5-nvidia-
340_340.107-0ubuntu0.18.04.2_amd64.deb (--unpack):
new nvidia-340 package pre-installation script subprocess returned
error
exit status 2
Selecting previously unselected package nvidia-opencl-icd-340.
Preparing to unpack .../6-nvidia-opencl-icd-340_340.107-
0ubuntu0.18.04.2_amd64.deb ...
Unpacking nvidia-opencl-icd-340 (340.107-0ubuntu0.18.04.2) ...
Selecting previously unselected package pkg-config.
Preparing to unpack .../7-pkg-config_0.29.1-0ubuntu2_amd64.deb ...
Unpacking pkg-config (0.29.1-0ubuntu2) ...
Selecting previously unselected package screen-resolution-extra.
Preparing to unpack .../8-screen-resolution-extra_0.17.3_all.deb ...
Unpacking screen-resolution-extra (0.17.3) ...
Selecting previously unselected package nvidia-settings.
Preparing to unpack .../9-nvidia-settings_418.56-
0ubuntu0~gpu18.04.1_amd64.deb ...
Unpacking nvidia-settings (418.56-0ubuntu0~gpu18.04.1) ...
Errors were encountered while processing:
/tmp/apt-dpkg-install-61TLve/5-nvidia-340_340.107-
0ubuntu0.18.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
尝试安装 aptitude 并使用它来代替 apt。
当出现问题时,它会尝试不同的方法来安装软件包,有时它的错误消息更有用
也许会有帮助。