Monthly Archives: August 2008

playing with ubuntu, kvm and ubuntu-vm-builder

OSCON 2008 turned me on to some new virtualization tools. Right now I build VMs by using a Capistrano script that connects to a vmware server, builds a vmdk, creates a custom vmx via an erb, and netboots the box for a debian install.

I’m looking at moving to having ubuntu-vm-builder create ubuntu boxes instead. So I built an ubuntu blade first. I don’t know how long it takes to build a vmware box, but it takes a bit for the preseeded debian install to run, maybe 15 minutes. The first box I built with ubuntu-vm-builder made me happy:

apt-get install ubuntu-vm-builder
time sudo ubuntu-vm-builder kvm hardy –mem 2048 –mirror http://ubuntu.widemile.com/ubuntu
[snip]
real    2m21.705s
user    0m33.254s
sys     0m22.941s

I then installed kvm (apt-get install kvm) but got this error when it tried to start the kvm init script:

FATAL: Error inserting kvm_intel (/lib/modules/2.6.20-16-generic/kernel/drivers/kvm/kvm-intel.ko): Operation not supported

LP #104297 made me check the dmesg, and I saw:

  kernel: [ 899.340000] kvm: disabled by bios

I restarted, hit bios, and enabled VT. And then on startup the kvm module was already loaded.

It took me a bit to figure out qemu though. It’s important to read both the kvm and qemu man pages. When I first started it I saw errors about the framebuffer, and realized that since I was ssh’d into a remote machine, there wasn’t one. I found the “-nographic” option, but I later confirmed that the ubuntu install doesn’t configure a serial console by default (too bad). I spent a lot of time messing around with -vnc (an example in the man page would have been awesome). Starting up qemu and switching to the console I checked out ‘info vnc’ and it kept teling me that it wasn’t loaded. I tried ‘-vnc :0,password’ but when I ran ‘change vnc password’ in the console it would also segmentation fault.

Finally I figured out to run kvm/qemu WITH ‘-vnc’ and WITHOUT ‘-nographic’. Also, the standard network format for is ‘-vnc :n’ where an is an integer. The port you connect to becomes 5900+n. So if you start qemu/vnc with ‘-vnc :1’ you would connect to port 5901.

This isn’t any sort of advance performance benchmark, but running ‘time bzip2 -d linux-source.2.6.24.tar.gz2’ on the ubuntu kvm install took 15.967s (real) and on a debian vmware-server install it took 27.870s.

thoughts on making nagios alarms trigger a flashing red light

We’ve been joking for a while about how we need a big red flashing light to be triggered by nagios alarms. I’m not going to do it right now, but I thought about it.

There’s a debian x10 package for controlling x10 modules. Get a big rotating red light that runs on AC. Plug it into an X10 lamp module. I can’t find a “CP-290” module which is what the x10 package calls for. You could use this Powerlinc Serial/TW523 controller. It has source available, so you could figure out the protocol if it wasn’t compatible. Then write a script and keep it running (or cron) to do something like ‘/usr/sbin/nagios2stats -m -d NUMSVCPROB,NUMHSTPROB’ which prints out the number of service and host problems. If either of those are > 0, use the x10 module to turn the light on.