当前位置: 首页 > 工具软件 > Y PPA Manager > 使用案例 >

译文】添加PPA之后遇到未满足的依赖关系如何解决?

秦禄
2023-12-01

【译文】添加PPA之后遇到未满足的依赖关系如何解决?

通常当我们通过sudo apt-get install soft_name安装东西时,会遇到如下的错误:

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:

 package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed

E: Unable to correct problems, you have held broken packages.


怎样才能解决这个问题呢?

APT是一个适用于Debian系列(比如Ubuntu)的包管理系统,大多数情况下,APT能够很容易的安装、移除、升级软件包。在极少数情况下,当缺乏第三方依赖包的情况下apt-get会在运行结束时给出无法完成软件安装的错误信息。

解决方案:

经常性的备份/etc/apt/source.list是个不错的想法。如果在你改变了它的情况下可以轻易的恢复。

  • 如果错误信息是以下形式:

<some-package>:Depends: <other-package> ( = version ) but this-version is to be installed

那么请确保restricted 和 universe仓库可用。键盘按下Alt+F2,输入software-properties-gtk,再按Enter。

在Ubuntu software标签下,确保所有仓库可用。


  • 一种“未满足依赖”的可能情况就是软件包数据库发生错乱,或许一些软件包没有正确地安装,为了解决这个问题,打开终端运行以下命令:

sudo apt-get clean


或者

sudo apt-get autoclean


apt-get clean clears out the local repository of retrieved package files (the .deb files). It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. apt-get autoclean clears out the local repository of retrieved package files, but unlike apt-get clean, it only removes package files that can no longer be downloaded, and are largely useless.


  • 另一种基础的修复方式。运行以下命令

sudo apt-get -f install


-f意思是“fix broken”apt会试着修复破损的依赖关系

如果是手动安装的软件包,那就运行以下命令:

sudo dpkg --configure -a 然后再运行sudo apt-get -f install


如果输出以下信息:

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

证明失败了

  • 另外一种方案是运行以下命令:

sudo apt-get -u dist-upgrade


如果有任何保留的软件包,最好是消除他们。软件包会保留下来是因为依赖关系冲突导致apt不能解析

运行以下命令:

sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade


如果不能修复冲突,会以以下方式退出:

0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

这时就需要一个一个地删除这些保留的软件包,每次都运行dist-upgrade直到没有保留软件包。然后重新安装任何需要的软件包。请确保使用了 --dry-run选项

完整的操作就是:

sudo apt-get remove --dry-run package-name


  • 因为删除软件包不是一个好办法,你也许还需要试着去找到包含软件包依赖关系的仓库
  • 原文:Since removing the package you are trying to install may not be ideal, 
  • you might also try finding a repository that has packages you need to satisfy the dependencies.

Y PPA Manager is an one stop shop for all of your PPA needs.


Here are some of its features:

  • search packages in all Launchpad PPAs
  • list and download packages in a PPA
  • add / remove / purge a PPA
  • backup and restore PPA sources
  • remove duplicate PPA sources

To install Y PPA Manager, open terminal by hitting Alt+Ctrl+T and run following commands:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager


Considering the question, apt is broken, so use these commands instead

sudo su

and

32 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_i386.deb && dpkg -i ./*.deb


64 Bit:

mkdir y-ppa-manager && cd y-ppa-manager && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/launchpad-getkeys_0.3.2-1~webupd8~oneiric_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/y-ppa-manager_0.0.8.6-1~webupd8~precise_all.deb && wget https://launchpad.net/~webupd8team/+archive/y-ppa-manager/+files/yad_0.17.1.1-1~webupd8~precise_amd64.deb && dpkg -i ./*.deb



















 类似资料: