Smoothwall Firewall project

Wednesday, 30 April 2014

Problem loading/starting a KVM virtual machine on a CentOS 6.5 host that has SELINUX disabled


If you have recently built a KVM host for all your virtual machines and left SELINUX enabled, then all will be well, but what happens when you turn that setting off. Well you will end up with VM's that won't load with the error message

error: Failed to start domain Ubuntu1404
error: unsupported configuration: Unable to find security driver for label selinux


It is easy to fix , use the following command and just remove the seclabel section on the virtual machine domain XML - virsh edit Ubuntu1404

# virsh edit Ubuntu1404
...
  <;seclabel type='dynamic' model='selinux' relabel='yes'>;
    <label>system_u:system_r:svirt_t:s0:c95,c664</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c95,c664</imagelabel>
  </seclabel>  

Once you have done that, the domains will load as normal.

Make sure if you have backup's of the domain XML, they are also changed, as I have found that they will over write the domain if your not careful

Check in /etc/libvirt/qemu to make sure the changes have happen, and the XML has been updated.

Thursday, 3 April 2014

Fixing a problem with VMware vcloud when putting a Virtual Machine back into the cloud Catalog




If you use vcloud, then I'm sure you have pushed fully patched and configured virtual machines back into the catalog as gold masters many times. If you have customised scripts, then you may or may not have come across this problem.

However yesterday, I came across a problem where the custom script settings within vcloud version 5.5 were not working, and the init scripts were not be run when you created a new vapp. This is a setting that tells the VM, if they have been run or not

It turns out the code for pushing VM's back into the catalog was not resetting the static file needed, to tell the init scripts to run correctly. If you look in .customisation in roots home directory, you can see the file it is looking for.

So , the work around - after much digging around in the code to find the file that VMware tools were looking for - is as follows

On a Linux system just type the following.

touch /.guest-customisation-post-reboot-pending


Once this file is in place, shutdown your VM, copy it back to the catalog, and all will be fine on the next start - it will run your desired init scripts as you wanted in the first place ;-)

Hope this saves you some time.