OA - Ubuntu
A blog about Ubuntu, mobile GIS and archaeology

KVM - The informations you may be missing

Feb 24, 2009 by Yann Hamon

Good morning Ubuntu, we are together today to try to help people who want to deploy KVM. Ubuntu Hardy being the latest LTS version of Ubuntu, it is a good choice for people like me who don't want to spend time upgrading every 6 months. On the other hand, there are some issues with KVM on it - so let's work around them!

Short howtos

You should use the e1000 network NIC (really)

Using the default network NIC, I have noticed tiny but highly annoying ethernet errors. Run a ifconfig -a:

RX packets:50916071 errors:24 dropped:27 overruns:0 frame:0
TX packets:4185949 errors:0 dropped:0 overruns:0 carrier:0 

Oups! That may be the reason why the md5 of some of the isos I copy sometimes don't match. Sooo - I moved to virtio for my network. With not so much more success - virtio seems very unhappy with large file transfers, and the driver would just crash, leaving the VM without connectivity. Not great - luckily the e1000 seems to work fine so far.

So, run "virsh dumpxml virtualmachine" - copy the result and paste it into a new file, the name doesn't really matter. Open that file and look for the section with the interface, where you will add the "model" line:

    <interface type='bridge'>
      <mac address='00:16:3e:00:50:19'/>
      <source bridge='br0'/>
      <model type='e1000'/>
    </interface>

Now, run "virsh define thefile" and restart the VM. Should be much better :)

The VMs don't start automatically when the host starts. But they could!

A trick found thanks to virt-manager and to the help of people on #ubuntu-virt. Go to /etc/libvirt/qemu/, and there create a folder called "autostart". There, make a softlink to the XML files of the vms you want to start automatically:

cd /etc/libvirt/qemu/
sudo mkdir autostart
sudo chmod 755 autostart
cd autostart
sudo ln -s /etc/libvirt/qemu/virtualmachine.xml virtualmachine.xml

And that should do the job.

Get Windows XP/2000 to run

Slightly tricky. Forums are full of questions about that... Use the Qcow2 file format! Sadly virt-install doesn't have any way to specify the file format (at least in ubuntu Hardy) - so let's start with a normal creation of a VM:

cd /var/lib/kvm/
sudo virt-install --connect qemu:///system -n vm -r 1024 -f vm/windows -s 20 -c /home/yann/win2Kserver.iso --vnc --noautoconsole --os-type windows --os-variant win2k

Then, we quickly stop the VM while it boots *cough* : virsh destroy vm - and convert the image to qcow2:

cd /path/to/your/image 
sudo qemu-img convert windows -o qcow2 windows.qcow2

There are also some tweaks we will need to do to the XML definition of the file. So, as previously, run "virsh dumpxml virtualmachine" and paste the result in a file. There, update the path of the disk:

<source file="/path/to/your/vm/windows.qcow2" />

Update the network NIC to e1000 (see previous section), and add a link to the cdrom (windows reboots after the formatting part, and can't find its cdrom anymore as virt-install attachs the cdrom only for the first boot).

      [...]
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='//home/yann/win2Kserver.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>

"virsh define file", and "virsh start vm". You should now be able to install windows XP and 2000 (didn't test other versions) without problems!

And some news...

Spice-up your remote desktop

Sorry for the ugly title ;) So, at the moment, we use VNC to connect to our KVM virtual machines. Let's admit it: VNC's performances suck. When Qumranet developped KVM, they also developped a proprietary alternative to VNC called SPICE. The interesting bit is that now that Redhat has bought Qumranet, they want to make it opensource, and apparently it's planned to happen pretty soon. Here is the interesting interview. I've been looking at alternatives to VNC for months, and beyond NX and its single implementation, I've not been very successful - so huge hopes from me on that side.

Some more links for those with real interest

Shamelessly copied from an interesting article on linuxfr.org:

  1. Red Hat Sets Its Virtualization Agenda
  2. Red Hat Announces Broad ISV Ecosystem is Virtualization-Ready

And Ubuntu?

As Redhat is owning KVM, they are the best place to look for shiny news... But regarding Ubuntu, I heard the current buzzwords were Eucalyptus and Open nebula. Haven't really had time to try any of these yet - would be incredibly grateful for feedback on them :)



That's all for today - as a strong KVM supported I'd be happy to reply to questions and queries related to it in the comments. Thanks for reading ;)



Comments:

Spice *and* SolidICE are planned to be open :
http://fedoraproject.org/wiki/Qumranet

> I heard the current buzzwords were Eucalyptus and Open nebula.

Open nebula is interesting. But Ovirt is very interesting : http://ovirt.org/

Posted by web123 on February 24, 2009 at 04:43 PM GMT+00:00 #

! I didn't know they were thinking about making solidice open... This is big news for me, thanks for the link :)

Posted by Yann on February 24, 2009 at 04:52 PM GMT+00:00 #

