无法在 Ubuntu 18.04 上安装 nvidia 驱动程序

无法在 Ubuntu 18.04 上安装 nvidia 驱动程序

因此我尝试为我的笔记本电脑安装 nvidia 驱动程序(它有 GeForce 940MX),但没有成功。

我正在尝试通过输入以下内容来安装它们:

 sudo ubuntu-drivers autoinstall

不幸的是,这个失败了并给出以下输出:

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-driver-396 : Depends: nvidia-dkms-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: nvidia-utils-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Recommends: nvidia-settings but it is not going to be installed
                     Recommends: nvidia-prime (>= 0.8) but it is not going to be installed
                     Recommends: libnvidia-compute-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-decode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-encode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-ifr1-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-fbc1-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-gl-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
E: Unable to correct problems, you have held broken packages.

你能向我解释一下具体问题是什么吗(我很难理解它)以及我应该怎么做才能解决它?

答案1

有些软件包有未满足的依赖关系,可能是因为 PPA,但不清楚。我的建议是先使用以下命令删除 PPA:

sudo apt-add-repository -r ppa:graphics-drivers/ppa

(请注意-r“删除”的意思)

接下来你要确保你的软件包列表是最新的:

sudo apt update

接下来您应该删除所有已安装的 nvidia 软件包:

sudo apt remove nvidia*
sudo apt autoremove

现在尝试调用驱动程序自动安装程序:

sudo ubuntu-drivers autoinstall

如果您仍然遇到有关保留软件包的问题,​​则可能是因为您在启用 PPA 时更新了某些软件包,在这种情况下,我建议运行:

sudo apt install aptitude
sudo aptitude install <name_of_package_with_conflicts>

这将引发一系列交互式问题,基本上向你展示包的所有方式可以如果您要删除另一个软件包或降级一个软件包等,则需要安装它们。逐步进行,直到找到适合您需要的选项(您不必接受给出的第一个选项)

答案2

您的依赖项已损坏。尝试使用以下方法修复它们

$ sudo apt -f install

相关内容