如何修复依赖关系/损坏的软件包

当我尝试安装系统更新、skype或phpmyadmin时,我遇到了这个错误:
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libc6 : Depends: libgcc1 but it is not going to be installed
         Depends: tzdata but it is not going to be installed
 libc6-dev : Depends: libc-dev-bin (= 2.15-0ubuntu10.3)
             Depends: linux-libc-dev but it is not going to be installed
             Recommends: gcc but it is not going to be installed or
                         c-compiler
 skype:i386 : Depends: libasound2:i386 (>= 1.0.16) but it is not going to be installed
              Depends: libc6:i386 (>= 2.3.6-6~) but it is not going to be installed
              Depends: libc6:i386 (>= 2.7) but it is not going to be installed
              Depends: libgcc1:i386 (>= 1:4.1.1) but it is not going to be installed
              Depends: libqt4-dbus:i386 (>= 4:4.5.3) but it is not going to be installed
              Depends: libqt4-network:i386 (>= 4:4.8.0) but it is not going to be installed
              Depends: libqt4-xml:i386 (>= 4:4.5.3) but it is not going to be installed
              Depends: libqtcore4:i386 (>= 4:4.7.0~beta1) but it is not going to be installed
              Depends: libqtgui4:i386 (>= 4:4.8.0) but it is not going to be installed
              Depends: libqtwebkit4:i386 (>= 2.1.0~2011week13) but it is not going to be installed
              Depends: libstdc++6:i386 (>= 4.6) but it is not going to be installed
              Depends: libx11-6:i386 but it is not going to be installed
              Depends: libxext6:i386 but it is not going to be installed
              Depends: libxss1:i386 but it is not going to be installed
              Depends: libxv1:i386 but it is not going to be installed
              Depends: libssl1.0.0:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

怎么解决这个问题?
1个回答

-f or --fix-broken

来自man apt-get页面的解释

修复;尝试在现有系统中纠正损坏的依赖关系。当与install/remove一起使用时,此选项可以省略任何软件包,以便APT能够推断出一个可能的解决方案。如果指定了软件包,那么它们必须完全正确地解决问题。在首次运行APT时,有时需要使用这个选项;APT本身不允许在系统上存在损坏的软件包依赖关系。系统的依赖结构可能会变得如此糟糕,以至于需要手动干预(通常意味着使用dselect(1)或dpkg --remove来消除一些有问题的软件包)。在某些情况下,与-m一起使用此选项可能会导致错误。配置项:APT::Get::Fix-Broken。

我建议尝试以下命令。

sudo dpkg --configure -a

sudo apt-get install -f

回答是的,对于任何提示都选择是,并让apt-get尝试为您解决问题。
编辑:
根据评论,请尝试以下命令,它应该清理您的系统。
sudo sh -c "apt-get update;apt-get dist-upgrade;apt-get autoremove;apt-get autoclean"

出现了一个先决条件问题 - 无法安装libgcc1:i386。 在处理过程中遇到了以下错误: /var/cache/apt/archives/libgcc1_1%3a4.6.3-1ubuntu5_amd64.deb /var/cache/apt/archives/libgcc1_1%3a4.6.3-1ubuntu5_i386.deb E: 内部错误,libc6没有文件名 W: 无法对'multiarch-support:amd64'执行即时配置。请参阅APT::Immediate-Configure下的man 5 apt.conf以获取详细信息。(2) E: 子进程/usr/bin/dpkg返回错误代码(1) 我尝试了很多次每个命令,我认为从上面的代码你可以帮助我。 - Nirmal T.
以下软件包存在未满足的依赖关系: libc6:依赖于libgcc1,但它将不会被安装 依赖于tzdata,但它将不会被安装 - Nirmal T.
你在用哪个版本的Ubuntu?你是从终端还是软件管理器尝试安装这些包(Skype)的? - CoalaWeb
12.04 lts,是的,我尝试过但失败了。 - Nirmal T.
你试了哪一个? - CoalaWeb
我尝试安装Skype - Nirmal T.
但是从终端还是从Ubuntu软件中心? - CoalaWeb
从终端我尝试了。 - Nirmal T.
试着运行我上面编辑好的命令来清理你的系统,然后使用下面的链接获取适用于12.04版本的.deb格式的Skype软件包,只需双击即可安装。尽可能地,如果软件管理器中没有,就获取.deb格式的软件包,这将使你的生活更轻松。http://www.skype.com/en/download-skype/skype-for-linux/downloading/?type=ubuntu64 - CoalaWeb
我需要下载并双击打开吗? - Nirmal T.
PhpMyAdmin是另外一个故事,因为您需要足够的知识来搭建LAMP服务器(Linux、Apache、MySQL和PHP)。我推荐使用XAMPP。以下是在Linux上设置它的链接,它附带了PhpMyAdmin。 http://www.apachefriends.org/en/xampp-linux.html - CoalaWeb
当我点击安装按钮时,它给了我一个错误。请检查是否使用了第三方软件源。如果是,请禁用它们,因为它们常常是问题的根源。 此外,在终端中运行以下命令:apt-get install -f - Nirmal T.
是的,你只需要做的就是下载.deb软件包(通常是针对你的版本或至少32位或64位),然后双击它们,它们会在Ubuntu软件中心中打开。 - CoalaWeb
你有在系统中添加任何仓库吗?你一开始尝试的确切命令是什么? - CoalaWeb
请问我在哪里可以查看存储库?我不知道,请帮忙。 - Nirmal T.
尼尔马尔,如果你对Ubuntu还不熟悉,为什么要试图从终端安装软件包呢?我觉得你需要多读一些资料!你尝试运行我之前回答中提到的命令了吗? - CoalaWeb
是的,我执行了这个命令 sudo sh -c "apt-get update;apt-get dist-upgrade;apt-get autoremove;apt-get autoclean"。 - Nirmal T.
现在请告诉我如何清理一切并使用下载和双击重新安装,请帮忙。 - Nirmal T.
你的声望不足以进行聊天,为了避免大量评论,我建议你进行全新安装,并在你有一些经验之前不要使用终端。要安装应用程序,请使用软件管理器或下载的.deb包。祝好运。 - CoalaWeb
+1 对于这次编辑,解决了我在最近一次更新出错后遇到的一系列问题。 - Elder Geek