Can’t Install php5-dev on Ubuntu 12.04 running OpenVZ

openvzubuntu-12.04

I'm trying to fetch the php apc package using pecl and running into a problem that I believe may be caused by OpenVZ. To do so I need php5-dev. When I try to install it via apt-get, I get this:

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

As I try to manually install dependencies (without success), I believe I've identified libc6-dev as the culprit.

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

I have libc6 installed on the system. If it's any help here is my 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

This is a very frustrating problem, as I have other instances of Ubuntu 12.04 running just fine elsewhere (though not on OpenVZ).

Best Answer

Easy Fix, what you need to do is specify the version of libc6-dev you want to install (the openvz one in this case), and it will install fine.

Heres how to figure out what you want, ok say you are going to do

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.

In this case you want it to install the 2.15-0ubuntu10+openvz0 version, try it again specifying the version like this (notice the =version at the end of the line now):

 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.

As you can see here there wound up being 1 more package that it wanted an 'openvz' version for, so i just added that package onto the apt-get install line again specifying the version

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]?

And now it works!!!

Hope this helped you out , I ran into it myself a few times and knowing how to fix it PROPERLY can help alot, there are alternative ways to get around the error but this is the 'correct' way.