Accidentally removed libselinux and nothing works

General support questions
Post Reply
RajeshB61
Posts: 3
Joined: 2018/06/13 14:10:34

Accidentally removed libselinux and nothing works

Post by RajeshB61 » 2018/06/13 14:13:12

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

yum or rpm commands also show the same error. I do have files as below.

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

But /usr/lib64/libselinux.so.1 seems to be empty. I cant do an ssh or scp oe wget to download the files.

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: Accidentally removed libselinux and nothing works

Post by pjsr2 » 2018/06/13 18:07:27

When you are booting the computer, add option

Code: Select all

selinux=0
to the kernel command line. That'll disable selinux and all your programs should work again. Than you can reinstall the selinux library.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Accidentally removed libselinux and nothing works

Post by TrevorH » 2018/06/13 18:12:45

I don't think that will work if the programs are linked against it and it's missing. Your best bet is to boot the install DVD in rescue mode - it's an option off the troubleshooting menu - then copy the version of that file off the DVD onto your system, probably renaming the original first just in case. Once it boots then yum reinstall libselinux-2.5-12.el7.x86_64 to make sure everything is correct.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

RajeshB61
Posts: 3
Joined: 2018/06/13 14:10:34

Re: Accidentally removed libselinux and nothing works

Post by RajeshB61 » 2018/06/13 19:47:36

Hi,

The machine has CentOS 7 image on it. We will try to see if a reboot can work.

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Accidentally removed libselinux and nothing works

Post by desertcat » 2018/06/14 05:49:13

TrevorH wrote:
2018/06/13 18:12:45
I don't think that will work if the programs are linked against it and it's missing. Your best bet is to boot the install DVD in rescue mode - it's an option off the troubleshooting menu - then copy the version of that file off the DVD onto your system, probably renaming the original first just in case. Once it boots then yum reinstall libselinux-2.5-12.el7.x86_64 to make sure everything is correct.
... It also pays BIG time if you have a recent backup. I make two FULL DISK backups: one right after a point release happens and I have configured it the way I want, and the second just before the next point release comes out, just in case the next update blows up the computer. In between I am now making weekly backup of key directories and partition using Backupninja. Once you get the machine backup and running you might want to consider installing Backupninja and set it to automatically backup key files, directories, etc. at some frequency you like (I have mine set to weekly). Trust me it will save your butt should it ever need saving.

RajeshB61
Posts: 3
Joined: 2018/06/13 14:10:34

Re: Accidentally removed libselinux and nothing works

Post by RajeshB61 » 2018/06/14 10:57:53

Thanks for the response. We will explore it. However, a reboot couldn't solve it. So building it again from a similar server.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Accidentally removed libselinux and nothing works

Post by TrevorH » 2018/06/14 11:31:17

I did say you need to boot the install DVD in rescue mode. Your current system is broken because of that missing file and you won't be able to do it from there.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply