完全删除旧的 Nvidia 驱动程序

Eat*_*ate 13 uninstall nvidia graphics drivers 18.04

我最近安装了全新安装的 Ubuntu,并通过 nvidia-driver-390 下载了一些 Nvidia 驱动程序。我注意到还安装了 nvidia-340(作为“二进制驱动程序”而不是“驱动程序元包”)。有趣的。后来,我安装了 nvidia-driver-396。我想删除版本340和390,所以我只能用396我已经使用sudo apt remove --purge nvidia-340 nvidia-390和卸载也有些相关的包(的nvidia-commonnvidia-currentnvidia-settingsnvidia-primenvidia-kernel-common*,等),在这一点上,我只是想删除所有从我的系统跟踪 Nvidia 驱动程序并重新开始。不幸的是,在包含的“软件和更新”中,仍然列出了驱动程序 340、390 和 396。附上截图。谢谢你的帮助。在此处输入图片说明

ls -la /etc/apt/sources.list.d

total 44
drwxr-xr-x 2 root root 4096 Jul 10 08:43 .
drwxr-xr-x 6 root root 4096 May 20 12:58 ..
-rw-r--r-- 1 root root  142 Jul 10 08:43 alexlarsson-ubuntu-flatpak-bionic.list
-rw-r--r-- 1 root root  142 Jul 10 08:43 alexlarsson-ubuntu-flatpak-bionic.list.save
-rw-r--r-- 1 root root   57 Jul 10 08:43 etcher.list
-rw-r--r-- 1 root root   57 Jul 10 08:43 etcher.list.save
-rw-r--r-- 1 root root  132 Jul 10 08:43 gezakovacs-ubuntu-ppa-bionic.list
-rw-r--r-- 1 root root  132 Jul 10 08:43 gezakovacs-ubuntu-ppa-bionic.list.save
-rw-r--r-- 1 root root  189 Jul 10 08:43 google-chrome-beta.list
-rw-r--r-- 1 root root  189 Jul 10 08:43 google-chrome-beta.list.save
-rw-r--r-- 1 root root  144 Jul 10 08:43 graphics-drivers-ubuntu-ppa-bionic.list
Run Code Online (Sandbox Code Playgroud)

注意:所以你必须删除ppa才能完全删除它?

cat /etc/apt/sources.list

# deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
deb http://us.archive.ubuntu.com/ubuntu/ bionic-proposed main universe restricted multiverse
Run Code Online (Sandbox Code Playgroud)

ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001382sv000010DEsd00001065bc03sc00i00
vendor   : NVIDIA Corporation
model    : GM107 [GeForce GTX 745]
driver   : nvidia-340 - third-party free
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-396 - third-party free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

== /sys/devices/pci0000:00/0000:00:1c.7/0000:04:00.0 ==
modalias : pci:v000014E4d00004365sv00001028sd00000016bc02sc80i00
vendor   : Broadcom Limited
model    : BCM43142 802.11b/g/n (Wireless 1704 802.11n + BT 4.0)
driver   : bcmwl-kernel-source - distro non-free
Run Code Online (Sandbox Code Playgroud)

注意:第二个是我的无线网卡,第一个是我的显卡,这是关于。

ubuntu-drivers list

nvidia-driver-390
nvidia-340
nvidia-driver-396
bcmwl-kernel-source
Run Code Online (Sandbox Code Playgroud)

注意:同样,前三个是我要删除的,最后一个是我的无线网卡。

Bob*_*Bob 15

注意ubuntu-drivers devices命令输出 - 有以下几行:

driver   : nvidia-340 - third-party free
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-396 - third-party free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin
Run Code Online (Sandbox Code Playgroud)

这些行意味着您可以使用来自第三方存储库的 nvidia 340、390、396 驱动程序和来自发行版存储库的开源 nouveau 驱动程序。只向您推荐一名司机。该列表并不意味着所有提到的驱动程序都已安装在您的系统中。它仅表示安装驱动程序的潜在可能性。该列表不能手动更改,因为它是由ubuntu-drivers旨在自动检测、检查和安装可用的 Ubuntu 存储库的专有驱动程序的实用程序形成的。

因此,要更改列表,必须删除第三方存储库,在特定情况下这是专有的 GPU 驱动程序存储库。但极不推荐这样做,因为您的目标是无论如何都要保留 nvidia 396 驱动程序,并从自动创建的 nvidia 340 和 390 驱动程序列表中删除。如果您删除第三方存储库,则只会检测到可用的发行版驱动程序,在特定情况下只有 340 和 390 - 因此,您将获得最不适合您的情况。

我对你的建议是什么都不做。您的系统看起来很健康,一切正常。

如果您喜欢实验,请遵循以下指南。

以下描述仅用于实验目的 - 如果您不确定,请不要这样做!

Ctrl+Alt+F4,登录并删除所有 nvidia 员工:

sudo apt remove nvidia-*
Run Code Online (Sandbox Code Playgroud)

接下来删除专有 PPA GPU 驱动程序存储库。在终端运行:

sudo add-apt-repository --remove ppa:graphics-drivers/ppa
sudo apt update
Run Code Online (Sandbox Code Playgroud)

然后检查终端中的可用驱动程序:

ubuntu-drivers devices
Run Code Online (Sandbox Code Playgroud)

您会看到第三方 nvidia 驱动程序已经消失,只有发行版 nvidia 驱动程序可用。在驱动程序中,nvidia 396 将不存在,因为该驱动程序不是 Ubuntu 发行版存储库的一部分。

添加您的 PPA 专有 GPU 驱动程序存储库:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
Run Code Online (Sandbox Code Playgroud)

再次安装您想要的 nvidia 396:

sudo ubuntu-drivers autoinstall
Run Code Online (Sandbox Code Playgroud)

重启:

sudo reboot
Run Code Online (Sandbox Code Playgroud)

重新启动后,键入nvidia-smi将显示有关您的图形卡的不同信息,如下所示:

xyz@xyz-workstation:~$ nvidia-smi
Mon Apr 27 12:41:50 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64.00    Driver Version: 440.64.00    CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 166...  On   | 00000000:01:00.0 Off |                  N/A |
| N/A   45C    P8     1W /  N/A |    470MiB /  5944MiB |      5%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1905      G   /usr/lib/xorg/Xorg                            28MiB |
|    0      2058      G   /usr/bin/gnome-shell                          47MiB |
|    0      2956      G   /usr/lib/xorg/Xorg                           145MiB |
|    0      3133      G   /usr/bin/gnome-shell                         120MiB |
|    0      3587      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files   122MiB |
+-----------------------------------------------------------------------------+

Run Code Online (Sandbox Code Playgroud)

对于具有 nvidia-prime 的系统,如果它返回错误,则键入sudo prime-select intel然后重新启动,然后键入sudo prime-select nvidia然后再次重新启动。现在输入nvidia-smi,它应该可以工作。此方法适用于大多数具有内核的系统,直到 5.4

另外请参阅我的帖子


For*_*ver 9

  1. nvidia-installer --uninstall
  2. sudo apt remove nvidia-*

  • 它说找不到命令 (4认同)