全部。我正在尝试修复我的系统,以便安装 nvidia 驱动程序,但似乎出于某种原因卡住了。我尝试手动从
/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb
/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb
... 以便让它们再次下载但无济于事。最近有人尝试在 18.04 上安装这些驱动程序吗?
~$ sudo apt --fix-broken install
[sudo] password for jarl:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
lib32gcc1 libc6-i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libnvidia-gl-390 libnvidia-gl-390:i386
The following NEW packages will be installed
libnvidia-gl-390 libnvidia-gl-390:i386
0 to upgrade, 2 to newly install, 0 to remove and 4 not to upgrade.
3 not fully installed or removed.
Need to get 0 B/29,1 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 214344 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-390_390.48-0ubuntu3_i386.deb ...
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: mismatch on package
when removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 by libnvidia-gl-390'
found 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb (--unpack):
new libnvidia-gl-390:i386 package pre-installation script subprocess returned error exit status 2
Preparing to unpack .../libnvidia-gl-390_390.48-0ubuntu3_amd64.deb ...
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: mismatch on package
when removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 by libnvidia-gl-390'
found '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: error processing archive /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb (--unpack):
new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb
/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
在 ubuntu 论坛上找到了这个命令,对我来说效果很好:
跑步:
LC_MESSAGES=C dpkg-divert --list '*nvidia-340*' | sed -nre 's/^diversion of (.*) to .*/\1/p' | xargs -rd'\n' -n1 -- sudo dpkg-divert --remove
sudo apt --fix-broken install
第一个命令将从中删除所有转移的软件包nvidia-340
。如果您有其他 nvidia 版本“转移”,请更改它;阅读错误代码以了解哪个版本正在转移。
来源:https://ubuntuforums.org/showthread.php?t=2388026&p=13761809#post13761809 向 stutteringp0et2 致敬:)
答案2
这里是另一个论坛中有完整答案
答案的基本前提是:
- 您有想要删除的旧依赖项
- 你想清理混乱
- 你想安装新的驱动程序
我猜你安装的 340 驱动程序有问题 - 这是我遇到的问题
删除旧的依赖项
LC_MESSAGES=C dpkg-divert --list '*nvidia-340*' | sed -nre 's/^diversion of (.*) to .*/\1/p' | xargs -rd'\n' -n1 -- sudo dpkg-divert --remove
清理混乱 - 取决于您安装的混乱,如果不能开箱即用,请找出它;)
sudo dpkg --force-all -P nvidia-390 nvidia-compute-utils-390 nvidia-dkms-390 nvidia-prime nvidia-settings nvidia-opencl-icd-340 nvidia-opencl-icd-384 nvidia-kernel-source-390 nvidia-kernel-common-390 libnvidia-cfg1-390 libnvidia-common-390 libnvidia-compute-390 libnvidia-decode-390 libnvidia-encode-390 libnvidia-fbc1-390 libnvidia-ifr1-390 sudo apt purge --autoremove '*nvidia*' sudo apt-get update sudo apt-get upgrade
安装新的推荐驱动程序
ubuntu-drivers devices nvidia-settings
我的建议是:
不要只是为了检查是否安装了而摆弄这个糟糕的驱动程序中的设置:)
答案3
我通过删除 nvidia-340 的 divert 解决了这个问题。希望我不需要使用nvidia-340
。以下是一个例子:
dpkg-divert --package nvidia-340 --remove /usr/lib/i386-linux-gnu/libGL.so.1
无论何时遇到冲突,您都可以继续删除。
答案4
我会运行 apt auto-clean 并查看它是否如我所想的那样,是一个混乱的包。
sudo apt auto-clean
sudo apt update
sudo apt upgrade
sudo apt install nvidia-driver-390 libvulkan1
编辑:回答你的另一个问题,前几天我安装 18.04 时 390 运行良好,但升级到 396 有点“麻烦”。这个帮我解决了这个问题。