As we wrote recently, KVM has a lot to recommend it as a virtualization solution in Ubuntu 10.04, especially in the server room.  But how ready is it for the desktop, and can it contend with applications like VirtualBox when it comes to ease-of-use?  Read on for a comparison of two of the Ubuntu world’s most popular virtualization products, and some thoughts on which one is better for desktop users.

If you haven’t yet tried KVM, you should, whether you’re using Ubuntu on a server or a desktop.  As Linux’s built-in virtualization hypervisor, KVM can run a wide variety of guest operating systems with impressive efficiency.  On some platforms, it can also take advantage of paravirtualization to make things even faster.

VirtualBox, meanwhile, has long been established as a popular and free (thought not entirely Free) virtualization platform, especially for desktop users.  And the project, which was originally owned by Innotek, then acquired by Sun and consequently now owned by Oracle, continues to push out innovative features.

While KVM and VirtualBox are both excellent products, I wanted to determine which of them was better suited for the desktop.  Here’s what I found.

Management Tools

For desktop users–especially the non-geeky ones–simple and intuitive management tools are essential for running virtual machines.  To this end, VirtualBox comes with a pretty well designed GUI for creating and running guest machines.  If you can point and click, you can use VirtualBox.

VirtualBox screenshot

KVM, in contrast, doesn’t have any official management interface.  A variety of third-party tools, however, are capable of managing KVM domains.  The most popular of these is RedHat’s virt-manager, which offers a simple but efficient graphical interface.

Virt-Manager screenshot

I like virt-manager, especially because it can manage both local virtual machines and those running elsewhere on the Internet (although that’s not a very relevant feature for most desktop users).

On the other hand, adding virtual hardware to a guest is not as easy as it could be.  In older versions of virt-manager, the terminology could also be confusing; for example, powering down a virtual machine was referred to as “destroying” it, which was a bit ambiguous.

Convirt, from Convirture, is another GUI tool for managing KVM virtual machines.  It’s similar to virt-manager and also supports remote machines as well as local ones.  Unfortunately, I’ve found it pretty buggy on my Lucid desktop, to the point that it was not usable.

Convirt screenshot

When it comes to graphical management applications, then, VirtualBox beats KVM.  If you like the command-line, however, KVM wins hands-down; although VirtualBox does offer a CLI interface, it’s not as comprehensive as KVM’s virsh.  There’s also no way to launch VirtualBox virtual machines directly from bash, as can be done with KVM.

On the other hand, most non-geeks are probably not very interested in CLI management tools.  Ultimately, therefore, VirtualBox really comes out ahead in terms of ease-of-management on the desktop.

Features

More than management utilities, features are paramount for desktop users–and on this front, KVM and VirtualBox both have their strengths and weaknesses.

KVM offers a wide range of advanced virtualization functionality, such as live migration and optional paravirtualization.  VirtualBox also offers some of these features, but it comes up short on the paravirtualization front.  These advanced operations, however, are mostly not the type that are very useful to desktop users.

Both VirtualBox (in its closed-source version) and KVM support passing hardware devices directly to guest operating systems, a feature that can be very useful in a variety of circumstances.  KVM can handle PCI passthrough as well as direct access to the USB bus, however, a feature that remains unimplemented in VirtualBox.  As a plus, this functionality can now be easily configured in recent versions of virt-manager.  But again, functionality like this is beyond the scope of what most desktop users are interested in.

One feature that is important to many desktop users, in contrast, is video acceleration in guest operating systems.  This is a central prerequisite for Ubuntu users who dream of playing Windows games without having to dual-boot.  As we wrote last winter, VirtualBox in principle offers such support, although in practice it doesn’t always work well.  KVM currently lacks 3D-acceleration support, however, so VirtualBox still comes out ahead on this front.

Similarly, VirtualBox’s “Guest Additions” feature makes it easy to integrate guest machines into their host environment by sharing the mouse and even the clipboard.  Although some drivers can be installed in certain types of KVM guests to improve performance, none of KVM’s management tools makes integration with the host so seamless.

In absolute terms, it’s hard to choose between KVM and VirtualBox when it comes to the features offered.  With respect to the functionality that desktop users are likely to want, and the ease with which it can be accessed, however, VirtualBox comes out on top.

Conclusion

