软件包依赖关系树损坏:未满足的依赖关系

软件包依赖关系树损坏:未满足的依赖关系

我刚刚做了以下事情后就破坏了我的依赖树:

sudo apt-get update
sudo apt-get upgrade

现在,当我尝试安装任何东西时,我收到以下错误

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:
 ffmpeg : Depends: libavdevice57 (>= 7:3.4.4) but it is not going to be installed
          Depends: libsdl2-2.0-0 (>= 2.0.8) but it is not going to be installed
 libglx-mesa0 : Depends: libglapi-mesa (= 18.0.5-0ubuntu0~18.04.1) but 18.2.2-0ubuntu1~18.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我尝试

sudo apt --fix-broken install

我收到以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libglx-mesa0
The following packages will be upgraded:
  libglx-mesa0
1 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
37 not fully installed or removed.
Need to get 0 B/134 kB of archives.
After this operation, 9 216 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 238586 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb ...
Unpacking libglx-mesa0:amd64 (18.2.2-0ubuntu1~18.04.1) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.44-0ubuntu1
Errors were encountered while processing:
 /var/cache/apt/archives/libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试通过以下方式安装 libglx-mesa0

sudo apt-get install libglx-mesa0

但我收到以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  libglx-mesa0
1 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
37 not fully installed or removed.
Need to get 134 kB of archives.
After this operation, 9 216 B of additional disk space will be used.
Get:1 http://fr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libglx-mesa0 amd64 18.2.2-0ubuntu1~18.04.1 [134 kB]
Fetched 134 kB in 0s (895 kB/s)       
(Reading database ... 238586 files and directories currently installed.)
Preparing to unpack .../libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb ...
Unpacking libglx-mesa0:amd64 (18.2.2-0ubuntu1~18.04.1) over (18.0.5-0ubuntu0~18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0', which is also in package nvidia-396 396.44-0ubuntu1
Errors were encountered while processing:
 /var/cache/apt/archives/libglx-mesa0_18.2.2-0ubuntu1~18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

你能帮我修理一下吗?

答案1

尝试安装 Nvidia 驱动程序时遇到了类似的问题。

sudo apt purge nvidia*

切换回 nouveau 驱动程序并重新启动(此时你的依赖问题应该已经修复)

重新启动时按 SHIFT 键,这将调出 GRUB 引导加载程序。

进入 GRUB 后,按“e”键编辑默认条目,并在“quiet splash”之前添加“nomodeset”

登录后再次安装 Nvidia 驱动程序,可能(如果您有 GUI)使用 Ubuntu 中软件更新实用程序的“附加驱动程序”选项卡。我使用的是 Nvidia 410,如果您没有任何特殊需求,我建议您也这样做。

编辑:如果您需要 CUDA + NVIDIA 410:

sudo apt-key adv --fetch-keys  http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo bash -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
sudo apt update
sudo apt install nvidia-driver-410
sudo apt install cuda-10-0

如果你只想要 CUDA,请跳过 nvidia-driver-410 的安装

相关内容