未满足依赖关系,并且“apt-get -f install”不起作用(Ubuntu 12.04)

未满足依赖关系,并且“apt-get -f install”不起作用(Ubuntu 12.04)

朋友给了我一个 vps,让我在上面放一个网站。但我发现几乎不可能安装任何软件:

例如:

root@ubuntu12:~# apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (< 2.16) but 2.17-0ubuntu4 is to be installed
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.13) but 2.17-0ubuntu4 is to be installed
 libnih1 : PreDepends: libc6 (< 2.16) but 2.17-0ubuntu4 is to be installed
 nginx : Depends: nginx-full but it is not going to be installed or
                  nginx-light but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

root@ubuntu12:~# apt-get install htop
Reading package lists... Done
Building dependency tree
Reading state information... Done
htop is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc-dev-bin : Depends: libc6 (< 2.16) but 2.17-0ubuntu4 is to be installed
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.13) but 2.17-0ubuntu4 is to be installed
 libnih1 : PreDepends: libc6 (< 2.16) but 2.17-0ubuntu4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我认为问题出在libc6包装上,但我担心移除包装libc6会导致另一个问题。我应该采取什么正确的解决方案?

答案1

可能的解决方案是ppa-purge手动下载和安装,然后删除有问题的 ppa。我高度怀疑,这是由一些 PPA 引起的。

  1. 下载并安装ppa-purge。对于12.04,官方ppa-purge可以从这个Ubuntu镜像手动下载http://mirrors.kernel.org/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb

    使用 wget 下载

    wget -c http://mirrors.kernel.org/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb
    

    安装dpkg

    sudo dpkg -i ppa-purge_0.2.8+bzr56_all.deb
    

    假设你下载了确切的版本

  2. 然后逐个删除 PPA。你应该知道系统中添加了哪些 PPA。

    sudo ppa-purge ppa:repository-name/subdirectory
    

注 1:此命令将删除 ppa 存储库以及从该存储库安装的软件包。因此,简单地删除存储库源代码行并不能解决问题。

笔记2:如果您找不到 PPA 名称,则无法查看/etc/apt/sources.list.d/目录,通过查看.list那里的文件,您将获得已安装哪些 PPA 的提示。Google 可以帮助您从这些文件名中找到 PPA 的名称。

相关内容