KVM Installation on Fedora

Almost all new Intel and AMD x86 processors have implemented Intel VT (code named "Vanderpool") or AMD-V (code named "Pacifica") extension that assists virtualization. This type of virtualization is called hardware-based virtualization and it is much more efficient  comparing to software-based virtualization.

Reference
http://en.wikipedia.org/wiki/X86_virtualization
http://en.wikipedia.org/wiki/X86#Extensions

Kernel-based Virtual Machine - KVM is a virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V).  It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko.

Reference
http://www.linux-kvm.org/page/Main_Page

The tutorial KVM installation on Fedora Linux.

1. Check if your processor supports hardware virtualization

To check for Intel-VT or AMD-V support, run the following command  which checks for the presence of vmx  (Intel-VT) or vmx (AMD-V).

$ grep -E "svm|vmx" /proc/cpuinfo –color=auto

flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms

As the flag vmx is presented in the oputput we known that this Intel processor  supports Intel-VT virtualization technology.

Reference
http://www.techotopia.com/index.php/Installing_KVM_Virtualization_on_RHEL_6

2. Install package qemu-kvm

$ sudo yum install qemu-kvm

3. Troubleshooting

Check if file /dev/kvm exists

$ ls -l /dev/kvm
crw-rw-rw-+ 1 root kvm 10, 232 Jun 9 10:02 /dev/kvm

If you have noticed the error message "cannot access /dev/kvm: No such file or directory" check if either the module kvm_intel or kvm-adm is loaded in Linux kernel.

$ lsmod | grep kvm
kvm                   419458  0

Even kvm module is loaded, processor specific module is not loaded. We will try  to load kvm module for Intel VT .

$ sudo modprobe kvm-intel
ERROR: could not insert 'kvm_intel': Operation not supported

Module kvm_intel cannot be loaded. Checking kernel messages might be helpful.

$ dmesg | grep kvm
[   17.034871] kvm: disabled by bios
[   18.047502] kvm: disabled by bios
[  380.065260] kvm: disabled by bios

In order to load the kernel module we must enable Intel VT virtualization technology in BIOS/UEFI . Once the option is enabled, PC must be powered off. After boot,  check again if modulesare loaded.

$ lsmod | grep kvm
kvm_intel             132762  0
kvm                   419458  1 kvm_intel

Reference
http://www.techotopia.com/index.php/Running_Windows_on_Fedora_Using_KVM_Virtualization#KVM_System_Requirements
http://www.linux-kvm.org/page/FAQ
http://wiki.centos.org/HowTos/KVM

4. Start a virtual machines to check if KVM is working

$ qemu-kvm your_image.img

8 thoughts on “KVM Installation on Fedora

  1. grep supports OR statement and colors, like this: (no sudo needed)

    $ grep -E "svm|vmx" /proc/cpuinfo --color=auto

    -Technologov

Leave a comment

Your email address will not be published. Required fields are marked *