我安装了全新的 Ubuntu 14.04.03,但遇到了以前从未遇到过的问题。
登录新安装后,我做的第一件事是 apt-get update 和 upgrade。然后我想安装 apache2,但收到一条错误消息,说我的软件包已损坏。
我甚至不知道该从哪里开始查找,因为以前从未发生过这种情况。我试过了apt-get autoclean
,apt-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
答案1
您的sources.list
系统受到严重损坏,缺少关键存储库,因此无法使用。
你失踪了非常多您必须拥有的东西 - 至少,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
用这个替换了你的,相应地调整你的国家镜像,用archive.ubuntu.com
你的两个字母的国家代码替换,CC.archive.ubuntu.com
运行CC
sudo apt-get update; sudo apt-get upgrade
并再次应用所有更新。然后,尝试安装您的软件。
答案2
这实际上是对此处答案的评论托马斯·沃德,但作为评论来说它太长了,而且我认为它不能算作编辑。经验更丰富或更有特权的人可能会判断如何适当调整它。
还有反向移植。这些是较新版本的 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 的架构,似乎还有不同的来源。再次,将 trusty 替换为您当前的 Ubuntu 版本。架构已于 2016-04-19 添加到 packages.ubuntu.com 的可搜索数据库中。如果您已经拥有与 archives.ubuntu.com 相同的存储库,则它们将是重复的。它位于 ports.ubuntu.com 并列出了 arm64、armhf、powerpc 和 ppc64el。