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?

1 Answer 1

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.

4
  • 1
    Thanks for the ideas. I tried doing an apt-get install libxml2=2.7.8.dfsg-5.1ubuntu4.9 and it seems to work but it asks to remove 76 packages in the process...
    – Mircea M
    Jul 24, 2014 at 12:13
  • Use: apt-get install --no-remove libxml2=2.7.8.dfsg-5.1ubuntu4.9 With --no-remove option apt-get will exit installation process anytime without any prompts if any packages are to be removed. Also other option will be helpful for you: --no-install-recommends which claim the apt-get do not consider recommended packages as a dependency for installing. TO DO: update answer.
    – swift
    Jul 24, 2014 at 13:21
  • 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 “package hold” | sudo dpkg –set-selections
    – swift
    Jul 24, 2014 at 13:33
  • 1
    Really big thanks for all the help. I tried what you suggested and I got this: 0 upgraded, 0 newly installed, 1 downgraded, 76 to remove and 12 not upgraded. E: Packages need to be removed but remove is disabled.
    – Mircea M
    Jul 25, 2014 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .