CentOS 6 kernel panic selinux config file error

If you get a kernel panic on CentOS or RedHat as shown below and you recently changed the selinux config, then there might be an error in the config file.

None of the kernels in the GRUB boot menu will boot, you get a kernel panic:

Kernel panic - not syncing:  Attempted to kill init! Pid: 1, comm: init Not tainted 2.6.32-504.3.3.el6.x86_64 #1 panic+0xa7/0x16f do_exit+0x862/0x870 fput+0x25/0x30 do_group_exit+0x58/0xd0 sys_exit_group+0x17/0x20 system_call_fastpath+0x16/0x1b

Kernel panic – not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-504.3.3.el6.x86_64 #1
panic+0xa7/0x16f
do_exit+0x862/0x870
fput+0x25/0x30
do_group_exit+0x58/0xd0
sys_exit_group+0x17/0x20
system_call_fastpath+0x16/0x1b


Booting in single user mode doesn’t work either.

Here’s how to fix this:
1) Reboot, and go in the GRUB menu. You have 3 seconds to strike the arrow keys before it will automatically boot the default kernel.

GRUB boot menu

GRUB boot menu

2) Select the first line, the default kernel, and press the E key on the keyboard to edit the parameters. You will then see the following.

Edit GRUB boot options

Edit GRUB boot options

3) Use the arrow keys to select the 2nd line, that starts with kernel. Press the E key to change this line, use the arrow keys to go to the end and type a space followed by enforcing=0

GRUB edit kernel line

GRUB edit kernel line

4) Press enter to conform and then press B to boot the system.
It should boot up fine now.
Now edit the selinux config file (/etc/sysconfig/selinux) and correct your mistake.
In my case I set disabled for the SELINUXTYPE variable, hat’s wrong it has to be for the SELINUX variable. In the screenshot below I show you the correct settings in the config file to disable SELINUX.

SELINUX disabled correctly

SELINUX disabled correctly

5) Now reboot and everything should be fine!

  1. it saved me a lot of trouble!
    Thanks a lot.

  2. It’s not coincidence that I wrote this. Ran into that same trouble once 😀

  3. thanks a lot. it worked. 🙂

  4. AAA BBB CCC

    This website has helped me to fix the same issue on RHEL 6.5 machine. Thanks a lot.

  5. thakurmohit3@gmail.com

    Thanx a lot.
    I am installing centos(6.5) seven times in our system. But every time i am facing kernel panic problem.
    With the help of this artical i am resolve this problem.

  6. thanks, it works.

  7. Same problem, but enforcing=0 doesn’t work. Any suggest?

  8. You can also boot the machine using the LiveCD rescue mode, mount the filesystem and edit the file to correct your mistake.

  9. yes i have done thanks

Leave a Reply