User:Renich/Funtoo on KVM/Qemu and Virtio

From Funtoo
< User:Renich
Revision as of 22:26, August 1, 2012 by 187.167.30.29 (talk) (expanded the instructions on how to boot the guest)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
   Note
This article is still in development

Funtoo is KVM/ Qemu ready.

In order for it to work, you need to make sure that you've enabled Virtio support on the kernel.

Pre-Requisites

Procedure

Carry on until you reach the Configuring and installing the linux kernel section.

Step 1: Install Genkernel

emerge sys-kernel/genkernel

Step 2: Install the vanilla sources

emerge sys-kernel/vanilla-sources

Step 3: Start configuring and building the kernel

genkernel --menuconfig all

Step 4: Search and enable the essential Virtio drivers

To be able to search for all Virtio options, just type / on the TUI (Terminal User Interface) and, then, type 'virtio'. Please, consult: KVM's website in order to get a list of options available in the Kernel's config.

   Note
The console will let you know what is available. Pay special attention to the location section.

Step 5: Continue with Funtoo Linux Installation Guide

Testing

Boot the Guest

You should be able to boot the guest without problems. If you're using virt-manager, then just hit "play" on the Guest. If you're a commandline dude, please, issue the following command:

qemu-kvm -boot c -drive file=/var/lib/libvirt/images/funtoo.img,if=virtio -m 512

Troubleshooting

Determining root device fails

For some reason, on kernel 3.4.5, it fails to load the modules automatically. You can workaround it by adding:

doload=virtio_pci,virtio_blk 

to the kernel line; at the grub prompt; at boot time. It should look something like this:

set timeout=3
set default=0

menuentry "Funtoo Linux genkernel - kernel-genkernel-x86_64-3.4.5" {
  insmod part_gpt
  insmod ext2
  set root=(hd0,2)
  search --no-floppy --fs-uuid --set 22b809f0-86be-422a-8bdd-6f4362da83ed
  linux /kernel-genkernel-x86_64-3.4.5 real_root=/dev/vda4 doload=virtio_pci,virtio_blk
  initrd /initramfs-genkernel-x86_64-3.4.5
  set gfxpayload=keep
}

Once you boot, a permanent workaround should look like this:

mount /dev/vda2 /boot

cat /boot/grub/grub.cfg
set timeout=3
set default=0

menuentry "Funtoo Linux genkernel - kernel-genkernel-x86_64-3.4.5" {
  insmod part_gpt
  insmod ext2
  insmod virtio_pci
  insmod virtio_blk
  insmod virtio_net
  set root=(hd0,2)
  search --no-floppy --fs-uuid --set 22b809f0-86be-422a-8bdd-6f4362da83ed
  linux /kernel-genkernel-x86_64-3.4.5 real_root=/dev/vda4 doload=virtio_pci,virtio_blk
  initrd /initramfs-genkernel-x86_64-3.4.5
  set gfxpayload=keep
}

Reference