Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error message when trying to install libxml2-dev on ubuntu

Tags:

ubuntu

libxml2

Environment: Ubuntu 20.04

Ran sudo apt-get install libxml2-dev in terminal. However it returned the messages below:

Reading package lists... Done
Building dependency tree... Done
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:
 libxml2-dev : Depends: libxml2 (= 2.9.10+dfsg-6.3ubuntu0.1) but 2.9.12+dfsg-0+ubuntu21.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

What does libxml2-dev : Depends: libxml2 (= 2.9.10+dfsg-6.3ubuntu0.1) but 2.9.12+dfsg-0+ubuntu21.04.1+deb.sury.org+1 is to be installed mean? How can I solve it?

Thanks!

like image 873
Willow Lu Avatar asked Feb 06 '26 12:02

Willow Lu


2 Answers

I had a similar situation: libxml2-dev : Depends: libxml2 (= 2.9.3+dfsg1-1ubuntu0.7) but 2.9.4-1+deb.sury.org~xenial+2 is to be installed

I somehow had a newer version, than the package depended on. I solved this with a downgrade: apt-cache policy libxml2 --> apt install libxml2=2.9.3+dfsg1-1ubuntu0.7

like image 108
sajtdavid Avatar answered Feb 09 '26 09:02

sajtdavid


Solution here (but I wrote the tutorial in French) : https://forum.ubuntu-fr.org/viewtopic.php?pid=22551079

Long story short : Uninstall ppa:ondrej/php via ppa-purge solved my issue !

command to run:

sudo add-apt-repository --remove ppa:ondrej/php
like image 39
Sky3RN Avatar answered Feb 09 '26 09:02

Sky3RN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!