I am also very excited about SolidICE this is something that I have needed for quite some time.

Posted by sharms on February 24, 2009 at 06:04 PM GMT+00:00 #

If Canonical only supports KVM officially in Ubuntu Server as a part of main, Eucalyptus doesn't necessarily make a lot of sense as a project to highlite as its a research project which requires Xen and does not yet support KVM in its public releases. It's going to be introduced in version 1.5, which doesn't even have any testing releases out.

The group states clearly that this is still a very early development project, so much so that they don't currently accept major external contributors. If they aren't prepared to accept help yet from Canonical, is this really far enough along for Shuttleworth to make a big deal about and ramp up interest in? I think Shuttleworth does a disservice to the academic project by raising the interest level beyond what the project is prepared to currently handle.

-jef

Posted by Jef Spaleta on February 24, 2009 at 06:45 PM GMT+00:00 #

Were the RX errors specific to Hardy?
I'm using virtio with Intrepid hosts and guests error free.

Posted by Karl Bowden on February 24, 2009 at 09:18 PM GMT+00:00 #

First of all, your blog is 'broken'. After I typed my story and pressed post, I was told my comment was marked spam because it was longer than 1000 characters. If it can't be longer than 1000 characters, use the appropiate attributes for the input fields. Anyway, I'll split my post up so here it is in 3 comments:

Posted by Michael Croes on February 24, 2009 at 09:53 PM GMT+00:00 #

"You should use the e1000 network NIC (really)"
Only if you want to. From reading your post I get the impression this is your first day with KVM. Either way, there's no need to use e1000, and I can actually tell you why you *shouldn't* use e1000. I personally use virtio and rtl8139. I started with rtl8139 because it was the default (and defaults tend to be sane), but soon moved to virtio_net for my linux guest. There's no hassle in setting it up, so for me there's no reason not to use it. I don't have any issues with it either, so maybe your machine has issues, or your install (or distribution) has issues somewhere. I do have to say I'm not using an old version of KVM (8.04 is nearly a year old, so the KVM in 8.04 should be a year old too...)

Posted by Michael Croes on February 24, 2009 at 09:53 PM GMT+00:00 #

When I started with running FreeBSD as guest I also started out by using the rtl8139 nic, just because it's a sane default (for freebsd too). I moved to e1000 for a short period, but somehow the e1000 nic has (or had) issues with multicast traffic, so avahi isn't working with e1000 nics in freebsd (or wasn't, there was a fix related to multicast in KVM-84 for the e1000 driver, but I haven't tested it yet). So for FreeBSD I still use the rtl8139 nic. When I added another FreeBSD install last week (so I have 1 Linux guest, 2 FreeBSD guests) that I used e1000 for, I actually started getting lockups. Not every process would lock up, but it seems everything related to networking would die. I haven't investigated that problem much either, but it definately seems related to the use of the e1000 nic.

Posted by Michael Croes on February 24, 2009 at 09:54 PM GMT+00:00 #

Last but not least there's no reason to use e1000 in windows either, because there are virtio drivers for windows too. All in all, there's no reason why I should use the e1000 nick for my guests, so next time, don't tell people they should unless it's true...

Posted by Michael Croes on February 24, 2009 at 09:54 PM GMT+00:00 #

Hello Michael, thanks for your comment, but I have to disagree :) If you look at the very first paragraph of my post:

"On the other hand, there are some issues with KVM on it - so let's work around them!"

This post is about KVM specifically on Ubuntu 8.04, and having used KVM for a while, I can tell you: there are issues with virtio and rtl8139. Even better, this bug has been identified yesterday by kirkland and solved in that patch: https://launchpad.net/%7Ekirkland/+archive/ppa/+files/kvm_62+dfsg-0ubuntu9~ppa1_i386.deb . Of course this issue has a large chance to occur only on Ubuntu Hardy. See this bug: https://bugs.launchpad.net/ubuntu/+source/kvm/+bug/332156 . E1000 is, *on hardy*, the only nic that I found to be working properly so far.

Happy to hear this is all solved in intrepid, sadly it is not the version I am using, neither the version this post was targeted to :) I will look into the blog length limit though, surely you should be allowed to post longer posts.

Posted by Yann on February 25, 2009 at 11:25 AM GMT+00:00 #

Dear Yann,

I have same problem like you when I use the default driver. But after I changed to e1000, the snmp that I use to graph the traffic is always result zero traffic. Are you experienced the same with snmp?

FYI, my KVM is using Hardy too.

--budiw

Posted by budiw on February 26, 2009 at 07:27 AM GMT+00:00 #

Hello budyw, can you try that package I linked into my previous post? It apparently fixes both virtio and default rtl8139 (although I only tested with virtio).

Posted by Yann on February 26, 2009 at 02:52 PM GMT+00:00 #

Dear Yann, Thanks for the suggestion. I'll try it.