So which virtualization solution is best for the Ubuntu desktop?  For the time being–and this is to say nothing of the various options which I’ve not discussed, such as VMware‘s products and Xen–VirtualBox is probably the better choice for users who want a simple application for running mainstream operating systems without ever having to touch a configuration file or open a terminal.

For those interested in cutting-edge virtualization functionality, or who actually prefer the command-line, however, KVM has a lot to offer.  At the least, although its developers are clearly focused on the enterprise, it should not be ruled out as a virtualization solution for normal desktop users, especially when it’s combined with GUI management tools.

Our advice: don’t apt-get remove VirtualBox from your Ubuntu desktop yet, but keep your eye on KVM as it continues to develop.

Read More About This Topic

Share This Post

Posted In: Ubuntu
Tags:
Interact: Add a Comment | Trackback Link | Permalink
Subscribe: RSS Feed

14 Comments on “VirtualBox vs. KVM on the Desktop: A Comparison”

  1. dan_linder Says:

    I have used VMWare Workstation/Player, and VirtualBox on my desktop and have played with many OS’s as guests (Windows XP, Win2K3, Win2K8, 32 and 64bit, etc). On these virtualization environments the speed was close to the same speed directly on the same hardware.

    When 10.04 came out, I installed virt-manager and easily created a new virtual machine (single CPU, 768MB RAM, 16GB hdd) and pointed it at my Win2K8-64bit .iso image and went to lunch (after answering the first few questions). I was shocked to see that the %-complete bar was roughly 10% done after 45 minutes – the other virtualization solutions would have been waiting at the first login screen at this point.

    My host CPU has the AMD VT technology, and the system has 4GB RAM and a 320GB HDD with roughly 70GB free so space/ram/CPU wouldn’t have been an issue.

    Is this the experience of others, or should I re-try with a different OS? (I live in Linux, but have to test and support against Windows so that gets virtualized all the time.)

    Dan

  2. Chris Says:

    A quick/small correction about virtualbox CLI – you can start/control VM’s from the CLI using VBoxManage. ie “VBoxManage startvm server –type vrdp”
    I use this to load some VM’s automatically on system bootup.

    @dan_linder – It may be that KVM isn’t using the AMD-V hardware virt stuff. Check that you had the ‘kvm’ and ‘kvm-amd’ kernel modules loaded. If not run ‘modprobe kvm-amd’ to load them

  3. Christopher Tozzi Says:

    Chris: thanks for the tips. I had never thought about writing a script to start VirtualBox VMs at boot. With KVM, of course, you can configure machines to start at boot in the libvirt configuration (assuming you’re using libvirt), so this is a relevant point.

  4. Jo-Erlend Schinstad Says:

    It is not difficult to choose between KVM and VirtualBox. If you have a desktop and want to run desktop guests, then VirtualBox is far superior at this point. When and if KVM gets support for dedicating a VGA to a guest, so you can have real 3D, this may change, but that’s not happening any time soon.

    If, on the other hand, you have headless servers and services that must always be available but preferably not too visible, then KVM with libvirt is a clear winner. If you run desktop guest systems on KVM, then you’ll certainly want to drop VNC as quickly as possible. Using RDP for Windows and NX for GNU+Linux, is _far_ superior.

    You cannot run accelerated VirtualBox and KVM at the same time, but if you close down all the guests from one, then it’s no problem to run the other.

  5. RDL Says:

    @ dan_linder:

    Lucid user here.

    That’s pretty much the same experience I had.

    But I’m not sure if it’s related to disk flushing issues; from what I understand, VirtualBox’s disk config is writeback by default, while KVM’s is writetrough, but I could be Oh-So-Wrong…

  6. [demo] How to run Windows XP on Linux Ubuntu with Virtualbox | Rainy Technology Says:

    [...] VirtualBox vs. KVM on the Desktop: A Comparison | WorksWithU [...]

  7. Jay Says:

    Would WorksWithU be willing to write up an “intro to virtualization” post for people who don’t know a lot about it and how it might be used for average end-users?

  8. Christopher Tozzi Says:

    Jay: good suggestion. I’ll see about putting something like that together in the coming weeks.

  9. Maxwell Spangler Says:

    The poor performance Dan Linder describes sounds as if his virtualization environment is running in software (QEMU) only mode. I almost wrote KVM off when using it on an old laptop because performance was unusable.

    On my four core AMD Phenom II 945 (four core, 6M L3 cache) system, KVM is as good as VirtualBox.

    I think we’ll see KVM win for server use and VirtualBox win for desktop users. A lot of this has to do with how Oracle handles VirtualBox in the future: tightening of licensing could be a huge boost for KVM.

  10. Phil Says:

    Well I will certainly unintsall VBox now. It looks as if now its dangerous to get tangled up in Oracle’s open source software. I’m guessing the Google law suit is only the beginning of pulling the rug from under you to get the profits they need from Sun.

  11. Linux Otaku Says:

    KVM actually supports OpenGL in Windows guest with VMGL, but the code seems old, and only OpenGL 1.5 is supported, and even so there might be problems with some extensions not being fully compliant. Quake 3 and some other games should work though. If your mainboard’s BIOS and chipset support IOMMU / vt-d then you can dedicate one graphics card to the geust, connect another display, and if you are lucky, you should get fully working guest. Should work better with Intel, AMD is said to be tricky, because although 890FX chipset support vt-d, mainboard manufacturers don’t, and the option is not in bios.

    VirtualBox have full support for OpenGL 2, and with WineD3D even some DX8/DX9 games should work, but the DX support is still experimental. There might be problems playing HD videos in Windows 7 guest, I managed to play it with smplayer and opengl driver on integrated intel card (720p only), but I think the faster the gpu, the faster the video (but why to play it there anyway? Only if you are thinking of making multiterminal for a school or so, but than you can buy better mainboard with vt-d support and the cheapest graphics card)

    If gaming is not a priority, or only OpenGL games are to be played, then it seems better option to buy a cheaper mainboard without vt-d, and buy SSD for extra performance, and use VirtualBox on that. It might be even possible to install some glide wrapper for oldest games, supposing that OpenGL support is really full.

  12. lux Says:

    @linux otaku

    it’s early, but the scenario is changing

    http://www.spice-space.org/home.html

  13. lux Says:

    @linux otaku

    it’s early, but the scenario is changing

    http://www.spice-space.org/home.html

    @Christopher Tozzi

    http://sourceforge.net/projects/aqemu/

  14. Eric Green Says:

    @linux otaku, I’ve never managed to get PCI passthrough of a modern nVidia gaming card to work right. Other devices, yes. Graphics cards, no. Closest I got was with Xen on OpenSuse 11.3 where I got it to show up in a started machine but Windows 7 says there’s a problem with the device and won’t bring it up. From reading the various FAQ’s on the Internets it appears that there’s people who’ve gotten it to work, but only with specific graphics cards that aren’t aimed at gamers. I have a Core I7-950 waiting to get this working, I’ll get it working someday even if I have to hack at the kernel to make it work, but it’s definitely not as easy as the quick throw-away about “passing through a graphics card” that you mention.

    Dan Linder’s problem with KVM performance sounds like he created his virtual machine hard drive as qcow2, which has bad bad performance with ext4 and xfs due to Red Hat (the owner of qemu) *forcing* write-through mode to “avoid disk corruption”. If I create my virtual machine with a ‘raw’ drive in write-back mode, it runs significantly faster. If I partition my hard drive to have a LVM physical volume, create a logical volume group ‘virtgroup’, and create a logical volume ‘win7′ and assign /dev/virtgroup/win7 as the hard drive for my virtual machine, it runs at virtually the speed of the hardware, significantly faster than userland solutions like VMWare Workstation and VirtualBox, especially after installing the virtio drivers in Windows. Well, until you want to display something. At which point using rdesktop to access your Windows virtual machine runs *much* faster than using the pathetic graphics console that KVM provides.

    spice-space.org looks like they’re creating a new incompatible screen display protocol to do the exact same things that RDP does (i.e., pass sound and such as well as screen info over the Internet). Remotely logged into a Windows machine using an official Microsoft RDP viewer I can hear the sound, and even attach virtual drives to the remote machine to install software. It always amuses me when Microsoft re-invents Unix, badly, but here it appears Linux is re-inventing Microsoft, badly — for no good reason, because Microsoft has published the specs on RDP and there’s already the beginnings of a good viewer for Linux (rdesktop). Siiiiiiiigh…..

Leave a Comment

 

Blog-Powered Site
By ContentRobot