User:Renich/Funtoo on KVM/Qemu and Virtio

From Funtoo
< User:Renich
Revision as of 07:11, June 6, 2014 by Renich (talk | contribs) (copying all randisk modules into the initrd image)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
   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 --all-ramdisk-modules --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