1

I enabled selinux to make some tests (with enforcing) and now my AWS instance is unable to boot. From the instance screenshot I see that it can't start some services like login

How can I recover the instance?

here a screenshot of the errors enter image description here

1 Answer 1

2

It looks like none of your files have SELinux labels.

You should first set SELinux to permissive. You will need to start a new instance and attach your existing instance's EBS volume to it to make this change and allow you to boot it again.

After you boot the system with SELinux in permissive mode, you can relabel all your files with restorecon -rv /, then finally you can reboot in enforcing mode.


For future reference you should never set SELinux to disabled. If you must "disable" it for something, you should either set SELinux to permissive, or set a single SELinux domain to permissive (for a single service).

4
  • You can usually also touch /.autorelabel to force relabelling on subsequent boot.
    – bodgit
    Mar 20, 2019 at 15:59
  • @bodgit Because EC2 doesn't provide live access to the VM console, I prefer to do this manually. Mar 20, 2019 at 16:02
  • the current app doesn't have selinux enable so when I setup the AWS i disable it and setup the same machine there, but now we want to enable it so i was trying to make some tests. Basically if I want to enable it on the live server I need to set permissive use restorecon -rv / and then use enforcing right?
    – DevWizard
    Mar 21, 2019 at 8:16
  • @Sebastiano That's correct. Mar 21, 2019 at 13:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .