Linux KVM – Error: ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy

When you try to install virtual machine with virt-install or the Virtual Machine Manager you get the following Error:

 

root@syss:~# 
virt-install --connect qemu:///system
--name syss-test
--ram 1024
--disk syss-test.img,size=8
--network=network:default
--vnc
--noautoconsole
--os-type linux
--accelerate
--cdrom /home/syss/Downloads/debian-7.6.0-amd64-netinst.iso
Starting install...
ERROR internal error: Process exited while reading console log output: char device redirected to /dev/pts/45 (label charserial0)
ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
failed to initialize KVM: Device or resource busy

This is mostly because you have either VirtualBox or VMware running on the same machine. The reason (at least that’s what I think) is that the kernel module of VirtualBox or VMware and KVM can’t take Advantage of Intel VT-x or AMD-V at the same time.

So if you want to run both at the same time you have to deactivate the virtualisation in one of them.

This is a way where you can at least have the machines emulated with QEMU

root@syss:~# 
virt-install --connect qemu:///system
--name syss-test
--ram 1024
--disk syss-test.img,size=8
--network=network:default
--vnc
--noautoconsole
--os-type linux
--accelerate
--cdrom /home/syss/Downloads/debian-7.6.0-amd64-netinst.iso
--virt-type=qemu

Just add –virt-type=qemu at the end. This is not as fast as Intel VT-x or AMD-V but it works in parallell.

Puppet Agent (client) copy-paste script for Debian and Ubuntu

This is a simple script you can copy and paste to your console to install puppet on a new host. You just need to edit the first two lines with the server information and then sign the requested certificate on the puppet master.

# Stefan Süss
# www.sysstem.at
 
#you only need to edit these 2 lines
SERVER_IP=10.0.0.100
SERVER_DNS=puppet.sysstem.at
 
DEBIAN_RLS=$(cat /etc/os-release | grep VERSION= | awk -F '('  '{print $2}' | awk -F ')' '{print $1}')
PUPPET_DEB=puppetlabs-release-$DEBIAN_RLS.deb
PUPPET_CONF=/etc/puppet/puppet.conf
 
#add server IP to hosts
echo "$SERVER_IP  $SERVER_DNS" >> /etc/hosts
#download the right release of puppet
wget https://apt.puppetlabs.com/$PUPPET_DEB
#install the package
dpkg -i $PUPPET_DEB
#update sources
apt-get update
#install puppet. Needs /dev/null . otherwise it would catch the pasted input
apt-get -y install puppet < "/dev/null"
#remove templatedir
sed -i 's/templatedir/#templatedir/g' $PUPPET_CONF
#insert server
#http://www.theunixschool.com/2012/06/insert-line-before-or-after-pattern.html
sed -i "s/.*#templatedir.*/&nserver=${SERVER_DNS}/" $PUPPET_CONF
#start puppet agent for the first time (generates the certificate)
puppet agent --onetime --verbose --no-daemonize --waitforcert 1
 
#newline

You can also find the script here: Github