libxml2.so.2: cannot open shared object file: No such file or directory

cleohost asked:

Can anyone help me to resolve yum issue as below:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

libxml2.so.2: cannot open shared object file: No such file or directory

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.6.6 (r266:84292, Jun 20 2019, 14:14:55)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

My answer:


It appears that a critical system library was somehow removed from your system. You didn’t specify how it happened, so you may also have other problems that you need to solve after solving this problem.

To replace the missing files, you will need to locate the RPM package corresponding to this file, manually download it and reinstall it.

For example:

Find the version of the package that the system thinks is installed:

[[email protected] ~]# rpm -q libxml2
libxml2-2.7.6-21.el6_8.1.x86_64

Download the corresponding package of the same version.

Then manually reinstall it:

[[email protected] ~]# rpm -Uvh --replacepkgs libxml2-2.7.6-21.el6_8.1.x86_64.rpm

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.