Preparing to use kvm
What do I need to use kvm?
You will need an x86 machine running a recent Linux kernel on an Intel processor with VT (virtualization technology) extensions, or an AMD processor with SVM extensions (also called AMD-V). Xen has a complete list of compatible processors.
Are 64bits processors supported under kvm?
Yes they are supported and will allow you to run 32bits and 64 bits clients.
See also Can kvm run a 32-bit guest on a 64-bit host? What about PAE? below.
What is Intel VT / AMD-V / hvm?
Intel VT and AMD's AMD-V are instruction set extensions that provide hardware assistance to virtual machine monitors. They enable running fully isolated virtual machines at native hardware speeds, for some workloads.
HVM (for Hardware Virtual Machine) is a vendor-neutral term often used to designate the x86 instruction set extensions.
How can I tell if I have Intel VT or AMD-V?
With a recent enough Linux kernel, run the command:
egrep '^flags.*(vmx|svm)' /proc/cpuinfo
If something shows up, you have VT. You can also check the processor model name (in `/proc/cpuinfo`) in the vendor's web site.
- Some manufacturers disable VT in the machine's BIOS, in such a way that it cannot be re-enabled.
- `/proc/cpuinfo` only shows virtualization capabilities starting with Linux 2.6.15 (Intel) and Linux 2.6.16 (AMD). Use the `uname -r` command to query your kernel version.
In case of doubt, contact your hardware vendor.
"KVM: disabled by BIOS" error
Check if there is an option to enable it in the BIOS. If not, look for a more recent BIOS on the vendor's web site.
Also, on some hardware (e-g HP nx6320), you need to power-off/power-on the machine after enabling virtualisation in the BIOS.
How can I use AMD-V extension?
What user space tools does kvm use?
kvm uses a slightly modified qemu program to instantiate the virtual machine. Once running, a virtual machine is just a regular process. You can use `top(1), kill(1), taskset(1)` and similar tools to manage virtual machines.
What virtual disk formats can kvm use?
kvm inherits a wealth of disk formats support from qemu; it supports raw images, the native qemu format (qcow), VMware format, and many more.
Are there management tools available to help me manage my virtual machines?
Yes. Please see the Management Tools page for some links.
How can I use kvm with a non-privileged user?
The cleanest way is probably to create a group, say kvm, and add the user(s) to that group. Then you will need change /dev/kvm to owned by group kvm.
On a system that runs udev, you will probably need to add the following line somewhere in your udev configuration so it will automatically give the right group to the newly created device (i-e for ubuntu add a line to /etc/udev/rules.d/40-permissions.rules).
Is KVM stable?
The good news is that more and more developers and testers use KVM each passing day and for the most part, it works. KVM is a very young project and constantly evolving to add new features and more hardware support. Given the fervent pace of development, it's very likely that we're introducing new bugs at a fast pace as well, however small they might be. We would encourage our users to report any bug(s) they encounter so that we can continue making KVM better and stabler with each commit.
That's alright, but can I really use it for my daily use?
Sure. We continuously run the most often-used OSes and configurations and if anything breaks for the developers, it's fixed as soon as it was broken. See the [:Guest Support Status:Guest_Support_Status] and [:Host Support Status:Host_Support_Status] pages to find out more. Please update them with success stories so that new users would benefit from the experience of the community.
How about production use?
For production use, it's recommended you use the kvm modules shipped by the distribution you're using to ensure stability. As mentioned above, it's tempting to use new features, but you never know of (unwanted) surprises hidden away. It'll be best if you can run the development snapshots with non-critical production load, so that the latest releases are stable for you when you decide to deploy them.
What happens if I kill -9 a VM process?
From the guest's perspective, it is as if you yanked the power cord out. From the host's perspective, the process is killed and all resources it uses are reclaimed.
I need help to setup the network for my guest
You can have a look to the Networking page of this wiki for informations on the most classical networking setup for the guests. You can also refer to the Qemu documentation.
Where can I find more documention...
How can I check that I'm not falling back to qemu with no hardware acceleration?
If you think that you might no be using the hardware acceleration provided by the kvm module, here are a few steps to help you check this.
First of all, check that you don't have messages such as:
qemu-system-x86_64 -hda myvm.qcow2 open /dev/kvm: No such file or directory Could not initialize KVM, will disable KVM support
In that case, you can check that:
- the modules are correctly loaded
- you don't have a "KVM: disabled by BIOS" line in the output of dmesg
- /dev/kvm exists and you have the correct rights to use it
Other ways to do the diagnostic:
- if you have access to the qemu monitor (Ctrl-Alt-2, use Ctrl-Alt-1 to get back to the VM display), enter the "info kvm" command and it should respond with "KVM support: enabled"
- the right-end columns of the output from
lsmod|grep kvmon the host system, once the VM is started should show only non zero values. The value on the line corresponding to the architecture specific module (e-g kvm_intel, kvm_amd) show the number of VM using the module. For instance, if I have 2 VM running using the kvm module on a machine with vt, it will report:
lsmod|grep kvm kvm_intel 44896 2 kvm 159656 1 kvm_intel
"rect too big" Message when using VNC Display
When connection to a VNC Terminal, a "rect too big" message appears, and the VNC Session disconnects.
This might happen, when a VNC Client (for example RealVNC / xvnc4viewer) chooses ZRLE Encoding. Simple choose Hextile Encoding in the options of your VNC Client, and the Problem should be resolved.
. How do I set up the network such that my guest is accessible from other machines? or
My guest network is stuck what should I do?
kvm uses qemu for its device emulation. Consult the qemu network wiki page for detailed network setup instructions.
One would probably be interested in the Root Networking Mode page and the Network Bridge page.
Windows boots and runs very slowly?
See the Windows ACPI Workaround page.
I get an "Exception 13" or "Exception 12" message while booting a guest OS on my Intel host
See the Intel Real Mode Emulation Problems page.
I get "rtc interrupts lost" messages, and the guest is very slow?
CONFIG_HPET_EMULATE_RTC=yin your host
I have VMware/Parallels/VirtualBox installed and when I modprobe KVM, my system deadlocks.
Neither Intel VT nor AMD-V provide a mechanism to determine whether software is currently using the hardware virtualization extensions. This means that if you have two kernel modules loaded attempting to use hardware virtualization extensions, very bad things will happen. If you are using another type of virtualization software and experience any sort of weirdness with KVM, make sure you can reproduce the problem without the kernel modules for that software loaded before you report a bug in KVM.
There's nothing on QEMU/kvm screen, but it's not hanged! I'm trying to install Kubuntu.
Try to run kvm with -std-vga option. It helps if guest operating system uses framebuffer mode like Kubuntu/Ubuntu.
When I click the guest operating system window, mouse is grabbed. How can I get mouse to not to do that? OR Mouse doesn't show up / doesn't work in the guest. What do I do?
From #qemu wiki, try to run kvm/qemu with
-usb -usbdevice tablet
If that doesn't work, try this:
$ export SDL_VIDEO_X11_DGAMOUSE=0
General kvm information
What is the difference between kvm and Xen?
Xen is an external hypervisor; it assumes control of the machine and divides resources among guests. On the other hand, kvm is part of Linux and uses the regular Linux scheduler and memory management. This means that kvm is much smaller and simpler to use.
kvm only run on processors that supports x86 hvm (vt/svm instructions set) whereas Xen also allows running modified operating systems on non-hvm x86 processors using a technique called paravirtualisation. kvm does not support paravirtualization for cpu but may support paravirtualization for device drivers to improve I/O performances.
What is the difference between kvm and VMWare?
VMware is a proprietary product. kvm is Free Software released under the GPL.
What is the difference between kvm and QEMU?
Qemu uses emulation; kvm uses processor extensions (HVM) for virtualization.
Do you have a port of kvm for Windows?
Not in this release.
What kernel version does it work with?
It depends on what version of kvm you are using. The last release of kvm should work with any recent kernel (2.6.17 and above), older releases even older kernels.
How much RAM do I need?
You will need enough memory to let the guest run comfortably while keeping enough for the host. 1GB is probably a minimum configuration for the host OS.
Is dynamic use of RAM for guest operating system supported?
Yes. If you set -m 6144, guest can get a maximum of 6GB of RAM, but doesn't necessarily uses all. PLease note however that the usual platform limits will apply so you won't be able to see more than 4GB of RAM on a 32 bits guest unless you use PAE.
What OSs can I run inside kvm VM?
Several. See the [:Guest Support Status:Guest_Support_Status] page for details. Note that several Linux flavors are known to hang on Intel processors during startup. Workaround is to disable splashscreens in grub.
Does kvm support a live migration feature to move virtual machines from one host to another without downtime?
Yes. See the Migration page for details.
Does kvm support live migration from an AMD host to an Intel host and back?
Yes. There may be issues on 32-bit Intel hosts which don't support NX (or XD), but for 64-bit hosts back and forth migration should work well. Migration of 32-bit guests should work between 32-bit hosts and 64-bit hosts.
Can kvm run a 32-bit guest on a 64-bit host? What about PAE?
kvm supports 32-bit guests on 64-bit hosts, and any combination of PAE and non-PAE guests and hosts. The only unsupported combination is a 64-bit guest on a 32-bit host.
If you are running a Windows Virtual Machine and have problems enabling PAE in your guest see the Windows PAE Workaround page.
Is it possible to use USB devices with a guest OS?
Yes, look up how to do it with qemu, it's the same way.
Can I have higher or widescreen resolutions (eg 1680 x 1050) in kvm?
Support for higher resolutions was added in kvm-59, but some bugs were left until the release of kvm-62. Use the -std-vga parameter while starting the VM.
If the resolution you want to use is not available, you can patch the corresponding source files (see http://article.gmane.org/gmane.comp.emulators.kvm.devel/13557 as a reference), or send a mail to the kvm mailing list if you are not able to patch the source yourself.
When using Windows as guest OS you might want to use the driver from the VBEMP x86 project (http://www.geocities.com/bearwindows/vbemp.htm).
Does kvm support SMP hosts?
Does kvm support SMP guests?
Yes. But so far only 4 CPUs can be specified using the -smp option. Please note however that you'll needacpi enabled for SMP to work (i-e -no-acpi won't show more than one cpu on a linux guest)
Is the name 'kvm' trademarked?
What is Qumranet's product?
On the 24th of September 2007, Qumranet announced their first product, Solid ICE, a virtual Desktop Infrastructure solution based on KVM (http://web1.qumranet.com/art_images/files/10/Qumranet_Launch_Release.pdf)