Nvidia 驱动程序 390 损坏的依赖项安装阻止卸载或全新安装

Nvidia 驱动程序 390 损坏的依赖项安装阻止卸载或全新安装

当我尝试升级到 440 时,我意外地破坏了我的 nvidia 驱动程序 390。我不记得我具体做了什么,但它涉及在 bash.rc 中写入 sudo 并遵循一些在线帮助。我真的很想不必重新安装 Ubuntu,因为 Windows 10 是双启动的。

Ubuntu 18.04

nvcc --version 返回:Cuda 9.2

nvidia-smi 返回:command not found...

但是现在,我无法完全卸载 cuda 或 nvidia 驱动程序(我尝试过清除 nvidia/cuda 并运行 cuda.pl 卸载文件和其他一些常规技术)。我也无法手动、自动安装或通过软件界面安装任何新驱动程序。

在执行非常基本的命令(例如 sudo apt-get update 或 sudo apt -f install)时,我收到以下错误。

$ sudo apt -f install
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:
  libnvidia-cfg1-390 libnvidia-common-390
  libnvidia-fbc1-390 libnvidia-fbc1-390:i386
  libnvidia-gl-390 libnvidia-gl-390:i386
  libnvidia-ifr1-390 libnvidia-ifr1-390:i386
  libwayland-client0:i386 libwayland-server0:i386
  nvidia-dkms-390 nvidia-kernel-common-390
  nvidia-kernel-source-390
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nvidia-390
The following NEW packages will be installed:
  nvidia-390
0 upgraded, 1 newly installed, 0 to remove and 22 not upgraded.
2 not fully installed or removed.
Need to get 0 B/74.1 MB of archives.
After this operation, 308 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 260157 files and directories currently installed.)
Preparing to unpack .../nvidia-390_390.116-0ubuntu1_amd64.deb ...
Unpacking nvidia-390 (390.116-0ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-390_390.116-0ubuntu1_amd64.deb (--unpack):
 trying to overwrite '/sbin/create-uvm-dev-node', which is also in package nvidia-kernel-common-390 390.138-0ubuntu0.18.04.1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-390_390.116-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

于是我……

$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libcuda1-390 : Depends: nvidia-390 (>= 390.116) but it is not installed
 nvidia-opencl-icd-390 : Depends: nvidia-390 (>= 390.116) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

我尝试直接安装 nvidia-390,并删除它所说的具有未满足的依赖关系的两个文件并继续循环到这个错误。

答案1

最佳解决方案:

sudo apt-get update --fix-missing

sudo dpkg --configure -a

sudo apt-get install -f

sudo apt-get clean

sudo apt-get autoremove

解锁 dpkg – (消息 /var/lib/dpkg/lock)

sudo fuser -vki /var/lib/dpkg/lock.

sudo dpkg --configure -a

您可以使用以下命令删除锁文件:

sudo rm /var/lib/apt/lists/lock

您可能还需要删除缓存目录中的锁定文件

sudo rm /var/cache/apt/archives/lock

现在可以安装 Nvidia-390:

首先,检测你的 nvidia 显卡型号和推荐的驱动程序。执行以下命令:

ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001180sv00001458sd0000353Cbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-304 - distro non-free
driver   : nvidia-340 - distro non-free
driver   : nvidia-390 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

如果您同意该建议,请随意再次使用 ubuntu-drivers 命令安装所有推荐的驱动程序:

sudo ubuntu-drivers autoinstall

sudo apt install nvidia-390

sudo apt update

sudo apt upgrade

安装完成后,重新启动系统即可完成。

使用 PPA 存储库自动安装 Nvidia Beta 驱动程序

使用图形驱动程序 PPA 存储库允许我们安装最新的 Nvidia 测试版驱动程序,但风险在于系统不稳定。

首先将 ppa:graphics-drivers/ppa 存储库添加到您的系统中:

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

sudo apt update

接下来,确定您的显卡型号和推荐的驱动程序:

ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001C03sv00001043sd000085ABbc03sc00i00
vendor   : NVIDIA Corporation
model    : GP106 [GeForce GTX 1060 6GB]
driver   : nvidia-driver-390 - third-party free
driver   : nvidia-driver-410 - third-party free recommended
driver   : nvidia-driver-396 - third-party free
driver   : xserver-xorg-video-nouveau - distro free builtin

现在安装所需的驱动程序,即 nvidia-390 sudo ubuntu-drivers autoinstall

sudo apt install nvidia-390

sudo apt update

sudo apt upgrade

完成后,重新启动系统。

答案2

我曾经遇到过这个问题。为了解决这个问题,我必须重新启动到单用户模式,卸载所有与 nvidia 驱动程序和 cuda 相关的旧软件包,然后重新安装。

  1. 从 nvidia 网站下载软件包
  2. 重新启动进入单用户模式。这可以通过多种方式实现,但需要重新启动、单击egrub 菜单上的字母,然后编辑启动参数。在 Ubuntu 16 中,这需要在行末添加以“linux”开头、以“ro”结尾的单词single。您可能需要检查您的 Ubuntu 版本需要什么
  3. 尝试从系统中卸载 cuda 包和 nvidia 驱动程序。您提到对每个包使用 dpkg clean。(完美!)
  4. 转到下载的软件包并重新安装每个开始使用 nvidia 视频驱动程序。
  5. 我建议重新启动系统,然后安装 cuda 包。

相关内容