Testing a live CD with QEMU-KVM

I read an article recently on Ars Technica about the recent design changes in Gnome. Over all it looks like Gnome is pushing forward with some interesting ideas and the article ended with a note that a live CD was available on the Gnome site that showed off the new interface. Creating a new virtual machine seems a little heavyhanded just to take a peek at the latest Gnome build so I am starting to use QEMU for that sort of thing. Here is all you need to do:

kvm -m 1024 -vga vmware -boot d -cdrom ~/Downloads/GNOME-3.4.iso

This kvm command comes from the qemu-kvm package which would obviously need to be installed. You may notice it resize a bunch of times before it settles down. This is a known bug, that is easily worked around by just giving it a few seconds to work itself out or resizing the window yourself. Anyway, that aside this a pretty useful way to test a live CD. Enjoy!

Update: 2014-06-14: Things have changed a little since I wrote this.
First, this works much better if your processor supports virtualization. You might need to turn this on in your BIOS. If your CPU supports it the following command will tell you. You can see ‘vmx’ highlighted in the output below:

mike@sleepycat:~☺ egrep '(vmx|svm)' /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms

This means we can pass -enable-kvm to the new qemu-system-x86_64 command to get it to use the Kernel-based Virtual Machine (KVM) which gets the kernel to take advantage of our hardwares virtualization capabilities:

qemu-system-x86_64 -m 6144 -vga std -enable-kvm -boot d -cdrom ~/Downloads/gnome-3.12.iso

You can see I am throwing more RAM at this thing (-m 6144) and using a different vga adapter to get more resolution (-vga std). Don’t forget that if you need to run a 32 bit OS you need to use qemu-system-i386.

Making Virtual Machines with KVM and Virt-manager

I have used virtual machines for a quite a while now and have drifted back and forth between VMware and Virtualbox. While my initial experience of Virtualbox was good, between the acquisition by Oracle, the TAINT_CRAP thing and generally finding it slow and sometimes overly complicated, I thought I would explore some other options. Having recently discovered my laptop supports hardware virtualization, I thought I would try out KVM.

KVM stands for Kernel-based Virtual Machine and Ubuntu’s documentation sums up the expected uses nicely; “Ubuntu uses KVM as the back-end virtualization technology primarily for non-graphic servers”. So while this is definitely created with servers in mind, I figure I will explore using it as a Virtualbox replacement and see how that goes.

So after enabling virtualization in my BIOS I installed all the packages:

sudo apt-get install virt-manager qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

The first thing I learned after starting virt-manager is that KVM is using QEMU as its processor emulator. This becomes obvious when you launch virt-manager and notice that it can’t connect to QEMU on localhost.
To get that working just add yourself to the libvirtd group. I did it manual style:

sudo vim /etc/group

and add yourself to the group like so:


After that you will need to logout and log back in (restarting works too) and you should see localhost(QEMU) in the virt-manager GUI indicating that a connection has been made.

The process of setting up a virtual machine is similar to what you would find in VMWare or Virtualbox. Just click the “Create new virtual machine” button and its pretty self explanatory. One thing that stood out as a little concerning is an little red error icon when setting up the network config.

If you mouse over it, it says “could not initialize HAL for interface listing”. HAL of course has been deprecated and removed from Ubuntu (and replaced by Udev) so its not a surprise that it can’t be found. I wasn’t sure what to make of this but it turns out not to be an issue; the VM boots up happily and is able to sort out a network connection just fine.

HAL error in virt-manager
I am curious to see what it will be like to work with this for a while. Particularly doing things like using the VM as a server of various kinds which is terribly clunky in with Virtualbox. Well I still have lots of tinkering to do but this is enough to get the experiment underway.