Posted by budiw on February 27, 2009 at 11:31 PM GMT+00:00 #

Dear Yann, Looks like that package is for PPA Architecture. I'm using x86_64. Is there any similiar package but for x86_64 architecture?

--budiw

Posted by budiw on February 28, 2009 at 04:12 AM GMT+00:00 #

Oops, What I mean is, the package architecture is for i386, but my server is x86_64.

--budiw

Posted by budiw on February 28, 2009 at 04:16 AM GMT+00:00 #

Oops again. :D

Looks like on Kirkland is also available the patch for amd64.
Thank you.

--budiw

Posted by budiw on February 28, 2009 at 04:40 AM GMT+00:00 #

Do you shop online? we offer the high quality Wholesale shoesDesigner handbagsAir jordan shoes and the lowest price. Shoes and handbags quality is guaranteed and We will send goods tracking service.

Posted by Jordan fans on August 03, 2011 at 02:41 AM GMT+00:00 #

Quite a lot of women that would like to receive the Louis Vuitton Bags as a gift. So it is great idea for these people who do not know what to buy. Based on the fact that various bags brand among the market, and here for the Louis Vuitton Outletthat all can provide you the authentic handbags. Our Louis Vuitton Handbags that now on sale the new design for 2011 winter season. The fashion appearance that you would definitely show great love to them.

Posted by Louis Vuitton Outlet store on October 10, 2011 at 08:27 AM GMT+00:00 #

Cheap <strong>replica Louis Vuitton handbags</strong> on sale, buy new fashion wholesale discount replica LV handbags from China suppliers.Shop the latest <strong>Louis Vuitton bags</strong> handpicked by a global community of independent trendsetters and stylists.

Posted by louis vuitton replica on October 13, 2011 at 01:10 AM GMT+00:00 #

555clf9
thanks for you suppoort

Posted by Nike Air Max on October 15, 2011 at 01:51 AM GMT+00:00 #

555clf5
good

Posted by Cheap UGG Boots on October 15, 2011 at 01:51 AM GMT+00:00 #

Always interesting to read a different website. Thank you for the input . Except for the content , the design of your website is really amazing . Cheers.

Posted by ugg boots on October 20, 2011 at 01:22 AM GMT+00:00 #

"I was reading the http://www.northfaceonclearance.com and there was a piece that said 'volunteer wanted with a terminal illness to donate their body to be mummified'," he told the documentary team.

Posted by north face clearance on October 20, 2011 at 01:58 AM GMT+00:00 #

In 1968, The North Face began designing and manufacturing its own brand of high-performance mountaineering apparel and equipment, and in the early 1980s, extreme skiwear was added to the product offering.

Posted by north face outlet store on October 21, 2011 at 02:46 AM GMT+00:00 #

People who wear mulberry bags sale re very modern and stylish. Mulberry Bayswater Bag are that loved by many people all over the world.Mulberry outlet is among the best luxury style businesses inside the world.

Posted by mulberry bags on October 25, 2011 at 07:00 AM GMT+00:00 #

I have to thnkx on your attempts you have got submit developing this url. Instant messaging looking a similar high-grade web-site report from your website while in the imminent at the same time. In reality an individual's imaginative developing competencies seems to have empowered everybody to purchase my own personal blogging site at this moment. The blogging and site-building is without a doubt scattering it can be wings easily. Ones own post works as a outstanding sort of the application.

Posted by mens uggs on November 03, 2011 at 01:21 AM GMT+00:00 #

If I were to suggest one piece of clothing in general that every person should wear, it's The North Face Apex Bionic Jacket. It's versatility cannot be beat. Available in men's, women's and children's sizes, the North Face Apex Bionic, reaches a wide target audience. From young to old, the style is universal, in that, it just looks great! The North Face Apex Bionic Jacket comes in a wide array of colors.

Posted by North Face Apex on November 04, 2011 at 11:22 AM GMT+00:00 #

Welcome to visiting our jerseys .jerseys from china . jerseys sale products are won highly praise from our customers.
our goal is to be popular and fashionable vane,offer the best products and service, the most preferential price.

Posted by cheap jerseys from china on November 10, 2011 at 06:40 AM GMT+00:00 #

NFL spokesman NFL Personalized Jerseys Brian McCarthy said Thursday NFL Jersey that the league has “a long-held unwavering opposition to gambling on NFL games,” but declined to comment on whether the 2014 Super Bowl could become leverage in stopping New Jersey’s plans.Voters in a statewide referendum Tuesday overwhelmingly approved allowing sports betting in New Jersey, but only if a federal ban affecting the state is lifted or repealed, with 64 percent in favor.

Posted by zzkk201110 on November 14, 2011 at 01:22 AM GMT+00:00 #

http://www.hermesbagsoutletsale.com

Posted by Hermes Handbags on November 22, 2011 at 01:14 AM GMT+00:00 #

Post a Comment:
Comments are closed for this entry.