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:
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.
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.
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
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, that’s wrong it has to be set for the SELINUX variable. In the screenshot below I show you the correct settings in the config file to disable SELINUX.
5) Now reboot and everything should be fine!
11 replies on “CentOS 6 kernel panic selinux config file error”
it saved me a lot of trouble!
Thanks a lot.
It’s not coincidence that I wrote this. Ran into that same trouble once 😀
thanks a lot. it worked. 🙂
This website has helped me to fix the same issue on RHEL 6.5 machine. Thanks a lot.
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.
thanks, it works.
Same problem, but enforcing=0 doesn’t work. Any suggest?
You can also boot the machine using the LiveCD rescue mode, mount the filesystem and edit the file to correct your mistake.
yes i have done thanks
Hi Stan. Same error after giving enforcing=0. Doesn’t work. Also I tried with live CD. But unable to mount at bash prompt.
Hello Raja K,
I suspect your kernel panic has nothing to do with a wrong edit in the selinux config file.