如何在 Ubuntu 20.04.2 中强制安装 nvidia-driver-440

如何在 Ubuntu 20.04.2 中强制安装 nvidia-driver-440

我在使用 2x GeForce 1080Ti 显卡和 Ubuntu 20.04.2 时遇到 nvidia-driver-460 问题(启动后黑屏)。440 没问题...我该如何强制安装/降级到 440 并固定版本?

我尝试清除 nvidia* 并运行下面的程序,但最终安装了 460。

sudo apt install nvidia-driver-440

现在我已经清除了所有 Nvidia 驱动程序并恢复到默认的 X.org 驱动程序...

谢谢。

答案1

按住 Super(Win 键)并按 A,然后输入“additional”并单击出现的单个图标。

您将看到一个“附加驱动程序”列表,看看是否可以在该列表中找到合适的驱动程序
(请注意,在我的 Ubuntu 20.04.2 中我有多个 nvidia 驱动程序可供选择)。

答案2

如果需要这个 nvidia-driver-440,则采用另一种方法;

注意必须启用焦点/限制。

在文件夹 /etc/apt/preferences.d/ 下创建文件 restricted.pref,内容如下

Package: *
Pin: release  a=focal,c=restricted
Pin-Priority: 1001 

这样,包就从限制中提取出来了。

安装 nvidia 驱动,并将软件包标记为保留

sudo apt-mark hold <package name>

删除创建的文件。

笔记:

  1. 我不知道这是否是适合您的卡的正确 nvidia 驱动程序!
  2. 您必须记住在发布升级之前恢复标记包的状态!
  3. 如果您也需要 32 位软件包(steam/wine 或其他),那么只要 apt pinning 处于活动状态,您就必须安装 nvidia 软件包(32 位)。否则您的软件包管理会抱怨软件包损坏。
  4. 您应该对 apt 有一些经验才能做到这一点!

使用 apt 固定

apt-get -s install nvidia-driver-440
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnvidia-cfg1-440 libnvidia-common-440 libnvidia-compute-440 libnvidia-decode-440 libnvidia-encode-440 libnvidia-extra-440 libnvidia-fbc1-440
  libnvidia-gl-440 libnvidia-ifr1-440 nvidia-compute-utils-440 nvidia-dkms-440 nvidia-kernel-common-440 nvidia-kernel-source-440 nvidia-utils-440
  xserver-xorg-video-nvidia-440
Recommended packages:
  nvidia-settings nvidia-prime libnvidia-compute-440:i386 libnvidia-decode-440:i386 libnvidia-encode-440:i386 libnvidia-ifr1-440:i386
  libnvidia-fbc1-440:i386 libnvidia-gl-440:i386
The following packages will be REMOVED:
  linux-headers-5.4.0-72* linux-headers-5.4.0-72-generic* linux-image-5.4.0-72-generic* linux-modules-5.4.0-72-generic*
  linux-modules-extra-5.4.0-72-generic*
The following NEW packages will be installed:
  libnvidia-cfg1-440 libnvidia-common-440 libnvidia-compute-440 libnvidia-decode-440 libnvidia-encode-440 libnvidia-extra-440 libnvidia-fbc1-440
  libnvidia-gl-440 libnvidia-ifr1-440 nvidia-compute-utils-440 nvidia-dkms-440 nvidia-driver-440 nvidia-kernel-common-440 nvidia-kernel-source-440
  nvidia-utils-440 xserver-xorg-video-nvidia-440
0 upgraded, 16 newly installed, 5 to remove and 0 not upgraded.
Purg linux-headers-5.4.0-72-generic [5.4.0-72.80]
Purg linux-headers-5.4.0-72 [5.4.0-72.80]
Purg linux-modules-extra-5.4.0-72-generic [5.4.0-72.80]
Purg linux-image-5.4.0-72-generic [5.4.0-72.80]
Purg linux-modules-5.4.0-72-generic [5.4.0-72.80]
Inst libnvidia-cfg1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-common-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [all])
Inst libnvidia-compute-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-decode-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-encode-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-extra-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-fbc1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-gl-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst libnvidia-ifr1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-compute-utils-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-kernel-source-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-kernel-common-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-dkms-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-utils-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst xserver-xorg-video-nvidia-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Inst nvidia-driver-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-cfg1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-common-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [all])
Conf libnvidia-compute-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-decode-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-encode-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-extra-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-fbc1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-gl-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf libnvidia-ifr1-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-compute-utils-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-kernel-source-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-kernel-common-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-dkms-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-utils-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf xserver-xorg-video-nvidia-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])
Conf nvidia-driver-440 (440.82+really.440.64-0ubuntu6 Ubuntu:20.04/focal [amd64])

答案3

我自己想出了这个。发布只是为了以防万一有人需要这样做……或者为了我未来的自己……

  1. 我去了这里并下载了最新的 450 驱动程序。

  2. 由于我使用的是默认的 X.org / Nouveau 驱动程序,Nvidia 不允许我通过运行脚本来安装驱动程序,如下所示这里

  3. 然后我进入附加驱动程序并nvidia-drivers-390在菜单中选择。这有效,我能够使用 Nvidia 驱动程序启动而不会出现黑屏。

  4. 我按照以下方法更新了 grub启动到终端模式。

  5. 然后我运行安装脚本,450最终安装了驱动程序... 之后,恢复直接启动 X-windows。 重新启动。

终于回到了几天前的状态,没有黑屏......从现在起,我一定会等待某个版本之后再460.84尝试 Ubuntu 的默认 nvidia 驱动程序......

相关内容