KVM Centos guest kernel panics with virtio

Hi,

Just set my test cloudmin install to use virtio everywhere (well, net and disk), but the Centos guest kernel panic-ed.

What I did to to fix this:

1. edit /etc/modprobe.conf and make it look like this:
alias eth0 virtio_net
alias scsi_hostadapter virtio_blk

2. rebuild initrd like this:
mkinitrd -f -v --with virtio_pci --with virtio_net --with virtio_blk initrd-2.6.18-164.6.1.el5.img 2.6.18-164.6.1.el5

It might be a good idea to supply virtio-aware initrds/kernels for all guests.

Also, another extra 2 small complains:
- image download is quite slow..
- the centos guest image (havent checked the others) has no swap.. and I can see only 2 partitions inside the lvm, one for /boot and one for /.

Status: 
Closed (fixed)

Comments

Thanks for the suggestion - that seems like a good idea for future CentOS images.

So with these changes, were you able to create an image that could be started in VirtIO disk mode?

Jamie,

Yes. With that initrd the guest runs just fine on virtio network and disk. Tbh virtio should be default for all linux images. I think even Debian Lenny supports virtio out of the box.

But with that /etc/modprobe.conf change, can you still create a non-virtio VM?

It should work I guess.. I did not modify the install image, only the "installed" OS. Btw, can I modify post-install the device type (from virtio to something else)? If I could do that I could change the hardware type to non-virtio and try to boot.

I'm thinking, if I rebuild the initrd --with virtio stuff but also --with ata_piix it should boot anyhow.

So after you made the switch, did you need to edit /etc/fstab or the GRUB configuration to use /dev/vda instead of /dev/hda ?

I will need to repeat this as I don't remember editing fstab.

I'd expect that editing /etc/fstab is mandatory, or else CentOS wouldn't be able to mount the virtIO devices. I ran into problems even with this though ... no matter what I tried, CentOS couldn't mount the root filesystem.

Yes, I tried using LABELs in /etc/fstab and /boot/grub/grub.conf and manually change hardware type[1] but indeed Centos won't boot... Imo all linux images should default to virtio and there should be easy access to modify hardware type (virtio or not)...

[1] - I manually edited files in /etc/webmin/servers/

My feeling is that the kernel that comes with CentOS 5 doesn't support VirtIO disks at all unfortunately ... I've been unable to get it to boot on a VirtIO root.

Did you manage to get that working by tweaking fstab and grub.conf ?

Jamie,

Centos/RHEL supports virtio out of the box starting with v5.4 afaik. If you create an empty KVM instance with virtio disk and network you will be able to easily install it from Centos-5-i386.iso (or whatever it's called); it's just like a normal centos install.

And yes, you can modify an existing centos install to boot on virtio (you need to edit modprobe.conf to use virtio_net and virtio_blk; mkinitrd --with virtio_net --with virtio_blk --with virtio_pci and edit grub.conf and fstab and replace hda with vda).

Ok, thanks .. I'll give this another try, and see about creating new CentOS images that include VirtIO support.

Ok, I figured out what I did wrong - the initrd file wasn't created properly.

I have created a new CentOS 5 KVM image with VirtIO support. Give it a try, and let me know how it goes for you ..

Updated KVM CentOS images with VirtIO support are being uploaded now, and should be available for download in an hour or two.

Also, the speed of image downloads should improve shortly, once Softlayer completes the port upgrade we requested!

I'm downloading right now and will test. For downloads you should use sourceforge.net..

Automatically closed -- issue fixed for 2 weeks with no activity.