Linux apt-get 更新时出现“未满足的依赖关系错误”Ubuntu 16.04

Linux apt-get 更新时出现“未满足的依赖关系错误”Ubuntu 16.04

为什么我无法在 Ubuntu 16.04 中安装一些软件包

如果我尝试: sudo apt-get install update 我会得到:

The following packages have unmet dependencies:
linux-image-extra-4.4.0-64-generic : Depends: linux-image-4.4.0-64-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-4.4.0-64-generic but it is not going to be installed
                   Recommends: thermald but it is not going to be installed
y-ppa-manager : Depends: yad (>= 0.36.0) but it is not going to be installed
             Depends: libnotify-bin but it is not going to be installed
             Depends: ppa-purge but it is not going to be installed
             Depends: xterm
             Depends: launchpad-getkeys (>= 0.3.2) but it is not going to be installed
             Depends: python-appindicator but it is not going to be installed
             Depends: python-gtk2 but it is not going to be installed
             Depends: xclip but it is not going to be installed
             Recommends: gksu but it is not going to be installed or
                         kdesudo but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我也尝试过: sudo add-apt-repository ppa:webupd8team/y-ppa-manager

但是没用。

请提出建议。

答案1

解决依赖关系问题的最基本方法是运行:

sudo apt-get -f install

-f的缩写--fix-broken。这将尝试纠正损坏的依赖关系。如果您手动安装了具有未满足依赖关系的软件包,apt-get则会尽可能安装这些依赖关系,否则它可能会简单地删除您安装的软件包以解决问题。

继续运行:

sudo dpkg --configure -a

然后再次运行:

sudo apt-get -f install

如果仍然出现相同的错误,请删除并添加刚刚添加的存储库。让我知道进展如何。

答案2

首先删除未满足依赖关系的部分安装的软件包

因此,如果您在安装软件包时遇到依赖问题,然后想要删除部分安装的软件包,请按照以下步骤操作:

运行审核以显示具有未满足依赖关系的软件包: dpkg --auditsudo dpkg --audit

强制删除有问题的软件包:dpkg --remove --force-all [name of package]

之后,运行

sudo apt-get -f install

然后

sudo dpkg --configure -a

最后重复sudo apt-get -f install

此时,输出应为

0 已升级,0 已新安装,0 已删除,1 未升级

现在您可以sudo apt-get update并且您的机器应该恢复正常了。

相关内容