1

I have accidentally removed libselinux on centos 7.4 and am unable to install it again and all commands fail. How do i recover?

ls: error while loading shared libraries: libselinux.so.1: cannot open shared object file: No such file or directory

yum install libselinux-2.5-12.el7.x86_64 There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:

libselinux.so.1: cannot open shared object file: No such file or directory

I do have files as below.

[root@localhost lib64]# locate libselinux. /usr/lib/tmpfiles.d/libselinux.conf /usr/lib64/libselinux.so.1

2

Boot the install media into rescue mode. Use yum --installroot=/mnt/sysimage to install the package in the broken system's root. Should that not work, you can download the rpm, extract this library, and copy it into place.

Or, backup data on the host, and build a new VM from scratch.

(And to prevent future occurrences: avoid becoming the root user.)

  • if you have similar system or install it on VM and then copy the file to server doing rsync or scp, hope it resolves – Vijay Muddu Jun 13 '18 at 12:41
  • I can't run yum/rpm. How can i install ? – Rajesh Reddy B Jun 13 '18 at 13:26
  • Like I said in my answer, you can rebuild a new operating system from scratch. It is possible to extract a libselinux from an rpm package (with rpm2cpio) or from a working system, but its tricky as you need to be in rescue mode. – John Mahowald Jun 15 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.