Can't Re-enable SELinux

General support questions
Post Reply
glenng
Posts: 1
Joined: 2019/07/03 17:25:15

Can't Re-enable SELinux

Post by glenng » 2019/07/03 21:30:20

I created a T2.small instance in Amazon Web Services and selected Centos 7 for its operating system. Once the server was running, I opened /etc/selinux/config and changed SELINUX=enforcing to SELINUX=disabled and rebooted. SELinux was disabled and everything worked fine. Later I changed the config file to enforcing again and tried to reboot. The server went down, but it never came back up. The AWS console showed that the instance was running, but it failed a status check and was unresponsive to SSH or HTTP. It stayed like that for an hour and a half before I gave up and turned it off. Is there a way to get my server back?

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

Re: Can't Re-enable SELinux

Post by TrevorH » 2019/07/03 22:23:31

If you can either

access the console during the boot and get to the grub menu and edit the default choice and append enforcing=0 to the end of it and boot with that
OR
you can mount the filesystem somehow from a rescue media and edit /etc/sysconfig/selinxu and change SELINUX=enforcing to SELINUX=permissive then you should be able to boot up.

The correct way to go from disabled to enforcing is this

edit /etc/sysconfig/selinux and change SELINUX=disabled to SELINUX=permissive
touch /.autorelabel
reboot
wait
wait a bit more
when it comes back up, now you can change from permissive to enforcing.
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