Linux – YUM not working in CENTOS 7 after installing httpd

centos7linuxpythonyum

I just installed CENTOS 7 on my vmware.
After YUM update everything worked fine for sometime then system suddenly crashed and asked me to Logout.

In console in tried to yum update but it showed following error:

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

/lib64/libxml2.so.2:File too short

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

Its possible that the above module does not match the current version
of Python, which is 2.7.5 (default, Sept 2016, 22:37:46) [GCC 4.8.5
2015(Red Hat 4.8.5-4)]

I followed this answer but, did not work for me.
I just know basic of Linux OS so please help me fix this issue.

I get the following error :
Error on YUM Update

DF command

Best Answer

Download libxml2 to your system:

wget http://centos.mirrors.ovh.net/ftp.centos.org/7.2.1511/updates/x86_64/Packages/libxml2-2.9.1-6.el7_2.3.x86_64.rpm

Re-install the libxml2 package with RPM

rpm -Uvh --force libxml2-2.9.1-6.el7_2.3.x86_64.rpm

Finally, attempt to reinstall the package (to ensure correct versioning) using yum.

yum reinstall libxml2

If you continue to receive errors it would seem as though there has been some underlying filesystem corruption or the underlying block device in the virtual machine is thin provisioned without enough actual filesystem space on the hypervisor to support that much space.