因此,Mint 19 在更新管理器中使用 Nvidia 的 465 驱动程序让我感到惊讶,我尝试安装它;但它所做的一切(很难判断它是否下载了任何东西)只是告诉我它“无法应用更改!首先修复损坏的软件包。”
令人担忧的是,没有任何关于哪个包被损坏的注释,而且我也没有任何 Synaptic 知道被损坏的东西。我还没有重新启动我的系统,因为我不知道我当前的驱动程序是否仍然可行。
尝试通过 apt 执行此操作告诉我,许多软件包已被“保留”;有趣的是,它们都以 455 结尾。
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
libnvidia-cfg1-455 libnvidia-common-455 libnvidia-compute-455
libnvidia-compute-455:i386 libnvidia-decode-455 libnvidia-decode-455:i386
libnvidia-encode-455 libnvidia-encode-455:i386 libnvidia-extra-455
libnvidia-fbc1-455 libnvidia-fbc1-455:i386 libnvidia-gl-455
libnvidia-ifr1-455 libnvidia-ifr1-455:i386 nvidia-compute-utils-455
nvidia-kernel-common-455 nvidia-kernel-source-455
xserver-xorg-video-nvidia-455
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
我只能假设我的包组织出了问题,但我真的不知道它是什么或如何修复它。我希望有人能为我阐明这一点。我从未以非 apt 的方式在这台机器上安装过驱动程序,而且对我来说,实际上很少有一个损坏的软件包。
尝试手动安装上述软件包给了我这个。
$ sudo apt install libnvidia-cfg1-455 libnvidia-common-455 libnvidia-compute-455 libnvidia-compute-455:i386 libnvidia-decode-455 libnvidia-decode-455:i386 libnvidia-encode-455 libnvidia-encode-455:i386 libnvidia-extra-455 libnvidia-fbc1-455 libnvidia-fbc1-455:i386 libnvidia-gl-455 libnvidia-ifr1-455 libnvidia-ifr1-455:i386 nvidia-compute-utils-455 nvidia-kernel-common-455 nvidia-kernel-source-455 xserver-xorg-video-nvidia-455
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-kernel-common-455 : Depends: nvidia-kernel-common-465 but it is not going to be installed
nvidia-kernel-source-455 : Depends: nvidia-kernel-source-465 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
这对我来说特别奇怪,因为它意味着 455 依赖于 465,而 465 本来就不应该存在。
答案1
#!/bin/bash
# script: list-nvidia.sh
# author: Craig Sanders <[email protected]>
# license: Public Domain (this script is too trivial to be anything else)
# options:
# default/none list the packages, one per line
# -v verbose (dpkg -l) list the packages
# -h hold the packages with apt-mark
# -u unhold the packages with apt-mark
# build an array of currently-installed nvidia packages.
PKGS=( $(dpkg -l '*nvidia*' '*cuda*' '*vdpau*' 2>/dev/null |
awk '/^[hi][^n]/ && ! /mesa/ {print $2}') )
case "$1" in
"-v") dpkg -l "${PKGS[@]}" ;;
"-h") apt-mark hold "${PKGS[@]}" ;;
"-u") apt-mark unhold "${PKGS[@]}" ;;
*) printf "%s\n" "${PKGS[@]}" ;;
esac
此脚本可以每行或以详细dpkg -l
格式列出已安装的 nvidia 相关软件包。
它还可以用于apt-mark
保留和取消保留 nvidia 软件包 - 我在之前和之后立即使用这些选项,apt-get dist-upgrade
以确保 nvidia 驱动程序仅在以下情况下升级我想要它(即当我准备好重新启动我的系统,或者杀死并重新启动X时)。
printf
如果我想用列表做其他事情,比如在命令替换中使用它,那么简单的列表(带有)非常有用 - 例如apt purge $(list-nvidia.sh)
。 Debian 软件包名称中永远不会有空格或换行符等,因此无需对引用抱有偏执。