Difference between revisions of "User:Renich/Funtoo on KVM/Qemu and Virtio"

From Funtoo
Jump to navigation Jump to search
(copying all randisk modules into the initrd image)
(article updated to use update-env and enable virtio during boot.)
Line 1: Line 1:
{{Fancynote | This article is still in development}}
{{fancywarning | This article is still in development}}


Funtoo is [[KVM]]/[[wikipedia:Qemu | Qemu]] ready.  
Funtoo is [[KVM]]/[[wikipedia:Qemu | Qemu]] ready.  
Line 29: Line 29:
=== Step 5: Continue with [[Funtoo_Linux_Installation#Installing_a_Bootloader | Funtoo Linux Installation]] Guide ===
=== Step 5: Continue with [[Funtoo_Linux_Installation#Installing_a_Bootloader | Funtoo Linux Installation]] Guide ===


== Testing ==
=== Step 6: boot.conf
=== Boot the Guest ===
After installing boot-update, edit /etc/boot.conf and make it look something like:
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:
...
"Funtoo Linux genkernel" {
        kernel kernel[-v]
        initrd initramfs[-v]
        params += real_root=auto
        params += real_rootfstype=btrfs
        params += real_rootflags=subvol=root
        params += doload=virtio_pci,virtio_blk,virtio_net
}


qemu-kvm -boot c -drive file=/var/lib/libvirt/images/funtoo.img,if=virtio -m 512
Basically, we added some parameters so we ensure our virtual machine boots.


== Troubleshooting ==
;real_rootfstype
:This flag helps [[wikipedia:GNU_GRUB | GRUB]] determine the fs type.


=== Determining root device fails ===
;real_rootflags
For some reason, on kernel 3.4.5, it fails to load the modules automatically. You can workaround it by adding:
:This flag adds the [[BTRFS_Fun | BtrFS]] flags we need in case we used a sub volume for the root fs.


doload=virtio_pci,virtio_blk
;doload
: Will take of loading the virtio drivers needed for your image to be functional.


to the kernel line; at the grub prompt; at boot time. It should look something like this:
Please, remember to run [[Package:Boot-Update | Boot-Update]] once you're done.  


<pre>
== Testing ==
set timeout=3
=== Boot the Guest ===
set default=0
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:


menuentry "Funtoo Linux genkernel - kernel-genkernel-x86_64-3.4.5" {
qemu-kvm -boot c -drive file=/var/lib/libvirt/images/funtoo.img,if=virtio -m 512
  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
}
</pre>


Once you boot, a permanent workaround should look like this:
== Troubleshooting ==
<pre>
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
}
</pre>


== Reference ==
== Reference ==

Revision as of 08:55, June 6, 2014

   Warning
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

=== Step 6: boot.conf After installing boot-update, edit /etc/boot.conf and make it look something like:

...
"Funtoo Linux genkernel" {
        kernel kernel[-v]
        initrd initramfs[-v]
        params += real_root=auto
        params += real_rootfstype=btrfs
        params += real_rootflags=subvol=root
        params += doload=virtio_pci,virtio_blk,virtio_net
}

Basically, we added some parameters so we ensure our virtual machine boots.

real_rootfstype
This flag helps GRUB determine the fs type.
real_rootflags
This flag adds the BtrFS flags we need in case we used a sub volume for the root fs.
doload
Will take of loading the virtio drivers needed for your image to be functional.

Please, remember to run Boot-Update once you're done.

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

Reference