无法在运行 OpenVZ 的 Ubuntu 12.04 上安装 php5-dev

无法在运行 OpenVZ 的 Ubuntu 12.04 上安装 php5-dev

我正在尝试使用 pecl 获取 php apc 包,但遇到了一个我认为可能是由 OpenVZ 引起的问题。为此,我需要 php5-dev。当我尝试通过 apt-get 安装它时,我得到了以下信息:

php5-dev : Depends: libssl-dev but it is not going to be installed
            Depends: libtool (>= 2.2) but it is not going to be installed

当我尝试手动安装依赖项(但没有成功)时,我相信我已经确定 libc6-dev 是罪魁祸首。

libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.2) but 2.15-0ubuntu10+openvz0 is to be installed

我在系统上安装了 libc6。如果有帮助的话,这是我的 sources.list:

deb http://archive.ubuntu.com/ubuntu precise main restricted universe
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu precise partner

这是一个非常令人沮丧的问题,因为我的其他 Ubuntu 12.04 实例在其他地方运行良好(但不在 OpenVZ 上)。

答案1

轻松修复,您需要做的就是指定要安装的 libc6-dev 版本(在本例中为 openvz 版本),然后它就会安装成功。

以下是如何弄清楚你想要什么,好吧,说你要做什么

apt-get install libc6-dev
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:
 libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.4) but 2.15-0ubuntu10+openvz0 is to be installed
             Recommends: gcc but it is not going to be installed or
                         c-compiler
E: Unable to correct problems, you have held broken packages.

在这种情况下,您希望它安装 2.15-0ubuntu10+openvz0 版本,请再次尝试指定如下版本(请注意现在行末尾的 =version):

 apt-get install libc6-dev=2.15-0ubuntu10+openvz0
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:
 libc6-dev : Depends: libc-dev-bin (= 2.15-0ubuntu10+openvz0)
             Recommends: gcc but it is not going to be installed or
                         c-compiler
E: Unable to correct problems, you have held broken packages.

正如你在这里看到的,最终有 1 个软件包需要“openvz”版本,因此我只需将该软件包添加到 apt-get install 行中,并再次指定版本

apt-get install libc6-dev=2.15-0ubuntu10+openvz0 libc-dev-bin=2.15-0ubuntu10+openvz0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  gcc gcc-4.6 libquadmath0 linux-libc-dev manpages-dev
Suggested packages:
  gcc-multilib autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.6-multilib libmudflap0-4.6-dev gcc-4.6-doc gcc-4.6-locales libgcc1-dbg
  libgomp1-dbg libquadmath0-dbg libmudflap0-dbg binutils-gold glibc-doc
The following NEW packages will be installed:
  gcc gcc-4.6 libc-dev-bin libc6-dev libquadmath0 linux-libc-dev manpages-dev
0 upgraded, 7 newly installed, 0 to remove and 4 not upgraded.
Need to get 13.6 MB of archives.
After this operation, 33.5 MB of additional disk space will be used.
Do you want to continue [Y/n]?

现在它可以工作了!

希望这对你有帮助,我自己也遇到过几次,知道如何解决它适当地 可以提供很大帮助,还有其他方法可以解决错误,但这是“正确”的方法。

相关内容