FAQ: Difference between revisions

From KVM
m (minor formatting fix)
 
(45 intermediate revisions by 23 users not shown)
Line 1: Line 1:
=FAQ=
__TOC__
__TOC__
== Preparing to use kvm ==
== Preparing to use KVM ==
=== What do I need 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 [http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors complete list] of compatible processors.            
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 [http://wiki.xensource.com/xenwiki/HVM_Compatible_Processors complete list] of compatible processors. For Intel processors, see also [http://ark.intel.com/VTList.aspx the Intel® Virtualization Technology List].


----------
----------
=== Are 64bits processors supported under kvm? ===
=== Are 64-bit processors supported under KVM? ===
Yes they are supported and will allow you to run 32bits and 64 bits clients.
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.
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? ===
=== What is Intel VT / AMD-V / hvm? ===
[http://www.intel.com/technology/itj/2006/v10i3/1-hardware/6-vt-x-vt-i-solutions.htm Intel VT] and [http://www.amd.com/us-en/Processors/ProductInformation/0,,30_118_8826_14287,00.html 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.                              
[http://www.intel.com/technology/itj/2006/v10i3/1-hardware/6-vt-x-vt-i-solutions.htm Intel VT] and [http://www.amd.com/us-en/Processors/ProductInformation/0,,30_118_8826_14287,00.html 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.                                                                                          
HVM (for Hardware Virtual Machine) is a vendor-neutral term often used to designate the x86 instruction set extensions.
 
----------
 
=== Where do I get my kvm kernel modules from? ===
 
See the [[Getting the kvm kernel modules]] page.


----------
----------
Line 22: Line 29:
With a recent enough Linux kernel, run the command:
With a recent enough Linux kernel, run the command:


. egrep '^flags.*(vmx|svm)' /proc/cpuinfo
'''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.                                                                                  
If something shows up, you have VT. You can also check the processor model name (in `/proc/cpuinfo`) in the vendor's web site.


Note:
Note:


*  You'll never see (vmx|svm) in /proc/cpuinfo if you're currently running in  in a dom0 or domU.<br /> The Xen hypervisor suppresses these flags in order to prevent hijacking.
* Some manufacturers disable VT in the machine's BIOS, in such a way that it cannot be re-enabled.
* 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.                                    
* `/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.                                                        
In case of doubt, contact your hardware vendor.


----------
----------


=== "KVM: disabled by BIOS" error ===
=== "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.                                                                                              
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.                                                                                    
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? ===
=== How can I use AMD-V extension? ===
  modprobe kvm-amd                    
  modprobe kvm-amd
 
----------
 
=== What user space tools does KVM use? ===
KVM uses a slightly modified [http://www.nongnu.org/qemu 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 user space tools does kvm use? ===
=== What virtual disk formats can KVM use? ===
kvm uses a slightly modified [http://www.qemu.com/ 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.                                                                  
KVM inherits a wealth of disk formats support from QEMU; it supports raw images, the native QEMU format (qcow2), VMware format, and many more.


----------
----------


=== What virtual disk formats can kvm use? ===
=== How do I use KVM on a headless machine (without a local GUI?) ===
kvm inherits a wealth of disk formats support from qemu; it supports raw images, the native qemu format (qcow), VMware format, and many more.                                                                    
Install a management tool such as virt-manager on a remote machine.


----------
----------


=== Are there management tools available to help me manage my virtual machines? ===
=== Are there management tools available to help me manage my virtual machines? ===
Yes.  Please see the [[Management Tools]] page for some links.                    
Yes.  Please see the [[Management Tools]] page for some links.


----------
----------


== Using kvm ==
== Using KVM ==
=== How can I use kvm with a non-privileged user? ===
=== 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''.                                                    
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'').                                                    
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'').


  KERNEL=="kvm", GROUP="kvm"
  KERNEL=="kvm", GROUP="kvm"
----------
=== How can I get the most performance out of KVM? ===
See the [[Tuning KVM]] page.


----------
----------


=== Is KVM stable? ===
=== 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.                              
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? ===
=== 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.                                    
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? ===
=== 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.                
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? ===
=== 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.                                            
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 ===
=== 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.                                
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... ===
=== Where can I find more documention... ===
Most usability issues are covered in the QEMU [http://bellard.org/qemu/user-doc.html documentation].  There is also an extensive [http://kidsquid.com/cgi-bin/moin.cgi/FrequentlyAskedQuestions FAQ].            
Most usability issues are covered in the QEMU [http://www.nongnu.org/qemu/user-doc.html documentation].  There is also an extensive [http://qemu-buch.de/cgi-bin/moin.cgi/FrequentlyAskedQuestions FAQ] (old vanished link: [http://kidsquid.com/cgi-bin/moin.cgi/FrequentlyAskedQuestions FAQ]).


----------
----------


== Troubleshooting ==
== Troubleshooting ==
=== How can I check that I'm not falling back to qemu with no hardware acceleration? ===
=== 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.                                                                      
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:
First of all, check that you don't have messages such as:


 
  qemu-system-x86_64 -hda myvm.qcow2  
  qemu-system-x86_64 -hda myvm.qcow2
  open /dev/kvm: No such file or directory
  open /dev/kvm: No such file or directory
  Could not initialize KVM, will disable KVM support
  Could not initialize KVM, will disable KVM support
Line 117: Line 141:
* the modules are correctly loaded <code>lsmod|grep kvm
* the modules are correctly loaded <code>lsmod|grep kvm
* you don't have a "KVM: disabled by BIOS" line in the output of dmesg
* 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          
* /dev/kvm exists and you have the correct rights to use it


Other ways to do the diagnostic:
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"                              
* 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</code> 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:                                      
* the right-end columns of the output from <code>lsmod|grep kvm</code> 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
  lsmod|grep kvm
  kvm_intel              44896  2  
  kvm_intel              44896  2
  kvm                  159656  1 kvm_intel
  kvm                  159656  1 kvm_intel


=== "rect too big" Message when using VNC Display ===
=== 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 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
'''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? ===                                        
=== My guest network is stuck what should I do? ===
kvm uses qemu for its device emulation. Consult the [http://kidsquid.com/cgi-bin/moin.cgi/QemuNetwork qemu network wiki page] for detailed network setup instructions.                                          
KVM uses QEMU for its device emulation. Consult the [http://qemu-project.org/Documentation/Networking 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.
One would probably be interested in the Root Networking Mode page and the Network Bridge page.
Guest-side network lockups (fortunately restartable) may be happening due to tun/tap bridging erroneous MAC address reconfiguration on host side, see RHEL bug #571991 and others.


----------
----------


=== Windows boots and runs very slowly? ===
=== I'm experiencing timer drift issues in my VM guests, what to do? ===
See the [[Windows ACPI Workaround]] page. 


----------
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."
 
[http://maemovmware.garage.maemo.org/2nd_edition/requirements_documentation.html 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.
 
Perhaps qemu's -tdf (timing drift fix) option magically manages to help in your case, too.


=== I get an "Exception 13" or "Exception 12" message while booting a guest OS on my Intel host ===
See also [https://espace.cern.ch/it-faqs/Lists/faqs/DispForm.aspx?ID=368 Faqs: I received a message about "clock skew"].
See the [[Intel Real Mode Emulation Problems]] page.                                              


----------
----------
=== I get "rtc interrupts lost" messages, and the guest is very slow? ===
=== I get "rtc interrupts lost" messages, and the guest is very slow? ===
Try setting <code>CONFIG_HPET_EMULATE_RTC=y</code> in your host <code>.config</code>.
Try setting <code>CONFIG_HPET_EMULATE_RTC=y</code> in your host <code>.config</code>.
----------
=== 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 have VMware/Parallels/VirtualBox installed and when I modprobe KVM, my system deadlocks. ===
=== 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.                      
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. ===
=== 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.                                                                                              
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? ===                            
=== 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                                                              
From #qemu wiki, try to run kvm/qemu with
 


  -usb -usbdevice tablet
  -usb -usbdevice tablet
If that doesn't work, try this:
If that doesn't work, try this:


 
  $ export SDL_VIDEO_X11_DGAMOUSE=0
  $ export SDL_VIDEO_X11_DGAMOUSE=0
(from http://wiki.clug.org.za/wiki/QEMU_mouse_not_working )
(from http://wiki.clug.org.za/wiki/QEMU_mouse_not_working )
Line 180: Line 219:
----------
----------


== General kvm information ==
== General KVM information ==
=== What is the difference between kvm and Xen? ===
=== 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.                                                          
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 paravirtualisation. kvm does not support paravirtualization for cpu but may support paravirtualization for device drivers to improve I/O performances.                                                                                    
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? ===
=== What is the difference between KVM and VMware? ===
VMware is a proprietary product. kvm is Free Software released under the GPL.
VMware is a proprietary product. KVM is Free Software released under the GPL.


----------
----------


=== What is the difference between kvm and QEMU? ===
=== What is the difference between KVM and QEMU? ===
Qemu uses emulation; kvm uses processor extensions (HVM) for virtualization.
QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization.


----------
----------


=== Do you have a port of kvm for Windows? ===
=== Do you have a port of KVM for Windows? ===
Not in this release.                        
Not officially.
 
Kazushi Takahashi has been working on an experimental version though, called WinKVM, available [http://github.com/ddk50/winkvm here].


----------
----------


=== What kernel version does it work with? ===
=== 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.                                              
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? ===
=== 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.                                                        
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? ===
=== Is dynamic memory management for guests 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.                                                                  
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 [http://www.nongnu.org/qemu/qemu-doc.html#SEC12 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? ===
=== 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.                                                                                                    
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 a live migration feature to move virtual machines from one host to another without downtime? ===
Yes.  See the [[Migration]] page for details.                                                          
Yes.  See the [[Migration]] page for details.


----------
----------


=== Does kvm support live migration from an AMD host to an Intel host and back? ===
=== 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.                                                                                            
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? ===
=== 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.                                        
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.                                                                              
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? ===
=== Is it possible to use a host's USB devices within a guest? ===
Yes, look up how to do it with qemu, it's the same way.  
Yes, this method is described in detail [http://www.linux-kvm.org/page/USB_Host_Device_Assigned_to_Guest here].


----------
----------


=== Can I have higher or widescreen resolutions (eg 1680 x 1050) in kvm? ===
=== 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.                                                      
Use the -vga std parameter while starting the VM to allow high resolution and widescreen displays.


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.                                            
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).
When using Windows as guest OS and not having issues with people violating the GPL you might want to use the driver from the VBEMP x86 project (http://www.bearwindows.boot-land.net/vbemp.htm) which is based on ReactOS code.


----------
----------


=== Does kvm support SMP hosts? ===
=== Does KVM support SMP hosts? ===
Yes.
Yes.


----------
----------


=== Does kvm support SMP guests? ===
=== 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)
Yes. Up to 16 CPUs can be specified using the -smp option.


----------
----------


=== Is the name 'kvm' trademarked? ===
=== Is the name 'KVM' trademarked? ===
No.
No.


----------
----------


=== What is Qumranet's product? ===
=== I compiled a new kernel for my KVM client and the ethernet interface is not recognized ===
Qumranet is a startup company financed by [http://www.sequoiacap.com/ Sequoia Capital] and [http://www.nvp.com/ Norwest Venture Partners (NVP)].
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.
 
----------


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


----------
----------
[[Category:Docs]][[Category:HowTo]]

Latest revision as of 15:44, 20 December 2020

FAQ

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.


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.


Where do I get my kvm kernel modules from?

See the Getting the kvm kernel modules page.


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.

Note:

  • You'll never see (vmx|svm) in /proc/cpuinfo if you're currently running in in a dom0 or domU.
    The Xen hypervisor suppresses these flags in order to prevent hijacking.
  • 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.

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?

Yes. Please see the Management Tools page for some links.


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

KERNEL=="kvm", GROUP="kvm"

How can I get the most performance out of KVM?

See the Tuning KVM page.


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

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.

Guest-side network lockups (fortunately restartable) may be happening due to tun/tap bridging erroneous MAC address reconfiguration on host side, see RHEL bug #571991 and others.


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.

Perhaps qemu's -tdf (timing drift fix) option magically manages to help in your case, too.

See also Faqs: I received a message about "clock skew".


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

Try setting CONFIG_HPET_EMULATE_RTC=y in your host .config.


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

(from http://wiki.clug.org.za/wiki/QEMU_mouse_not_working )


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?

QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization.


Do you have a port of KVM for Windows?

Not officially.

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?

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


Is it possible to use a host's USB devices within a guest?

Yes, this method is described in detail here.


Can I have higher or widescreen resolutions (eg 1680 x 1050) in KVM?

Use the -vga std parameter while starting the VM to allow high resolution and widescreen displays.

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 and not having issues with people violating the GPL you might want to use the driver from the VBEMP x86 project (http://www.bearwindows.boot-land.net/vbemp.htm) which is based on ReactOS code.


Does KVM support SMP hosts?

Yes.


Does KVM support SMP guests?

Yes. Up to 16 CPUs can be specified using the -smp option.


Is the name 'KVM' trademarked?

No.


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.