Debian Wheezy,apt-get 有未满足的依赖关系

Debian Wheezy,apt-get 有未满足的依赖关系

几乎我尝试的任何涉及的命令apt-get都会给我一个错误,告诉我我应该运行apt-get -f install,但这给了我这个错误:

root@vps148794:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 cpp-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 g++-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 gcc-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libgcc1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libgomp1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libitm1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libquadmath0 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libstdc++6 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
 libstdc++6-4.7-dev : Depends: gcc-4.7-base (= 4.7.2-5) but it is not installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

似乎gcc-4.7缺失是个问题,但如果我尝试apt-get install gcc-4.7

root@vps148794:~# apt-get install gcc-4.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-4.7 is already the newest version.
gcc-4.7 set to manually installed.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 cpp-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 g++-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 gcc-4.7 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libgcc1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libgomp1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libitm1 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libquadmath0 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libstdc++6 : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
 libstdc++6-4.7-dev : Depends: gcc-4.7-base (= 4.7.2-5) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

为什么会发生这种情况?如何恢复 apt-get 以便可以安装东西?我完全无法安装,因为无论我尝试安装什么都会出现此错误。也许这能有所帮助?

root@vps148794:~# apt-cache policy gcc-4.7 g++-4.7
gcc-4.7:
  Installed: 4.7.2-5
  Candidate: 4.7.2-5
  Version table:
 *** 4.7.2-5 0
        500 http://ftp.debian.org/debian/ wheezy/main amd64 Packages
        500 http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages
        100 /var/lib/dpkg/status
g++-4.7:
  Installed: 4.7.2-5
  Candidate: 4.7.2-5
  Version table:
 *** 4.7.2-5 0
        500 http://ftp.debian.org/debian/ wheezy/main amd64 Packages
        500 http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages
        100 /var/lib/dpkg/status


root@vps148794:~# apt-cache policy gcc-4.7-base
gcc-4.7-base:
  Installed: (none)
  Candidate: 4.7.2-5
  Version table:
     4.7.2-5 0
        500 http://ftp.debian.org/debian/ wheezy/main amd64 Packages
        500 http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages

来源列表:

deb http://ftp.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
#deb http://apt.izzysoft.de/ubuntu generic universe
deb http://ftp.fr.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.fr.debian.org/debian/ wheezy main contrib non-free
deb http://cdn.debian.net/debian wheezy-backports main

答案1

你真的应该好好想想你在这里做什么。Debian Wheezy 现在完全不受支持,而且在某个时候(我不记得是否已经宣布过)它将从(主)镜像中删除。

答案在于gcc-4.7已安装和gcc-4.7-base编辑显示未安装之间的区别。安装它应该会有所帮助。(我真的无法解释你为什么会陷入那种境地。)

还有一件事:我不知道 izzysoft.de repo 里有什么,但它似乎是为 ubuntu 制作的,混合这样的存储库可能会非常危险。

相关内容