=== When connecting to a VNC terminal, a "rect too big" message appears and the VNC session disconnects ===

−

When connection to a VNC Terminal, a "rect too big" message appears, and the VNC Session disconnects.

+

−

+

This happens because of a VNC protocol flaw on the way on-the-fly pixel format changes are handled (more info at [http://www.mail-archive.com/qemu-devel@nongnu.org/msg04879.html this thread]). If you are using TigerVNC, you can avoid this problem by disabling on-the-fly selection of pixel encoding, using the <tt>-AutoSelect=0</tt> command-line option of vncviewer. You may also want to check the encoding options on the vncviewer man page, as this will disable automatic selection of encoding based on connection speed.

This happens because of a VNC protocol flaw on the way on-the-fly pixel format changes are handled (more info at [http://www.mail-archive.com/qemu-devel@nongnu.org/msg04879.html this thread]). If you are using TigerVNC, you can avoid this problem by disabling on-the-fly selection of pixel encoding, using the <tt>-AutoSelect=0</tt> command-line option of vncviewer. You may also want to check the encoding options on the vncviewer man page, as this will disable automatic selection of encoding based on connection speed.

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. For Intel processors, see also the Intel® Virtualization Technology List.

Are 64-bit processors supported under KVM?

Yes they are supported and will allow you to run 32-bit and 64-bit guests.

See also Can KVM run a 32-bit guest on a 64-bit host? What about PAE? below.

"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.

Note:

On some hardware (e-g HP nx6320), you need to power-off/power-on the machine after enabling virtualization in the BIOS.

Enabling some BIOS features may break VT support on some hardware (e-g Enabling Intel AMT on a Thinkpad T500 will prevent kvm-intel from loading with "disabled by bios")

On some Dell hardware, you also need to disable "Trusted Execution", otherwise VT will not be enabled.

How can I use AMD-V extension?

modprobe kvm-amd

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 (qcow2), VMware format, and many more.

How do I use KVM on a headless machine (without a local GUI?)

Install a management tool such as virt-manager on a remote machine.

Are there management tools available to help me manage my virtual machines?

Using KVM

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).

How can I get the most performance out of KVM?

Is KVM stable?

KVM is stable and used in production. As with most open source projects, development snapshots are less stable than the stable release series.

If your name is Andreas Mohr, you're reporting bugs in the wrong place.

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 and 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...

Most usability issues are covered in the QEMU documentation. There is also an extensive FAQ (old vanished link: FAQ).

Troubleshooting

How can I check that I'm not falling back to QEMU with no hardware acceleration?

If you think that you might not 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 lsmod|grep kvm

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 <code>lsmod|grep kvm on 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

When connecting to a VNC terminal, a "rect too big" message appears and the VNC session disconnects

This happens because of a VNC protocol flaw on the way on-the-fly pixel format changes are handled (more info at this thread). If you are using TigerVNC, you can avoid this problem by disabling on-the-fly selection of pixel encoding, using the -AutoSelect=0 command-line option of vncviewer. You may also want to check the encoding options on the vncviewer man page, as this will disable automatic selection of encoding based on connection speed.

How do I set up the network such that my guest is accessible from other machines? or

I'm experiencing timer drift issues in my VM guests, what to do?

Especially in case of networked systems (e.g. via NFS or Samba) it is very important to ensure stable operation of timing (both system timer and RTC).
Tell-tale signs of related trouble in VMs (apparently qemu/KVM/VMWare etc. are all affected) are e.g.
"make[2]: Warning: File `XXXXX/cmakelists_rebuilder.stamp' has modification time 0.37 s in the future"
"Clock skew detected. Your build may be incomplete."

Maemo docs state that it's important to disable UTC and set the correct time zone, however I don't really see how that would help in case of diverging host/guest clocks.
IMHO much more useful and important is to configure properly working NTP server (chrony recommended, or ntpd) on both host and guest.
The single most decisive trick IMHO is to specify the host NTP server as the main entry within guest VM instead of "foreign" NTP servers, to make sure to achieve the most precise coupling between these two related systems (timing drift vs. other systems does not matter nearly as much as a tight time precision for inner host/guest system interaction e.g. in the case of NFS/Samba shares etc.).
For verification, see chronyc "sources -v", "tracking" ("System time" row) commands.

After having applied this very tight NTP coupling, this seems to finally have gotten rid of make's time drift warnings.

I get "rtc interrupts lost" messages, and the guest is very slow?

I get an "Exception 13" or "Exception 12" message while booting a guest OS on my Intel 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.

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?

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; it is also more featureful; for example KVM can swap guests to disk in order to free RAM.

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 paravirtualization. KVM does not support paravirtualization for CPU but may support paravirtualization for device drivers to improve I/O performance.

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?

Do you have a port of KVM for Windows?

Kazushi Takahashi has been working on an experimental version though, called WinKVM, available here.

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 memory management for guests supported?

This is a broad topic covering a few areas.

A. KVM only allocates memory as the guest tries to use it. Once it's allocated, KVM keeps it. Some guests (namely Microsoft guests) zero all memory at boot time. So they will use all memory.

B. Certain guests (only Linux at the moment) have a balloon driver, so the host can have the guest allocate a certain amount of memory which the guest won't be able to use anymore and it can then be freed on the host. Ballooning is controlled in the host via the balloon monitor command.

C. Some hosts (presently only RHEL5.4 / CentOS 5.4) have a feature called KSM (Kernel Sharedpage Merging), which collapses together identical pages; this requires kernel support on the host, as well as a kvm new enough to opt in to the behavior. As some guest platforms (most notably Windows) zero out free'd memory, such pages are trivially collapsed. The ksmctl command needs to be used to enable KSM; alternately, the ksmtuned service found in Fedora 12 can be run to dynamically adjust KSM's aggressiveness based on the amount of free memory available

What OSs can I run inside KVM VM?

Several. See the Guest Support Status page for details. Note that several Linux flavors are known to hang on Intel processors during startup. Workaround is to disable splash screens in grub.

Does KVM support a live migration feature to move virtual machines from one host to another without downtime?

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.
If one of your hosts does not support NX, you may consider disabling NX when starting the guest on a NX-capable system. You can do it by passing "-cpu qemu64,-nx" parameter to the guest.

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.

Does KVM support SMP hosts?

Does KVM support SMP guests?

Is the name 'KVM' trademarked?

I compiled a new kernel for my KVM client and the ethernet interface is not recognized

You can specify alternative network interfaces to qemu with the -net nic,model= parameter. For example, -net nic,model=rtl8139 would enable a device with the Realtek 8139 chipset.

I can't ping from guest to host or vice versa. How can I access the host?

The ping command may not go through in this circumstance, but you may be able to access the host in another way. For example, you can access a host running Apache by entering its IP address into a browser within the guest.