Dirtbag's Blog

Centos VM will not start on XENserver 6.2 after disabling selinux

[ link: XENserver-selinux-problem | tags: xenserver centos selinux | updated: Fri, 17 Apr 2020 12:08:58 -0400 ]

I was trying to disable selinux on my centos 6.5 VM running on XENserver and after I set "SELINUXTYPE=disabled" in the /etc/selinux/config file and rebooted, the VM would NOT come up. I tried rebooting the VM a few more times and got nothing.

The only thing I could see on the console of the VM that was failing to boot was:

 PCI: Fatal: No config space access function found
ipmi_si: Could not set up I/O space
ipmi_si: Could not set up I/O space
ipmi_si: Could not set up I/O space

So I finally figured out that it was still selinux's fault that It was not booting.. But how to disable it now?! I found a cool trick to use on the XENserver itself to edit the grub config of the failing VM in question. What you do is ssh into your XENserver and run the following command to list out your VMs:

xe vm-list 

and you should see something like this:

 uuid ( RO)           : f93bbb2d-2f72-5950-3634-6f79fae59bac
     name-label ( RW): CentOS 6 host1
    power-state ( RO): running

I want to edit this hosts' grub file, so after you make sure the host is off, you can run the following to edit it:

xe-edit-bootloader -n "CentOS 6 host1" -p 1

The "-p 1" means partition 1, you may have to modify this value for yours.
Find the "kernel" line in your grub.conf and append the following to the end of it "selinux=0" so it would now look something like this:

 kernel /vmlinuz-2.6.32-431.29.2.el6.x86_64 ro root=/dev/mapper/vg_host1-lv_root rd_NO_LUKS LANG=en_US.UTF-8
rd_LVM_LV=vg_host1/lv_root rd_NO_MD console=hvc0 KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto
rd_NO_DM rd_LVM_LV=vg_host1/lv_swap rhgb quiet selinux=0

Exit out of the editor and boot your VM.

UPDATE It turns out that I had a typo in my "/etc/selinux/config" file.. I did something stupid like SELINUXTYPE=disabled and this caused the server to crash on boot.

-db

Like this article? Buy me a beer!