Apt没有安装大多数已知的包

我安装了一个新的Ubuntu 14.04.03,我遇到了一个我以前从未遇到过的问题。

登录新安装时我做的第一件事就是apt-get update和upgrade。 然后我想安装apache2但是我收到一个错误,我已经破坏了包。 破坏的依赖关系/包

我甚至都不知道我应该从哪里开始看,因为之前从未发生过这件事。 我尝试了apt-get autocleanapt-get -f install但它没有做任何事情。

任何帮助深表感谢!

编辑:

 sync-s@sync-s:~$ apt-cache policy apache2 apache2-bin ssl-cert apache2: Installed: (none) Candidate: 2.4.7-1ubuntu4.5 Version table: 2.4.7-1ubuntu4.5 0 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages apache2-bin: Installed: (none) Candidate: 2.4.7-1ubuntu4.5 Version table: 2.4.7-1ubuntu4.5 0 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages ssl-cert: Installed: (none) Candidate: (none) Version table: 

试图安装php5:

 sync-s@sync-s:~$ sudo apt-get install php5 Reading package lists... Done Building dependency tree Reading state information... Done 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: php5 : Depends: libapache2-mod-php5 (>= 5.5.9+dfsg-1ubuntu4.14) but it is not going to be installed or libapache2-mod-php5filter (>= 5.5.9+dfsg-1ubuntu4.14) but it is not going to be installed or php5-cgi (>= 5.5.9+dfsg-1ubuntu4.14) but it is not going to be installed or php5-fpm (>= 5.5.9+dfsg-1ubuntu4.14) but it is not going to be installed Depends: php5-common (>= 5.5.9+dfsg-1ubuntu4.14) but it is not going to be installed E: Unable to correct problems, you have held broken packages. 

尝试安装mysql-server-5.5:

 sync-s@sync-s:~$ sudo apt-get install mysql-server-5.5 Reading package lists... Done Building dependency tree Reading state information... Done 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: mysql-server-5.5 : Depends: libdbi-perl but it is not installable Depends: mysql-client-5.5 (>= 5.5.46-0ubuntu0.14.04.2) but it is not going to be installed Depends: mysql-server-core-5.5 (>= 5.5.46-0ubuntu0.14.04.2) but it is not going to be installed Recommends: libhtml-template-perl but it is not installable E: Unable to correct problems, you have held broken packages. 

尝试安装proftpd:

 sync-s@sync-s:~$ sudo apt-get install proftpd Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package proftpd 

/etc/apt/sources.list的内容:

 # deb cdrom:[Ubuntu-Server 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted #deb cdrom:[Ubuntu-Server 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted deb http://security.ubuntu.com/ubuntu trusty-security main deb-src http://security.ubuntu.com/ubuntu trusty-security main deb http://security.ubuntu.com/ubuntu trusty-security universe deb-src http://security.ubuntu.com/ubuntu trusty-security universe deb http://security.ubuntu.com/ubuntu trusty-security multiverse deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. deb http://archive.canonical.com/ubuntu trusty partner deb-src http://archive.canonical.com/ubuntu trusty partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu trusty main deb-src http://extras.ubuntu.com/ubuntu trusty main 

尝试安装apache2的依赖项:

 sync-s@sync-s:~$ sudo apt-get install apache2-bin Reading package lists... Done Building dependency tree Reading state information... Done 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: apache2-bin : Depends: libapr1 (>= 1.5.0) but it is not installable Depends: libaprutil1 (>= 1.5.0) but it is not installable Depends: libaprutil1-dbd-sqlite3 but it is not installable or libaprutil1-dbd-mysql but it is not installable or libaprutil1-dbd-odbc but it is not installable or libaprutil1-dbd-pgsql but it is not installable or libaprutil1-dbd-freetds but it is not installable Depends: libaprutil1-ldap but it is not installable E: Unable to correct problems, you have held broken packages. sync-s@sync-s:~$ sudo apt-get install libapr1 Reading package lists... Done Building dependency tree Reading state information... Done Package libapr1 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libapr1' has no installation candidate 

您的sources.list被严重破坏,缺少CRITICAL存储库,因此无法使用。

你错过了很多你必须拥有的东西 – 至少是在Trusty发布时创建的trusty主存储库; 没有这些,你无法安装任何东西。 这是因为trusty-security仅包含安全更新; 它不包含系统的基本软件包,只运行trusty-security而且在源代码中不trusty ,这将导致一切都爆炸。


我将假设您只需要可靠+安全更新,而不是标准更新存储库。

这个sources.list是从14.04 Server ISO的SquashFS文件系统中提取的,从ISO本身提取。 它有一些变化,我会相应地评论,或者我从上面的列表来源中提取。

 # The original Trusty repository, for Main, Universe, and Multiverse pockets. # DO NOT REMOVE THIS! deb http://archive.ubuntu.com/ubuntu/ trusty main universe multiverse # Security updates for Main, Universe, and Multiverse pockets. # DO NOT REMOVE THIS, OR YOUR SYSTEM MAY BECOME A SECURITY RISK! deb http://security.ubuntu.com/ubuntu/ trusty-security main universe multiverse # Standard software updates for Main, Universe, and Multiverse pockets. # You do not need to keep these enabled, but you can if you wish to. deb http://archive.ubuntu.com/ubuntu/ trusty-updates main universe multiverse ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. deb http://archive.canonical.com/ubuntu trusty partner deb-src http://archive.canonical.com/ubuntu trusty partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu trusty main deb-src http://extras.ubuntu.com/ubuntu trusty main 

一旦你用这个替换你的/etc/apt/sources.list ,通过用CC.archive.ubuntu.com替换archive.ubuntu.comCC.archive.ubuntu.com调整你的国家镜像,其中CC是你的双字母国家代码,运行sudo apt-get update; sudo apt-get upgrade sudo apt-get update; sudo apt-get upgrade 并再次应用所有更新 。 然后,尝试安装您的软件。

这真的是对托马斯·沃德的答案的评论,但是评论太长了,我认为它不符合编辑资格。 有经验或特权的人可以判断如何适当调整。

还有后退。 这些是更新版本的Ubuntu中提供的更新版本。 这些被认为不太稳定,但已经过测试。 如果您没有使用其他版本,请将trusty替换为您当前的Ubuntu版本。 deb-src只包含源而不是二进制文件。

 # Backports deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse 

似乎还有一个不同的源可用于非标准PC的架构。 再次,用您当前版本的Ubuntu替换trusty。 这些架构已于2016-04-19在packages.ubuntu.com上添加到可搜索数据库中。 如果您已经拥有与archives.ubuntu.com等效的存储库,则它们将是重复的。 它位于ports.ubuntu.com并列出了arm64,armhf,powerpc和ppc64el。