4

For some reason, on one of the servers that we have in our network running Ubuntu Server 12.04, the version of libxml2 is 2.8.0 (which is the one from Ubuntu 12.10).
This creates some issues, especially since I need to install libxml2-dev and I get some unmet dependencies. I get the following error:

libxml2-dev : Depends: libxml2 (= 2.7.8.dfsg-5.1ubuntu4.9) but 2.8.0+dfsg1-5ubuntu2.2 is to be installed

I do not know why the newer version of libxml2 is present on the system, but is there a way to either use the new version of libxml2-dev (which is not present in the default sources.list) or to safely downgrade libxml2 to the correct version for 12.04?

Pabi
  • 7,429

1 Answers1

4

try:

apt search libxml2

this command show search from any evidence: repositories and installed packages.

so if you will see for example for trusty:

libxml2/trusty-updates,trusty-security,now 2.9.1+dfsg1-3ubuntu4.3 amd64
[installed]
  GNOME XML library

libxml2-dbg/trusty-updates,trusty-security 2.9.1+dfsg1-3ubuntu4.3 amd64
  Debugging symbols for the GNOME XML library

libxml2-dev/trusty-updates,trusty-security,now 2.9.1+dfsg1-3ubuntu4.3 amd64
  [installed,automatic]
  Development files for the GNOME XML library

so, obviously, if you see this output you are have alot of chances to install version.

However if you need the package strictly by version, try indicate the version alike this:

sudo apt-get install libxml2=2.9.1+dfsg1-3ubuntu4.3
sudo apt-get install libxml2-dbg=2.9.1+dfsg1-3ubuntu4.3
sudo apt-get install libxml2-dev=2.9.1+dfsg1-3ubuntu4.3

OR by indicating target repository:

sudo apt-get install libxml2/precise libxml2-dbg/precise libxml2-dev/precise 

After it’s installed, run the following command to hold your installed version, preventing the package manager from automatically updating it in the future:

sudo echo "libxml2 hold" | sudo dpkg –set-selections

With --no-remove option apt-get will exit installation process anytime without any prompts if any packages are to be removed:

sudo apt-get install --no-remove libxml2=2.7.8.dfsg-5.1ubuntu4.9

Other goody: --no-install-recommends which claim the apt-get do not consider recommended packages as a dependency for installing.

Read apt-get precise pangolin manpages

Hope it help you.

swift
  • 3,291