Xen Common Problems: Difference between revisions
Lars.kurth (talk | contribs) |
Rcpavlicek (talk | contribs) |
||
(83 intermediate revisions by 9 users not shown) | |||
Line 5: | Line 5: | ||
<!-- Original date: Wed Oct 26 18:28:24 2011 (1319653704000000) --> |
<!-- Original date: Wed Oct 26 18:28:24 2011 (1319653704000000) --> |
||
{{InfoLeft|This page contains answers to some common problems and questions about Xen. This list contains '''the most frequently asked questions'''. You may also want to check out the articles in [[:Category:FAQ]]. Each section in this document links to further questions in other FAQ documents.}} |
|||
{{Needs_Refactor|This page has some issues with syntax and formatting: [[[XenConfigurationFileOptions]]]should be [[XenConfigurationFileOptions]], etc. The page will also benefit from being broken into smaller FAQs along topics and merged with [[XenFAQ]] and [[XenFAQ2]].}} |
|||
'''Answers to some common problems and questions about Xen''' |
|||
<!-- ! TOC here --> |
<!-- ! TOC here --> |
||
= General = |
|||
== I'd like to contribute to the Xen wiki pages, I have something to add/edit/fix, how can I do it? == |
|||
Contributions are very welcome! You should create yourself a wiki account. No edit permissions are needed. More info on getting started at |
|||
== I'd like to contribute to the Xen Project wiki pages, I have something to add/edit/fix, how can I do it? == |
|||
Contributions are very welcome! You should create yourself a wiki account, then fill out [http://xenproject.org/component/content/article/100-misc/145-request-to-be-made-a-wiki-editor.html this form] to get editing rights (we used to allow anyone to edit, but spammers have ruined that). More info on getting started at |
|||
* [[Special:UserLogin|Create an account or log in]] |
* [[Special:UserLogin|Create an account or log in]] |
||
* [[Sandbox|Play with the Sandbox]] |
* [[Sandbox|Play with the Sandbox]] |
||
Line 22: | Line 23: | ||
* [[Xen:Multi-language Conventions|Multi-language Conventions]] |
* [[Xen:Multi-language Conventions|Multi-language Conventions]] |
||
== I'm interesting in being a Xen Project developer! Are there projects to work on? == |
|||
== I'd like to read some kind of overview about Xen == |
|||
Yes! Please check the [[Xen Development Projects]] wiki page for more information! |
|||
See the [[XenOverview]] wiki page and [[:Category:Overview]]. Also check the following PDF documents: |
|||
== How does Xen Project compare to KVM? Which one is better? == |
|||
* http://www.xen.org/files/Marketing/WhatisXen.pdf |
|||
Please see this blog post for more information: http://blog.xenproject.org/index.php/2010/05/07/xen-%E2%80%93-kvm-linux-%E2%80%93-and-the-community/ |
|||
* http://www.xen.org/files/Marketing/WhyXen.pdf |
|||
* http://www.xen.org/files/Marketing/NewtoXenGuide.pdf |
|||
* http://www.xen.org/files/Marketing/HowDoesXenWork.pdf |
|||
== Where can I read about the history of Xen? == |
|||
Please see: http://www.xen.org/community/xenhistory.html |
|||
== I'm interesting in being a Xen developer! Are there projects to work on? == |
|||
Yes! Please check the [[XenDevelopmentProjects]] wiki page for more information! |
|||
== How does Xen compare to KVM? Which one is better? == |
|||
Please see this blog post for more information: http://blog.xen.org/index.php/2010/05/07/xen-%E2%80%93-kvm-linux-%E2%80%93-and-the-community/ |
|||
Also check these documents: |
Also check these documents: |
||
* http://www.slideshare.net/xen_com_mgr/why-xen-slides |
* http://www.slideshare.net/xen_com_mgr/why-xen-slides |
||
* http://blog. |
* http://blog.xenproject.org/index.php/2010/07/30/why-xen-paper-published/ |
||
== Is there a "Best Practices" document available? == |
== Is there a "Best Practices" document available? == |
||
See the [[ |
See the [[Xen Project Best Practices]] wiki page. |
||
== |
== Is there a list of various 3rd party management tools and (web) interfaces for Xen Project software? == |
||
Yes, please see the [http://xenproject.org/directory/directory.html Xen Project Ecosystem Directory] for tools and solutions using Xen Project. |
|||
See the [[XenDom0Kernels]] wiki page. |
|||
== |
== Do you have a list of Xen Project related research papers? == |
||
Yes, please see the [http://www.xenproject.org/directory/directory/research.html Research Papers Directory] |
|||
See the [[XenKernelFeatures]] wiki page. |
|||
== What's the difference between Xen Project Hypervisor (from XenProject.org) and Citrix [[XenServer]] (or XCP)? == |
|||
== I have problems getting Xen or dom0 kernel to boot, how can I set up a serial console to log and troubleshoot the boot process? == |
|||
The Xen Project Hypervisor from XenProject.org is the core hypervisor used in many different products. It includes basic command line management tools. It is distributed as a tarball and from mercurial source code repositories. You need to compile and install Xen hypervisor from sources, and combine it with a kernel of your choice. It can be thought as the "core engine" you can use to build your own virtualization platform. |
|||
See the [[XenSerialConsole]] wiki page. |
|||
Many Linux distributions package Xen and distribute it as prebuilt binaries, combined with Xen capable kernels of their choice. There are many additional thirdparty management tools available to manage the Xen hypervisor. |
|||
== Where can I find a list of all the available domU configuration options in /etc/xen/<guest> cfgfile? == |
|||
See the [[XenConfigurationFileOptions]] wiki page. |
|||
There are multiple companies shipping products based on the Xen hypervisor, including Citrix, Oracle, SUSE, Ubuntu, and others. |
|||
Yes, please see the [[XenHypervisorBootOptions]] wiki page. |
|||
Citrix [[XenServer]] is a commercial product that includes the core Xen Project Hypervisor from XenProject.org, combined with CentOS-based dom0 distro, management toolstack, and everything else required to build a ready made virtualization platform. XenServer was Open Sourced in 2014. Citrix [[XenServer]] is a dedicated virtualization platform (not a general purpose Linux distro), and it is shipped as a ready to install ISO-image that contains everything you need out-of-the-box. Citrix [[XenServer]] includes the XAPI management toolstack, allowing you to pool multiple Xen hosts together and manage them centrally using either the graphical Citrix [[XenCenter]] management tool, the 'xe' commandline tool or using the XenAPI directly from your scripts. Citrix [[XenCenter]] graphical management tool is only available for Windows. |
|||
== Can I passthrough an USB device connected to dom0 to a Xen guest? == |
|||
<!-- |
|||
Yes, please see the [[XenUSBPassthrough]] wiki page. |
|||
Xen Cloud Platform (XCP) was announced in 2009, and it is the opensourced version of Citrix [[XenServer]], including the XAPI management toolstack. XCP and XAPI are now developed on xen.org repositories. XCP is shipped as ready to install ISO-images, just like Citrix [[XenServer]]. Citrix is basing their new Citrix [[XenServer]] releases on XCP. XCP includes the XenAPI provided by the XAPI toolstack and the 'xe' commandline tool. XCP does not include Citrix [[XenCenter]] and Citrix [[XenCenter]] cannot be used to manage XCP. XCP users can use the opensource [[OpenXenManager]] instead, which runs on Linux. See http://www.xen.org/products/cloudxen.html for more information about XCP. |
|||
--> |
|||
== Can I |
== Can I browse the Xen Project source trees online? == |
||
Yes, |
Yes, you can browse the source tree and see the changelogs/summaries and track changes online from the [[Xen Project Repositories]] wiki page. |
||
== Can I |
== Can I browse the Xen Project Qemu-dm (HVM guest ioemu) source repositories online? == |
||
Yes, |
Yes, you can see the changelogs/summaries and track changes online from the [[Xen Project Repositories]] wiki page. |
||
<!-- This should stay the last entry --> |
|||
== I have problems using my graphics card in Xen dom0, with the pvops dom0 kernel.. any tips? == |
|||
Yes, please see the [[XenPVOPSDRM]] wiki page. |
|||
== Where do I find more General FAQs? == |
|||
== Is there more information about Xen PVSCSI passthrough functionality? == |
|||
See [[Xen FAQ General]] |
|||
Yes, please see the [[XenPVSCSI]] wiki page. |
|||
= Compatibility = |
|||
== Is there more information about Xen "blktap" disk backend? == |
|||
Yes, Xen actually has two blktap backends: |
|||
== Where can I find a list of available Xen Project Domain 0 kernels? == |
|||
* blktap1: please see the [[blktap]] wiki page for more information. |
|||
See the [[Dom0 Kernels for Xen]] wiki page. |
|||
blktap2 supports VHD images, and is considered much more robust than the old blktap1 qemu/qcow image file support. Xen 4.0 includes blktap2 support. Note that also the dom0 kernel needs to have the blktap2 driver. |
|||
== |
== Where can I find a list of available features in different Xen Project enabled kernels? == |
||
See the [[Xen Kernel Feature Matrix]] wiki page. |
|||
== |
== Where can I find information about Xen Project on RISC CPUs? == |
||
* Please see [[Xen ARM (PV)]] wiki page for Xen Project on ARM CPUs. The Xen ARM project is no longer actively developed. It has been superseded by the [[Xen ARM with Virtualization Extensions]] effort. |
|||
Yes, please see the [[Remus]] wiki page for more information. |
|||
* Please see [[Xen ARM with Virtualization Extensions]] wiki page for Xen Project on ARMv7 CPUs with Virtualization Extensions. This project is actively developed. |
|||
* Xen Project has also been ported to MIPS64 platform. See the Netlogic Microsystems press release for more information: http://vmblog.com/archive/2012/01/30/netlogic-microsystems-announces-the-industry-s-first-open-source-xen-hypervisor-for-multi-core-mips64-processors.aspx or the xen-devel mailinglist post: http://lists.xenproject.org/archives/html/xen-devel/2012-01/msg00301.html . |
|||
== Where can I find optimized Xen PV-on-HVM drivers for Linux HVM (fully virtualized) guests? == |
|||
Please see the [[XenLinuxPVonHVMdrivers]] wiki page. |
|||
== Do you have a list of Xen related research papers? == |
|||
Yes, please see http://www.xen.org/community/xenpapers.html |
|||
== Where can I find information about Xen on RISC CPUs? == |
|||
* Please see [[XenARM]] wiki page for Xen on ARM CPUs. Xen ARM project is actively developed. |
|||
* Please see [[Xen_ARMv7_with_Virtualization_Extensions]] wiki page for Xen on ARMv7 CPUs with Virtualization Extensions. This project is actively developed. |
|||
* Xen has also been ported to MIPS64 platform. See the Netlogic Microsystems press release for more information: http://vmblog.com/archive/2012/01/30/netlogic-microsystems-announces-the-industry-s-first-open-source-xen-hypervisor-for-multi-core-mips64-processors.aspx or the xen-devel mailinglist post: http://lists.xen.org/archives/html/xen-devel/2012-01/msg00301.html . |
|||
* Please see [[XenPPC]] wiki page for Xen on PowerPC CPUs. XenPPC project is not active anymore. |
* Please see [[XenPPC]] wiki page for Xen on PowerPC CPUs. XenPPC project is not active anymore. |
||
== What's the difference between Xen hypervisor (from xen.org) and Citrix [[XenServer]] or XCP? == |
|||
Xen hypervisor from xen.org is the core hypervisor used in many different products. It includes basic command line management tools. It is distributed as a tarball and from mercurial source code repositories. You need to compile and install Xen hypervisor from sources, and combine it with a kernel of your choice. It can be thought as the "core engine" you can use to build your own virtualization platform. |
|||
== How can I check the version of Xen Project hypervisor? == |
|||
Many Linux distributions package Xen and distribute it as prebuilt binaries, combined with Xen capable kernels of their choice. There are many additional thirdparty management tools available to manage the Xen hypervisor. |
|||
Run "'''xl info'''" in domain 0 (on older versions, you might need to use "'''xm info'''"). You can find the hypervisor version in "xen_major", "xen_minor" and "xen_extra" fields. The version is major.minor.extra. |
|||
There are multiple companies shipping products based on the Xen hypervisor, including Citrix, Oracle, Novell, Redhat, and others. |
|||
Citrix [[XenServer]] is a commercial product that includes the core Xen hypervisor from xen.org, combined with CentOS-based dom0 distro, management toolstack, and everything else required to build a ready made virtualization platform. Citrix [[XenServer]] is a dedicated virtualization platform (not a general purpose Linux distro), and it is shipped as a ready to install ISO-image that contains everything you need out-of-the-box. Citrix [[XenServer]] includes the XAPI management toolstack (which not included in the core Xen hypervisor from xen.org), allowing you to pool multiple Xen hosts together and manage them centrally using either the graphical Citrix [[XenCenter]] management tool, the 'xe' commandline tool or using the XenAPI directly from your scripts. Citrix [[XenCenter]] graphical management tool is only available for Windows. |
|||
Xen Cloud Platform (XCP) was announced in 2009, and it is the opensourced version of Citrix [[XenServer]], including the XAPI management toolstack. XCP and XAPI are now developed on xen.org repositories. XCP is shipped as ready to install ISO-images, just like Citrix [[XenServer]]. Citrix is basing their new Citrix [[XenServer]] releases on XCP. XCP includes the XenAPI provided by the XAPI toolstack and the 'xe' commandline tool. XCP does not include Citrix [[XenCenter]] and Citrix [[XenCenter]] cannot be used to manage XCP. XCP users can use the opensource [[OpenXenManager]] instead, which runs on Linux. See http://www.xen.org/products/cloudxen.html for more information about XCP. |
|||
== How can I check the version of Xen hypervisor? == |
|||
Run "xm info" in dom0. You can find the hypervisor version in "xen_major", "xen_minor" and "xen_extra" fields. The version is major.minor.extra. |
|||
Determining the version from within a domU is dependent on the guest operating system. For Linux guests: |
Determining the version from within a domU is dependent on the guest operating system. For Linux guests: |
||
<pre> |
<pre> |
||
$ dmesg | grep Xen\ version |
$ dmesg | grep Xen\ version |
||
Xen version: |
Xen version: 4.2.0 (preserve-AD) |
||
</pre> |
</pre> |
||
Line 137: | Line 104: | ||
NOTE that Linux dom0 kernel doesn't see 'vmx' or 'svm' CPU flags in "/proc/cpuinfo" because Xen *hypervisor* (xen.gz) is using the hardware virtualization features and hiding the flags from dom0! Xen dom0 is actually a virtual machine, so it doesn't see all the cpu flags as Xen hypervisor is hiding some flags from dom0. |
NOTE that Linux dom0 kernel doesn't see 'vmx' or 'svm' CPU flags in "/proc/cpuinfo" because Xen *hypervisor* (xen.gz) is using the hardware virtualization features and hiding the flags from dom0! Xen dom0 is actually a virtual machine, so it doesn't see all the cpu flags as Xen hypervisor is hiding some flags from dom0. |
||
You can run " |
You can run "'''xl info'''" in dom0 and check from the 'xen_caps' line if Xen is able to run hvm guests. Also Xen hypervisor boot messages in "'''xl dmesg'''" show if hardware virtualization (HVM) is enabled or disabled. |
||
Example " |
Example "'''xl dmesg | grep -i hvm'''" output for an Intel system where HVM is supported by the CPU: |
||
Line 146: | Line 113: | ||
</pre> |
</pre> |
||
Example " |
Example "'''xl dmesg'''" output for an Intel system where HVM is supported by the CPU but it's disabled in the system BIOS: |
||
Line 153: | Line 120: | ||
</pre> |
</pre> |
||
Example " |
Example "'''xl dmesg | grep -i hvm'''" output for an AMD system where HVM is supported: |
||
Line 160: | Line 127: | ||
</pre> |
</pre> |
||
You can also see the HVM support status from the "xen_caps" line on Xen hypervisor " |
You can also see the HVM support status from the "xen_caps" line on Xen hypervisor "'''xl info | grep xen_caps'''" output: |
||
Line 169: | Line 136: | ||
== How can I check if my CPU supports HAP (Hardware Assisted Paging) ? == |
== How can I check if my CPU supports HAP (Hardware Assisted Paging) ? == |
||
You can check Xen dmesg by running " |
You can check Xen dmesg by running "'''xl dmesg'''" to verify if HAP is supported on your CPU: |
||
<pre> |
<pre> |
||
Line 186: | Line 153: | ||
== How can I check if my hardware has an IOMMU (VT-d) and it's enabled and supported? == |
== How can I check if my hardware has an IOMMU (VT-d) and it's enabled and supported? == |
||
Hardware IOMMU (Intel VT-d) is required for hardware assisted PCI passthru (I/O virtualization) to Xen HVM (fully virtualized) guest VMs. You can check for IOMMU status from " |
Hardware IOMMU (Intel VT-d) is required for hardware assisted PCI passthru (I/O virtualization) to Xen HVM (fully virtualized) guest VMs. You can check for IOMMU status from "'''xl dmesg'''" output. |
||
Example " |
Example "'''xl dmesg'''" output for a system where IOMMU is supported: |
||
Line 195: | Line 162: | ||
</pre> |
</pre> |
||
Example " |
Example "'''xl dmesg'''" output for a system where IOMMU is not supported: |
||
Line 225: | Line 192: | ||
For more information about using an IOMMU with Xen see [[Xen_PCI_Passthrough]] and [[VTd_HowTo]] wiki pages. |
For more information about using an IOMMU with Xen see [[Xen_PCI_Passthrough]] and [[VTd_HowTo]] wiki pages. |
||
== Are there FreeBSD Xen PV kernels/images available? == |
|||
== Xen complains about "hotplug scripts not working" == |
|||
Please check the following link: http://wiki.freebsd.org/FreeBSD/Xen . |
|||
== Where can I find information about NetBSD Xen support? == |
|||
This problem is often related to udev. Do you have udev installed? Is your udev the correct/supported version? This error usually has more information in the end revealing the real reason.. for example: |
|||
NetBSD supports both Xen dom0 and PV domUs. For more information see: http://www.netbsd.org/ports/xen/ |
|||
<!-- Leave this at the end --> |
|||
== Where do I find more Compatibility related FAQs? == |
|||
See [[Xen FAQ Compatibility]] |
|||
= Booting = |
|||
== Is there a list of all available Xen hypervisor (xen.gz) commandline boot options for grub.conf? == |
|||
Yes, please see the [[XenHypervisorBootOptions]] wiki page. |
|||
== What's Xen pygrub? == |
|||
Pygrub allows you to simply specify in Xen PV guest "/etc/xen/<guest>" cfgfile: |
|||
<pre> |
<pre> |
||
bootloader = "/usr/bin/pygrub" |
|||
Error: Device 0 (vif) could not be connected. Could not find bridge device br0. |
|||
</pre> |
</pre> |
||
Which replaces all these options: |
|||
Which means exactly what it says.. the guest is configured to to use a bridge called "br0", but there's no such bridge in dom0. Run "brctl show" to verify what bridges you have. Create the missing bridge, or edit the VM cfgfile and make it use another (correct) bridge. |
|||
<pre> |
<pre> |
||
kernel = "vmlinuz-2.6.32.12" |
|||
Error: Device 0 (vif) could not be connected. Hotplug scripts not working. |
|||
ramdisk = "initrd-2.6.32.12.img" |
|||
root = "/dev/xvda1" |
|||
extra = "earlyprintk=xen console=hvc0" |
|||
</pre> |
</pre> |
||
When you start a Xen PV guest pygrub will be executed in dom0 and it'll access the guest disk configured in the "/etc/xen/<guest>" cfgfile, find "/boot/grub/grub.conf" (or menu.lst) from the guest filesystem, parse it, fetch the kernel, initrd image and kernel parameters configured in the guest to dom0, and then boot up the guest using those kernel + initrd + parameters. All the domU specific settings are configured inside the domU, in grub.conf. |
|||
Requirements for using pygrub for Xen PV domUs: |
|||
This problem is often caused by not having "xen-netback" driver loaded in dom0 kernel. |
|||
* Pygrub binary available in dom0, installed together with Xen. |
|||
The hotplug scripts are located in /etc/xen/scripts by default, and are labeled with the prefix vif-*. Those scripts log to /var/log/xen/xen-hotplug.log, and more detailed information can be found there. |
|||
* Pygrub configured for the guest in "/etc/xen/<guest>" cfgfile |
|||
* Guest has /boot/grub/grub.conf (or menu.lst) with proper entries in it. There's actually no need to install the real grub to the MBR of the guest disk, it's enough to just have the grub.conf/menu.lst in the guest. |
|||
Pygrub makes it much easier to: |
|||
* Manage the guest kernels inside every guest, keeping the guest distribution package managers (dpkg,rpm) and package dependencies happy. |
|||
* Upgrade guest kernels without touching dom0 or guest configuration files in "/etc/xen/" in dom0. |
|||
* Each guest distribution can easily use the default kernel provided by the distribution. |
|||
* Pygrub allows you to select which kernel to boot, in the "'''xl console <guest>'''" session. It's easiest to start the guest with "'''xl create -c /etc/xen/guest'''" to attach to the console immediate for selecting the kernel from pygrub menu. If nothing is chosen then the default entry will be booted automatically. |
|||
Management tools like "virt-install" and "virt-manager" will use Xen pygrub as a default when you install new guests using them. |
|||
== What's Xen pvgrub? == |
|||
Xen pvgrub is like pygrub but more secure. |
|||
Pygrub is executed in dom0, so it could have security concerns/issues, if bugs were found from it. Pvgrub is executed in the Xen PV guest, so there are no such security issues with it. |
|||
Pvgrub is a separate build and separate tool, so usually it's easier to begin with pygrub, and then later switch to pvgrub. |
|||
See [[PvGrub]] wiki page for more information and usage of pvgrub. |
|||
== Does Xen pygrub support booting PV guests using GRUB2 config files? == |
|||
Yes, pygrub supports guests using GRUB2 config files. |
|||
== How can I boot Xen HVM guest from a virtual emulated floppy, using an image file as the floppy? == |
|||
This is the required configuration in "/etc/xen/<hvmguest>" cfgfile: |
|||
<pre> |
<pre> |
||
fda = '/path/to/floppy.img' boot=a |
|||
Error: Device 5632 (vbd) could not be connected. Path closed or removed during hotplug add: backend/vbd/2/5632 state: 1" |
|||
</pre> |
</pre> |
||
You can also use this cmdline method while creating the guest: |
|||
This problem can be caused by not having "xen-blkback" driver loaded in dom0 kernel. |
|||
<pre> |
|||
So when dealing with these problems always check you have all the required xen backend driver modules loaded in dom0 kernel! netbk or xen-netback for networking, and blkbk or xen-blkback for block devices (virtual disks). |
|||
xl create /etc/xen/hvmguest.cfg fda=/path/to/floppy.img boot=a |
|||
</pre> |
|||
Important note: Make sure SElinux access restrictions are not blocking access to /path/to/floppy.img! |
|||
== I have problems getting Xen or dom0 kernel to boot, how can I set up a serial console to log and troubleshoot the boot process? == |
|||
See the [[XenSerialConsole]] wiki page. |
|||
<!-- Leave this at the end --> |
|||
== Where do I find more Booting FAQs? == |
|||
See [[Xen FAQ Booting]] |
|||
= Guest / DomU = |
|||
== Where can I find a list of all the available domU configuration options in /etc/xen/<guest> cfgfile? == |
|||
See the [[XenConfigurationFileOptions]] wiki page. |
|||
== Where can I find optimized Xen PV-on-HVM drivers for Linux HVM (fully virtualized) guests? == |
|||
Please see the [[XenLinuxPVonHVMdrivers]] wiki page. |
|||
== I can't start any HVM guests, I get error "libxl__domain_make domain creation fail: cannot make domain: -3". PV guests work fine. == |
|||
Also read the full "xm log", it most probably includes additional information about the problem and the error messages. |
|||
This means you likely have an Intel CPU with Trusted Execution Technology. Enabling this feature in your BIOS can have a negative impact on the availability |
|||
of VT-d, which is a prerequisite of running HVM guests. Please disable TXT in the BIOS and you will be able to boot your HVM guests. |
|||
== I upgraded PV domU from old Xenlinux kernel to new pvops kernel, and now the domU doesn't work anymore! == |
== I upgraded PV domU from old Xenlinux kernel to new pvops kernel, and now the domU doesn't work anymore! == |
||
Many people seem to upgrade their Xen guest PV kernels at the same time they upgrade |
Many people seem to upgrade their Xen guest PV kernels at the same time they upgrade to a newer Xen version. This is actually not a required step! You can still use your old domU kernels with the new Xen version, and with a new dom0 kernel version. Xen hypervisor is the compatibility layer, so dom0 and domUs can have totally different kernels. |
||
Old Xenlinux PV kernels (linux-2.6.18-xen, ubuntu 2.6.24, debian 2.6.26, sles11 2.6.27, sles11 sp1 2.6.32, opensuse 2.6.31 etc) have different device names for virtual disks and virtual console than the new pvops (upstream kernel.org) Linux kernels. The old device names in Xenlinux kernels usually are: |
Old Xenlinux PV kernels (linux-2.6.18-xen, ubuntu 2.6.24, debian 2.6.26, sles11 2.6.27, sles11 sp1 2.6.32, opensuse 2.6.31 etc) have different device names for virtual disks and virtual console than the new pvops (upstream kernel.org) Linux kernels. The old device names in Xenlinux kernels usually are: |
||
Line 278: | Line 309: | ||
* Make sure the domU kernel has xen-blkfront driver built-in, or if it's built as a module (most common option), then you need to have a proper initrd (ramdisk) image for the domU kernel that actually loads the xen-blkfront driver so that the guest kernel can access the root filesystem! Failing to do this will cause the domU kernel to crash on boot because it can't find the root filesystem! |
* Make sure the domU kernel has xen-blkfront driver built-in, or if it's built as a module (most common option), then you need to have a proper initrd (ramdisk) image for the domU kernel that actually loads the xen-blkfront driver so that the guest kernel can access the root filesystem! Failing to do this will cause the domU kernel to crash on boot because it can't find the root filesystem! |
||
* Note that you usually can't use the dom0 initrd image for a domU! dom0 initrd is generated for *dom0*, so it tries to load all the drivers for the *physical* hardware, while you have only virtual hardware in the domU! initrd ramdisk images are system specific, where dom0 and domU are different systems. Usually it's easiest to build an initrd/initramfs image for the domU in the *domU*. So boot the domU up with the old kernel, and generate an initrd image for the new pvops kernel. Make sure the new generated initrd-image loads xen-blkfront driver! |
* Note that you usually can't use the dom0 initrd image for a domU! dom0 initrd is generated for *dom0*, so it tries to load all the drivers for the *physical* hardware, while you have only virtual hardware in the domU! initrd ramdisk images are system specific, where dom0 and domU are different systems. Usually it's easiest to build an initrd/initramfs image for the domU in the *domU*. So boot the domU up with the old kernel, and generate an initrd image for the new pvops kernel. Make sure the new generated initrd-image loads xen-blkfront driver! |
||
* You need set up (or modify) a getty for the new console device in the domU init/inittab settings, so you can get a login prompt on the " |
* You need set up (or modify) a getty for the new console device in the domU init/inittab settings, so you can get a login prompt on the "xl console" session. |
||
* You need to add the console device name to "/etc/securetty" in the domU so root is allowed to login from the console. |
* You need to add the console device name to "/etc/securetty" in the domU so root is allowed to login from the console. |
||
* If you're having networking problems with the new pvops domU kernels make sure you have "xen-netfront" driver loaded in the new kernel. It's usually built as a module in the recent pvops/upstream/distro kernels. |
* If you're having networking problems with the new pvops domU kernels make sure you have "xen-netfront" driver loaded in the new kernel. It's usually built as a module in the recent pvops/upstream/distro kernels. |
||
Also see [[Migrate_from_Linux_2.6.18_to_2.6.31_and_higher]] wiki page for more information. |
Also see [[Migrate_from_Linux_2.6.18_to_2.6.31_and_higher]] wiki page for more information. |
||
== My Xen PV guest kernel crashes, how can I debug it and get a stack/call trace? == |
|||
== I can't connect to the console of my guest using "xm console <guest>" == |
|||
Edit "/etc/xen/<guest>" cfgfile, and set: |
|||
Do you have "xenconsoled" process running in dom0? If you do, did you try killing it and restarting it? Also, only one console session per domU can exist at a time. Currently, attempting to use more than one console session per domU will not raise an error, but will result in strange behavior. |
|||
== Console of my PV guest shows kernel boot messages and then it stops and doesn't work anymore == |
|||
Do you have a getty configured for the console device in the guest? You usually need to add an entry to /etc/inittab in the guest to make the guest present login prompt on the "xm console" session. Is the getty configured for a correct console device? See the chapter below for correct guest console devices. |
|||
Example "/etc/inittab" entry for Debian Lenny (linux-image-2.6.26-2-xen) guest, write this on a new (last) line: |
|||
<pre> |
<pre> |
||
on_crash="preserve" |
|||
vc:2345:respawn:/sbin/getty 38400 hvc0 |
|||
</pre> |
</pre> |
||
Then when your domU guest crashes, run this in dom0: |
|||
Example "/etc/inittab" entry for CentOS 5 (kernel-xen-2.6.18) guest: |
|||
<pre> |
<pre> |
||
/usr/lib/xen/bin/xenctx -s System.map-domUkernelversion <domUid> <vcpu-number> |
|||
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav |
|||
</pre> |
</pre> |
||
If you're running 64bit dom0, then xenctx might be under "/usr/lib64/". This command will give you a stack trace of the crashed domU kernel on the specified vcpu, allowing you to see where it crashes. You should get the stack trace for every vcpu your guest has! Vcpu numbers start from 0. |
|||
After modifying /etc/inittab in the guest, run "kill -1 1" to make init (process id 1) reload the configuration file on-the-fly, or reboot the guest. This should make the console work and login prompt appear on the "xm console" session. |
|||
Note that you need to use the "System.map" file from the exact kernel version the domU is running, otherwise the stack trace results are not correct! |
|||
'''NOTE!''' Some distros (like newer Ubuntu) don't use "/etc/inittab" anymore, but instead you have to configure the gettys in other places! |
|||
== How do I change virtual/emulated CD .iso image for a Xen HVM guest? == |
|||
Ubuntu 6.06 LTS is the last ubuntu version to use "/etc/inittab" configuration file. Ubuntu 6.10 to 9.04 use "/etc/event.d/*" configuration files to configure init. Ubuntu 9.10 and newer use "/etc/init/*.conf". |
|||
First check "/etc/xen/<guest>" cfgfile and check what is your cdrom device in the guest. It's usually "/dev/hdc". |
|||
An example to swap the emulated CD using an iso image: |
|||
Example "/etc/init/hvc0.conf" entry for Ubuntu 10.04 Xen PV (linux-image-2.6.32) guest: |
|||
<pre> |
<pre> |
||
xl block-configure <guest> file:/path/to/new/cd.iso hdc:cdrom r |
|||
# hvc0 - getty |
|||
# |
|||
# This service maintains a getty on hvc0 from the point the system is |
|||
# started until it is shut down again. |
|||
start on stopped rc RUNLEVEL=[2345] |
|||
stop on runlevel [!2345] |
|||
respawn exec /sbin/getty -L hvc0 9600 linux |
|||
</pre> |
</pre> |
||
== I'm trying to create a new Xen VM but I get error there's not enough free memory == |
|||
== Console of my PV guest is totally empty, it doesn't show anything, not even kernel boot messages! == |
|||
This usually means your PV (paravirtual) guest is using a newer pv_ops (upstream Linux kernel.org) kernel that has different console device name. You need to add "console=hvc0" to the guest kernel command line options. |
|||
Tools like "free" or "top" in Xen dom0 show that you have a lot of free memory, but Xen still complains that there's not enough free memory to create/start a new VM, giving errors such as "Out of memory". This usually happens because dom0 is using all the memory, so there's no free memory in the Xen hypervisor (xen.gz) for other VMs. Note that dom0 is actually a Xen virtual machine! |
|||
If you're using Xen pygrub or pv-grub to load the kernel from guests filesystem, then you need to configure the guest kernel settings in the guest /boot/grub/grub.conf (or menu.lst), not in dom0! So edit the guest /boot/grub/grub.conf (or menu.lst) and add the "console=hvc0" option there for the default kernel. |
|||
Xen hypervisor dedicates physical memory for each VM, so you need to have actual free unallocated memory in the hypervisor to start a VM. You can check the Xen hypervisor memory usage with the following commands: |
|||
If you're not using pygrub or pv-grub, aka you're configuring everything in /etc/xen/<guest> configuration file in dom0, and you have the kernel/initrd in dom0 filesystem, then you can specify the additional "console=hvc0" parameter in the /etc/xen/<guest> configuration file in dom0, on the extra="" line. |
|||
Check the amount of total, used and free memory in Xen hypervisor: |
|||
== What's the correct console device name for my Xen PV guest == |
|||
* Xenlinux ("xenified") kernels use "xvc0" as the console device. |
|||
* Upstream kernel.org pv_ops kernels use "hvc0" as the console device |
|||
Examples of Xenlinux kernels using "xvc0" console: |
|||
<pre> |
|||
* xen.org linux-2.6.18-xen |
|||
xl info |
|||
* RHEL5 / CentOS5 kernel-xen 2.6.18 |
|||
</pre> |
|||
* Debian Etch 2.6.18-6-xen |
|||
* Debian Lenny 2.6.26-2-xen |
|||
* Ubuntu 8.04 LTS "hardy heron" 2.6.24 xen kernel |
|||
* Gentoo Xenlinux kernels |
|||
* Novell SLES 10 and SLES 11 xen kernels |
|||
* OpenSUSE xen kernels |
|||
* Various "xenified" forward-ports of the Novell SLES/OpenSUSE Xenlinux patches (2.6.27, 2.6.29, 2.6.30, 2.6.31, 2.6.32, 2.6.33, 2.6.34) |
|||
Examples of pv_ops domU kernels using "hvc0" console: |
|||
* All upstream/mainline kernel.org Linux kernels since 2.6.26. |
|||
* Fedora 10, Fedora 11, Fedora 12, Fedora 13 kernels |
|||
* Ubuntu 8.10 2.6.27 server-kernel |
|||
* Ubuntu 9.04 2.6.28 linux-image-server |
|||
* Ubuntu 9.10 2.6.31 ec2-kernel |
|||
* Ubuntu 10.04 ("Lucid Lynx") 2.6.32 kernel |
|||
* Debian 6.0 ("Squeeze") 2.6.32 kernels |
|||
== How do I exit domU "xm console" session == |
|||
Press ctrl+] or if you're using Putty press ctrl+5. |
|||
and check how much memory each VM is using: |
|||
== Everything seems OK but I still can't access the domU "xm console"! == |
|||
A couple of things to check: |
|||
* Do you have some old already running "xm console" session running on the host? possibly stuck in some dead ssh connection? |
|||
* Do you have virt-manager running on the host 'reserving' the guest console? |
|||
* Did it work earlier? |
|||
* Do you have problems with only one guest, or with all guests? |
|||
* Does shutting down and then re-starting the guest help? |
|||
* Are you really sure you are running a getty in the guest for the correct console device? :) |
|||
* Is the guest really up and running? Can you access it over the network with ssh? Can you ping it? |
|||
== Xen network-bridge script not working in Debian Lenny, errors about eth0 == |
|||
You edited "/etc/xen/xend-config.sxp" in your Debian Lenny dom0/host, and changed the default "network-dummy" to "network-bridge". When you reboot dom0, and xend is started, it gives error like this: |
|||
<pre> |
|||
ifdown: interface eth0 not configured |
|||
xl list |
|||
</pre> |
|||
RTNETLINK answers: Device or resource busy |
|||
It's possible that dom0 is using most of your memory and Xen hypervisor doesn't have any free memory left. You should use "dom0_mem=" setting for Xen in grub to configure dom0 a fixed/dedicated amount of memory, so the rest of the memory is free for other VMs to use. See [[XenBestPractices]] wiki page for more info about configuring "dom0_mem=" option for Xen. |
|||
This error can be caused by non-common settings for eth0 in "/etc/network/interfaces" configuration file. Try cleaning up the configuration, and having only a very basic ipv4-only configuration with a static IP, to begin with. Remove IPV6 configuration. Remove all the IP aliases. Reboot and try again. First get it working, then possibly later modify the configuration to be more advanced. |
|||
== Error: (4, 'Out of memory', 'panic: xc_dom_core.c:442: xc_dom_alloc_segment: segment ramdisk too large (0xee93 > 0x8000 - 0x1755 pages)') == |
|||
== Xend does not start when using pv_ops dom0 kernel? == |
|||
Getting this error when trying to start a new VM (running "'''xl create'''") means you're trying to use too big ramdisk image (initrd/initramfs file) for the domU. The ramdisk image configured is bigger than the amount of available memory for the VM. Remember the ramdisk images are compressed, and they need to fit as uncompressed to the domU memory. By modifying /etc/initramfs-tools/initramfs.conf, to set MODULES=dep, you can decrease the size of the generated initramfs. |
|||
You need to have Xen event channel (evtchn) driver included in your dom0 kernel for xend to be able to start. If Xen event channel support is compiled as a module, use "lsmod" to check that you have xen-evtchn (or xen_evtchn) driver module loaded. It not, use "modprobe" to load it. If Xen event channel support is statically built-in to the dom0 kernel then you don't need to load any modules. |
|||
== How can I use Xen PVHVM optimized paravirtualized drivers with Ubuntu 11.10 or Fedora 16 HVM guests? == |
|||
You also need xen-gntdev driver loaded. |
|||
Please see the [[Xen_Linux_PV_on_HVM_drivers]] wiki page for more information about Xen PVHVM drivers. |
|||
In December 2009 pv_ops dom0 kernel modules were renamed to have a "xen-" prefix in them, ie. "evtchn.ko" became "xen-evtchn.ko", and "gntdev.ko" became "xen-gntdev.ko". |
|||
This makes Xen 3.4.x xend fail to start, because it tried to load "evtchn.ko", but that doesn't exist. You need to load "xen-evtchn.ko" and then start xend. Fedora 12 xen-3.4.2-2 rpms have this problem fixed. If your xend does not automatically load evtchn or xen-evtchn driver module, please load it manually with modprobe. |
|||
== I followed a third-party HOWTO for creating or converting a VM, but it doesn't start. There are errors around access of '''qemu-dm''' as the device model. Why? == |
|||
Also make sure you have xenfs mounted to "/proc/xen", that's needed aswell. Do you have files under "/proc/xen/" directory? You should have for example: |
|||
Apparently, some older documentation and third-party instructions suggest using the following line in a VM config file: |
|||
<pre> |
<pre> |
||
device_model = 'qemu-dm' |
|||
# ls /proc/xen/ |
|||
capabilities privcmd xenbus xsd_kva xsd_port |
|||
# cat /proc/xen/capabilities |
|||
control_d |
|||
</pre> |
</pre> |
||
However, the use of '''qemu-dm''' in this context is no longer correct (as of 4.4, at least). The term '''qemu-dm''' is a generic term meaning "the current qemu device model". It is not an actual configuration file option. If you need to select a device model, use the configuration syntax: |
|||
"control_d" value in "/proc/xen/capabilities" means you're in Xen dom0 ("control domain"). |
|||
<pre> |
|||
Do you have files under "/dev/xen/" ? You should have there at least the following device nodes: |
|||
device_model_version = 'qemu-xen' |
|||
</pre> |
|||
to use the default qemu, or alternatively, if you want to use the older version of qemu bundled with the hypervisor: |
|||
<pre> |
<pre> |
||
device_model_version = 'qemu-xen-traditional' |
|||
# ls -la /dev/xen |
|||
total 0 |
|||
drwxr-xr-x 2 root root 80 Jun 19 19:17 . |
|||
drwxr-xr-x 20 root root 4580 Jun 19 19:33 .. |
|||
crw-rw---- 1 root root 10, 58 Jun 19 19:17 evtchn |
|||
crw-rw---- 1 root root 10, 57 Jun 19 19:17 gntdev |
|||
</pre> |
</pre> |
||
<!-- Leave this at the end --> |
|||
If you're missing those device nodes you can use "mknod" to create them manually. Creating those device nodes should happen automatically by udev when you have xen-evtchn and xen-gntdev driver modules loaded. |
|||
== Where do I find more DomU FAQs? == |
|||
You can see the correct major/minor for the device nodes from "/proc/misc": |
|||
See [[Xen FAQ DomU]] |
|||
= Host / Dom0 = |
|||
<pre> |
|||
# cat /proc/misc |
|||
57 xen/gntdev |
|||
58 xen/evtchn |
|||
</pre> |
|||
Note how they match the values from the previous "ls -la /dev/xen". If the major/minor numbers don't match then xenstored and xend won't be able to start/function. Note the major/minor numbers for device nodes are dynamic nowadays, so you need to verify they're properly set up for your system. |
|||
== How can I limit the number of vcpus my dom0 has? == |
== How can I limit the number of vcpus my dom0 has? == |
||
The recommended way is to use "dom0_max_vcpus=X" boot time option for Xen hypervisor (xen.gz) in grub.conf. You need to reboot after modifying grub.conf. Using this method makes sure you allocate resources only for the actual number of vcpus you need in dom0. |
The recommended way is to use "dom0_max_vcpus=X" boot time option for Xen hypervisor (xen.gz) in grub.conf. You need to reboot after modifying grub.conf. Using this method makes sure you allocate resources only for the actual number of vcpus you need in dom0. |
||
Another option is to configure "(dom0-cpus X)" option in /etc/xen/xend-config.sxp, but it works in a different way: dom0 boots up with all the cpus visible to it, and when xend starts, it'll hot-remove the extra vcpus from dom0, and only leaves the number of vcpus specified in (dom0-cpus) to dom0. This option has the benefit that vcpus can be later added to dom0, if needed. |
|||
== Can I dedicate a cpu core (or cores) only for dom0? == |
== Can I dedicate a cpu core (or cores) only for dom0? == |
||
Line 431: | Line 409: | ||
Specify "dom0_max_vcpus=X dom0_vcpus_pin" options for Xen hypervisor (xen.gz) in grub.conf and reboot. |
Specify "dom0_max_vcpus=X dom0_vcpus_pin" options for Xen hypervisor (xen.gz) in grub.conf and reboot. |
||
After rebooting you can verify with " |
After rebooting you can verify with "'''xl vcpu-list'''" that dom0 vcpus are pinned to only use the matching physical cpus. |
||
The next step is to configure all the guests (domUs) to NOT use those same physical cpus. This can be done by specifying for example cpus="2-7" to all /etc/xen/<guest> cfgfiles. This example would leave physical cpus/cores 0 and 1 only for dom0, and make the guests use cpus/cores 2 to 7. |
The next step is to configure all the guests (domUs) to NOT use those same physical cpus. This can be done by specifying for example cpus="2-7" to all /etc/xen/<guest> cfgfiles. This example would leave physical cpus/cores 0 and 1 only for dom0, and make the guests use cpus/cores 2 to 7. |
||
== Booting Xen with GRUB2 fails? == |
|||
It seems GRUB2 destroys the first parameter from Xen hypervisor "multiboot" and dom0 kernel "module" lines. For dom0 kernel this usually means root= parameter gets lost and thus dom0 kernel fails to set up the root filesystem and the boot fails. For xen.gz this usually means parameters like "dom0_mem=" or "dom0_vcpus" will get lost, whatever is the first parameter. |
|||
You can work around this problem by specifying "dummy=dummy" as the first parameter in grub2 config file for "multiboot" and "module" lines. This will fix the problem with Xen 4.0.0 and older hypervisor versions. |
|||
See this link for a working GRUB2 + Xen example:http://old.nabble.com/Strange-interaction-from-grub2-and-XEN-td26464067.html |
|||
The dummy workaround is not required anymore with Xen 4.0.1 and newer versions. See this patch for the Xen GRUB2 fix: http://xenbits.xen.org/xen-unstable.hg?rev/4207549948a4 and http://xenbits.xen.org/xen-4.0-testing.hg?rev/1da5224a2875 . |
|||
Other things that could go wrong. |
|||
Did you modify the config file manually? If yes, you might need to add |
|||
"insmod multiboot" (or "insmod multiboot2") |
|||
== 32bit Xen hypervisor crashes when using GRUB2 == |
|||
You get the following messages on the (serial) console when GRUB2 boots 32bit PAE Xen hypervisor: |
|||
<pre> |
|||
(XEN) **************************************** |
|||
(XEN) Panic on CPU 0: |
|||
(XEN) Cannot access memory beyond end of bootstrap direct-map area |
|||
(XEN) **************************************** |
|||
(XEN) |
|||
(XEN) Reboot in five seconds... |
|||
(XEN) Unknown interrupt (cr2=00000000) |
|||
</pre> |
|||
This is because your version of GRUB2 dumps the dom0 kernel and initrd image to a memory region that Xen cannot access. Changing to different GRUB2 version fixes the problem. Another option is to switch to 64 bit Xen hypervisor. Note that you can still run 32bit dom0 on 64bit Xen hypervisor. |
|||
This problem has been fixed in Xen 4.0.0-rc8 and newer versions. You can use new enough 32bit PAE Xen hypervisor with GRUB2. See these changesets for patches: http://xenbits.xen.org/xen-unstable.hg?rev/bcc09eb7379f and http://xenbits.xen.org/xen-unstable.hg?rev/377433a77d70 |
|||
== In dom0 how can I access and mount partitions inside a Xen disk image? == |
== In dom0 how can I access and mount partitions inside a Xen disk image? == |
||
Line 477: | Line 424: | ||
<pre> |
<pre> |
||
xl block-attach Domain-0 file:/disk/image/for/domU xvda w |
|||
</pre> |
</pre> |
||
Line 484: | Line 431: | ||
<pre> |
<pre> |
||
xl block-detach Domain-0 xvda |
|||
</pre> |
</pre> |
||
Line 497: | Line 444: | ||
You can also use Xen "phy:" backed LVM volumes instead of disk images. "phy:" doesn't require loop devices. |
You can also use Xen "phy:" backed LVM volumes instead of disk images. "phy:" doesn't require loop devices. |
||
As an example for Debian Lenny check this: http://www.howtoforge.com/virtualization-with-xen-on-debian-lenny-amd64 |
|||
Such an error message may also be indicative of other issues (such as the guest crashing and restarting so quickly that xend does not have time to free the older loopback device). |
Such an error message may also be indicative of other issues (such as the guest crashing and restarting so quickly that xend does not have time to free the older loopback device). |
||
== Debian Lenny Xen PV domU doesn't start, in the console it says "Waiting for root file system" and then drops to a busybox shell == |
|||
Is your root device set correctly for the guest (domU) kernel? Most probably you're using a wrong root= parameter, and thus the system cannot mount the root device and start. Check the early boot messages from the kernel, there should be a line starting with "Command line:". There you can see the parameters passed to the domU kernel. Do you see the correct root device there? |
|||
Remember the root= passed to a PV domU must be a path ''accessible from within the guest'' |
|||
You can set and edit the root device in dom0 from /etc/xen/<guest> configuration file. root device is specified either in "root=" line, or on "extra=" line. The configured root device should match the disk configuration for the guest. |
|||
Another problem can be that you're using wrong initrd image for the domU kernel. You should use an initrd generated for the guest, not the same initrd as you use to boot the dom0. |
|||
== My Xen PV guest kernel crashes, how can I debug it and get a stack/call trace? == |
|||
Edit "/etc/xen/<guest>" cfgfile, and set: |
|||
<pre> |
|||
on_crash="preserve" |
|||
</pre> |
|||
Then when your domU guest crashes, run this in dom0: |
|||
<pre> |
|||
/usr/lib/xen/bin/xenctx -s System.map-domUkernelversion <domUid> <vcpu-number> |
|||
</pre> |
|||
If you're running 64bit dom0, then xenctx might be under "/usr/lib64/". This command will give you a stack trace of the crashed domU kernel on the specified vcpu, allowing you to see where it crashes. You should get the stack trace for every vcpu your guest has! Vcpu numbers start from 0. |
|||
Note that you need to use the "System.map" file from the exact kernel version the domU is running, otherwise the stack trace results are not correct! |
|||
== Can I run graphical X applications in Xen dom0 without installing X server and display drivers? == |
== Can I run graphical X applications in Xen dom0 without installing X server and display drivers? == |
||
Line 547: | Line 464: | ||
If you're using Windows you can install "xming" and "putty". Start Xming, and after that enable X11 forwarding in putty settings (Connection -> ssh -> X11 -> Enable X11 forwarding) and then connect to your dom0. |
If you're using Windows you can install "xming" and "putty". Start Xming, and after that enable X11 forwarding in putty settings (Connection -> ssh -> X11 -> Enable X11 forwarding) and then connect to your dom0. |
||
== I'd like to run Xen hypervisor/dom0 on Redhat Enterprise Linux 6 (RHEL6) == |
|||
See this wiki page for a Xen 4.0 with RHEL6 tutorial and more info: [[RHEL6Xen4Tutorial]] or check out the newer [[Xen4CentOS]] for CentOS 6.4+. |
|||
<!-- Leave this at the end --> |
|||
== Where do I find more Dom0 FAQs? == |
|||
See [[Xen FAQ Dom0]] |
|||
= Networking = |
|||
== Is there more information about Xen "blktap" disk backend? == |
|||
Yes, Xen actually has two blktap backends: |
|||
* blktap1: please see the [[blktap]] wiki page for more information. |
|||
* blktap2: please see the [[blktap2]] wiki page for more information. |
|||
blktap2 supports VHD images, and is considered much more robust than the old blktap1 qemu/qcow image file support. Xen 4.0 includes blktap2 support. Note that also the dom0 kernel needs to have the blktap2 driver. |
|||
== What emulated NIC types/models are available in Xen HVM fully virtualized guests? == |
== What emulated NIC types/models are available in Xen HVM fully virtualized guests? == |
||
Line 560: | Line 494: | ||
Older Xen versions might not have all the above NIC options available. |
Older Xen versions might not have all the above NIC options available. |
||
== Xen complains about "hotplug scripts not working" == |
|||
== Can I set up Xen HVM Linux guest to display the kernel boot messages on "xm console" ? == |
|||
Yes, you can. You need to add this line to the "/etc/xen/<hvmguest>" configuration file in dom0: |
|||
This problem is often related to udev. Do you have udev installed? Is your udev the correct/supported version? This error usually has more information in the end revealing the real reason.. for example: |
|||
<pre> |
<pre> |
||
Error: Device 0 (vif) could not be connected. Could not find bridge device br0. |
|||
serial='pty' |
|||
</pre> |
</pre> |
||
Which means exactly what it says.. the guest is configured to to use a bridge called "br0", but there's no such bridge in dom0. Run "brctl show" to verify what bridges you have. Create the missing bridge, or edit the VM cfgfile and make it use another (correct) bridge. |
|||
And then in the HVM guest grub.conf (inside the HVM VM) configure kernel logging to the (virtual) serial port like this: |
|||
<pre> |
<pre> |
||
Error: Device 0 (vif) could not be connected. Hotplug scripts not working. |
|||
#============================================================ |
|||
# display the grub kernel selector menu on the serial console |
|||
serial --unit=0 --speed=9600 |
|||
terminal --timeout=5 serial console |
|||
# kernel entries title openSUSE 11.1 - 2.6.27.29-0.1 |
|||
root (hd0,1) |
|||
kernel /boot/vmlinuz-2.6.27.29-0.1-default root=LABEL=ROOT resume=LABEL=SWAP splash=silent showopts console=tty1 console=ttyS0 |
|||
initrd /boot/initrd-2.6.27.29-0.1-default |
|||
#================================================ |
|||
</pre> |
</pre> |
||
This problem is often caused by not having "xen-netback" driver loaded in dom0 kernel. |
|||
So basicly you need to add "console=ttyS0" to the kernel line, and also configure grub to display the kernel selector on the (virtual) serial console using "serial" and "terminal" settings. |
|||
The hotplug scripts are located in /etc/xen/scripts by default, and are labeled with the prefix vif-*. Those scripts log to /var/log/xen/xen-hotplug.log, and more detailed information can be found there. |
|||
After these settings "xm console <hvmguest>" works just like it does for PV (paravirtual) guests and allows you to see grub and the Linux kernel boot messages of the HVM guest. You can also use other tools (minicom, screen, etc) in dom0 to access the VM console pty device directly. |
|||
Also remember to set up a getty in the guest for the serial console device, ttyS0, so that you can also login from the serial console! See above for tips about that. |
|||
== How can I boot Xen HVM guest from a virtual emulated floppy, using an image file as the floppy? == |
|||
This is the required configuration in "/etc/xen/<hvmguest>" cfgfile: |
|||
<pre> |
<pre> |
||
Error: Device 5632 (vbd) could not be connected. Path closed or removed during hotplug add: backend/vbd/2/5632 state: 1" |
|||
fda = '/path/to/floppy.img' boot=a |
|||
</pre> |
</pre> |
||
You can also use this cmdline method while creating the guest: |
|||
This problem can be caused by not having "xen-blkback" driver loaded in dom0 kernel. |
|||
So when dealing with these problems always check you have all the required xen backend driver modules loaded in dom0 kernel! netbk or xen-netback for networking, and blkbk or xen-blkback for block devices (virtual disks). |
|||
<pre> |
|||
xm create /etc/xen/hvmguest.cfg fda=/path/to/floppy.img boot=a |
|||
</pre> |
|||
Also read /var/log/xen/xl*.log, it most probably includes additional information about the problem and the error messages. |
|||
Important note: Make sure SElinux access restrictions are not blocking access to /path/to/floppy.img! |
|||
== How do I change virtual/emulated CD .iso image for a Xen HVM guest? == |
|||
First check "/etc/xen/<guest>" cfgfile and check what is your cdrom device in the guest. It's usually "/dev/hdc". |
|||
== How to specify custom (non-default) vif-script for some domU network interface? == |
|||
An example to swap the emulated CD using an iso image: |
|||
Here's an example how to have 2 nics (vifs) for the domU, each using different vif-script: |
|||
<pre> |
<pre> |
||
vif = [ 'mac=00:16:5e:72:04:01,bridge=xenbr0,script=your_custom_script1', 'mac=00:16:5e:72:04:02,bridge=xenbr1,script=your_custom_script2' ] |
|||
xm block-configure <guest> file:/path/to/new/cd.iso hdc:cdrom r |
|||
</pre> |
</pre> |
||
== What's the difference between vifX.Y and tapX.Y network interfaces in dom0? == |
|||
== Are there FreeBSD Xen PV kernels/images available? == |
|||
Please check the following links: http://wiki.freebsd.org/AdrianChadd/XenImages and http://wiki.freebsd.org/AdrianChadd/XenHackery . |
|||
vifX.Y network interfaces are used with domUs (VMs) using paravirtualized network drivers, which means for pure PV domUs or for Xen HVM guests with paravirtualized PVHVM drivers in use. tapX.Y interfaces are used for HVM guests which are using emulated virtual NICs (Intel E1000, Realtek RTL8139, NE2k). |
|||
FreeBSD Xen wiki: http://wiki.freebsd.org/FreeBSD/Xen . |
|||
vifX.Y interfaces are created by the xen-netback backend driver in dom0 kernel. The frontend driver xen-netfront runs in the kernel of each VM. |
|||
Tutorial how to install 32bit Xen PV FreeBSD domU on a Debian Lenny Xen dom0, using LVM volumes: http://silverwraith.com/blog/?p=83 . |
|||
Another Freebsd Xen PV domU tutorial: http://forums.freebsd.org/showthread.php?t=10268 . |
|||
There's exactly one vif/tap interface per virtual NIC in the VM. "X" means the domain ID, and "Y" is the number of the virtual NIC. So if you have a domU with ID 5 with 3 virtual NICs (eth0, eth1, eth2), the corresponding VIF interfaces in dom0 would be vif5.0, vif5.1, vif5.2. |
|||
== Where can I find information about NetBSD Xen support? == |
|||
NetBSD supports both Xen dom0 and PV domUs. For more information see: http://www.netbsd.org/ports/xen/ |
|||
== Using SR-IOV Virtual Function (VF) PCI passthru with Xen == |
|||
== What's Xen pygrub? == |
|||
Pygrub allows you to simply specify in Xen PV guest "/etc/xen/<guest>" cfgfile: |
|||
Check [[RHEL5_CentOS5_Xen_Intel_SR-IOV_NIC_Virtual_Function_VF_PCI_Passthru_Tutorial]] for tutorial how to use and configure Xen SR-IOV VF PCI passthru on RHEL5 / CentOS5 Xen with Intel 10 Gbit/sec 82599 (ixgbe) SR-IOV NIC. The same general idea applies to upstream Xen and other distros, but the steps required are probably slightly different. |
|||
<pre> |
|||
bootloader = "/usr/bin/pygrub" |
|||
</pre> |
|||
Which replaces all these options: |
|||
<!-- Leave this at the end --> |
|||
== Where do I find more Networking FAQs? == |
|||
See [[Xen FAQ Networking]] |
|||
= Console = |
|||
<pre> |
|||
kernel = "vmlinuz-2.6.32.12" |
|||
ramdisk = "initrd-2.6.32.12.img" |
|||
root = "/dev/xvda1" |
|||
extra = "earlyprintk=xen console=hvc0" |
|||
</pre> |
|||
== I can't connect to the console of my guest using "'''xl console <guest>'''" == |
|||
When you start a Xen PV guest pygrub will be executed in dom0 and it'll access the guest disk configured in the "/etc/xen/<guest>" cfgfile, find "/boot/grub/grub.conf" (or menu.lst) from the guest filesystem, parse it, fetch the kernel, initrd image and kernel parameters configured in the guest to dom0, and then boot up the guest using those kernel + initrd + parameters. All the domU specific settings are configured inside the domU, in grub.conf. |
|||
Do you have "xenconsoled" process running in dom0? If you do, did you try killing it and restarting it? Also, only one console session per domU can exist at a time. Currently, attempting to use more than one console session per domU will not raise an error, but will result in strange behavior. |
|||
== Console of my PV guest shows kernel boot messages and then it stops and doesn't work anymore == |
|||
Requirements for using pygrub for Xen PV domUs: |
|||
Do you have a getty configured for the console device in the guest? You usually need to add an entry to /etc/inittab in the guest to make the guest present login prompt on the "'''xl console'''" session. Is the getty configured for a correct console device? See the chapter below for correct guest console devices. |
|||
Example "/etc/inittab" entry for Debian Lenny (linux-image-2.6.26-2-xen) guest, write this on a new (last) line: |
|||
* Pygrub binary available in dom0, installed together with Xen. |
|||
* Pygrub configured for the guest in "/etc/xen/<guest>" cfgfile |
|||
* Guest has /boot/grub/grub.conf (or menu.lst) with proper entries in it. There's actually no need to install the real grub to the MBR of the guest disk, it's enough to just have the grub.conf/menu.lst in the guest. |
|||
* If the guest has GRUB2 configuration file (for example Ubuntu 10.04 or Debian Squeeze 6.0) then you need to have new enough Xen pygrub in dom0. Pygrub versions included in Xen 4.0.2 and 4.1.1 and newer properly support parsing GRUB2 guest config files. |
|||
So pygrub makes it much easier to: |
|||
* Manage the guest kernels inside every guest, keeping the guest distribution package managers (dpkg,rpm) and package dependencies happy. |
|||
* Upgrade guest kernels without touching dom0 or guest configuration files in "/etc/xen/" in dom0. |
|||
* Each guest distribution can easily use the default kernel provided by the distribution. |
|||
* Pygrub allows you to select which kernel to boot, in the "xm console <guest>" session. It's easiest to start the guest with "xm create -f /etc/xen/guest -c" to attach to the console immediate for selecting the kernel from pygrub menu. If nothing is chosen then the default entry will be booted automatically. |
|||
Management tools like "virt-install" and "virt-manager" will use Xen pygrub as a default when you install new guests using them. |
|||
<pre> |
|||
== What's Xen pvgrub? == |
|||
vc:2345:respawn:/sbin/getty 38400 hvc0 |
|||
Xen pvgrub is like pygrub but more secure. |
|||
</pre> |
|||
Example "/etc/inittab" entry for CentOS 5 (kernel-xen-2.6.18) guest: |
|||
Pygrub is executed in dom0, so it could have security concerns/issues, if bugs were found from it. Pvgrub is executed in the Xen PV guest, so there are no such security issues with it. |
|||
Pvgrub is included in Xen 3.3 and newer versions. Pvgrub is a separate build and separate tool, so usually it's easier to begin with pygrub, and then later switch to pvgrub. |
|||
<pre> |
|||
See [[PvGrub]] wiki page for more information and usage of pvgrub. |
|||
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav |
|||
</pre> |
|||
After modifying /etc/inittab in the guest, run "kill -1 1" to make init (process id 1) reload the configuration file on-the-fly, or reboot the guest. This should make the console work and login prompt appear on the "'''xl console'''" session. |
|||
== Does Xen pygrub support booting PV guests using GRUB2 config files? == |
|||
Yes, pygrub in Xen 4.0.1 supports guests using GRUB2 config files (Ubuntu 10.04 LTS "Lucid Lynx"). Later the format of GRUB2 config files was changed, and Xen 4.0.2 and 4.1.1 (or newer versions) properly support this newest version of GRUB2 config files (Debian 6.0 "Squeeze"). GRUB2 syntax used by Fedora 16 is supported in pygrub in Xen 4.1.3 and Xen 4.2.0 (and later Xen versions). |
|||
Also there's a patch for RHEL/CentOS 5.5 version of pygrub to support GRUB2 (Ubuntu 10.04) guests: https://bugzilla.redhat.com/show_bug.cgi?id=577511 and latest version of GRUB2 config files (Debian 6.0 "Squeeze"): https://bugzilla.redhat.com/show_bug.cgi?id=675733 . These RHEL5 Xen pygrub patches are included in RHEL5.6 (first patch, Ubuntu 10.04) and RHEL5.7 (second patch, Debian 6.0). RHEL5 Xen pygrub support for F16 GRUB2 syntax is added with these patches in RHEL 5.8: https://bugzilla.redhat.com/show_bug.cgi?id=746602 . |
|||
== Can I browse the Xen source trees online? == |
|||
Yes, you can browse the source tree and see the changelogs/summaries and track changes online from the [[XenRepositories]] wiki page. |
|||
== Can I browse the Xen Qemu-dm (HVM guest ioemu) source repositories online? == |
|||
Yes, you can see the changelogs/summaries and track changes online from the [[XenRepositories]] wiki page. |
|||
== I'm using Xen 4.0.0 with the latest pvops 2.6.32.x dom0 kernel (2.6.32.15+) and xend/xenstored doesn't start anymore? == |
|||
Yes, this is a known issue. pvops dom0 kernel in xen/stable-2.6.32.x branch changed to using proper evtchn and gntdev device node names ("/proc/xen/*") in June 2010, which triggers a bug in libxc in Xen 4.0.0. This bug has been fixed in Xen 4.0.1-rc2 and newer versions. So please upgrade your Xen to 4.0.1-rc2 or newer version. |
|||
Alternatively you can apply this patch if you want to keep using Xen 4.0.0: http://xenbits.xen.org/xen-4.0-testing.hg?rev/0e1521f654f2 . |
|||
Another option is to manually fix the device node major/minor numbers by re-creating the device nodes manually and then re-starting xenstored and xend. You can see the proper major/minor for "/dev/xen/evtchn" and "/dev/xen/gntdev" from "/proc/misc": |
|||
'''NOTE!''' Some distros (like newer Ubuntu) don't use "/etc/inittab" anymore, but instead you have to configure the gettys in other places! Ubuntu 9.10 and newer use "/etc/init/*.conf". |
|||
<pre> |
<pre> |
||
# hvc0 - getty |
|||
# cat /proc/misc | grep xen |
|||
# |
|||
57 xen/gntdev |
|||
# This service maintains a getty on hvc0 from the point the system is |
|||
58 xen/evtchn |
|||
# started until it is shut down again. |
|||
start on stopped rc RUNLEVEL=[2345] |
|||
# ls -la /dev/xen |
|||
stop on runlevel [!2345] |
|||
total 0 |
|||
respawn exec /sbin/getty -L hvc0 9600 linux |
|||
drwxr-xr-x 2 root root 80 Jun 19 19:17 . |
|||
drwxr-xr-x 20 root root 4580 Jun 19 19:33 .. |
|||
crw-rw---- 1 root root 10, 58 Jun 19 19:17 evtchn |
|||
crw-rw---- 1 root root 10, 57 Jun 19 19:17 gntdev |
|||
</pre> |
</pre> |
||
== Console of my PV guest is totally empty, it doesn't show anything, not even kernel boot messages! == |
|||
Check the proper major/minor values from "/proc/misc" and then use mknod to create the device nodes manually using the proper values. After that xenstored and xend should start normally. For more information see this email: http://lists.xensource.com/archives/html/xen-devel/2010-06/msg01129.html and [[XenParavirtOps]] wiki page. |
|||
This usually means your PV (paravirtual) guest is using a newer pv_ops (upstream Linux kernel.org) kernel that has different console device name. You need to add "console=hvc0" to the guest kernel command line options. |
|||
If you're using Xen pygrub or pv-grub to load the kernel from guests filesystem, then you need to configure the guest kernel settings in the guest /boot/grub/grub.conf (or menu.lst), not in dom0! So edit the guest /boot/grub/grub.conf (or menu.lst) and add the "console=hvc0" option there for the default kernel. |
|||
== Arp change notification problems after live migration when using pvops 2.6.32.x dom0 kernel == |
|||
You need to have new enough version of pvops dom0 kernel (xen/stable-2.6.32.x branch, Aug 2010 or newer) and then you can enable "net.ipv4.conf.<dev>.arp_notify" sysctl setting for the devices where you want to send the arp notifications (gratuitous ARP). See this email for more information: http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01595.html . |
|||
If you're not using pygrub or pv-grub, aka you're configuring everything in /etc/xen/<guest> configuration file in dom0, and you have the kernel/initrd in dom0 filesystem, then you can specify the additional "console=hvc0" parameter in the /etc/xen/<guest> configuration file in dom0, on the extra="" line. |
|||
== Starting xend fails? == |
|||
"ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)". |
|||
== What's the correct console device name for my Xen PV guest == |
|||
or "xm" commands give the following error message: |
|||
* Most kernels use "hvc0" as the console device |
|||
"Error: Unable to connect to xend: No such file or directory. Is xend running?". |
|||
== How do I exit domU "'''xl console'''" session == |
|||
Please check these things: |
|||
Press ctrl+] or if you're using Putty press ctrl+5. |
|||
== Everything seems OK but I still can't access the domU "'''xl console'''"! == |
|||
* First of all - are you actually running Xen? Did you modify grub.conf to boot Xen hypervisor (xen.gz)? You can verify with "dmesg | grep -i xen" or "grep -i xen /var/log/dmesg" - you should see at least a line like "Booting paravirtualized kernel on Xen" when you've actually booted into Xen dom0. |
|||
A couple of things to check: |
|||
* Do you have xenfs mounted? Check "/proc/xen" directory, you absolutely NEED to have files there. |
|||
Value of "control_d" in file "/proc/xen/capabilities" means you're in Xen dom0: |
|||
* Do you have some old already running "'''xl console'''" session running on the host? possibly stuck in some dead ssh connection? |
|||
<pre> |
|||
* Do you have virt-manager running on the host 'reserving' the guest console? |
|||
# ls /proc/xen/ |
|||
* Did it work earlier? |
|||
capabilities privcmd xenbus xsd_kva xsd_port |
|||
* Do you have problems with only one guest, or with all guests? |
|||
* Does shutting down and then re-starting the guest help? |
|||
* Are you really sure you are running a getty in the guest for the correct console device? :) |
|||
* Is the guest really up and running? Can you access it over the network with ssh? Can you ping it? |
|||
== Can I set up Xen HVM Linux guest to display the kernel boot messages on "'''xl console'''" ? == |
|||
# cat /proc/xen/capabilities |
|||
Yes, you can. You need to add this line to the "/etc/xen/<hvmguest>" configuration file in dom0: |
|||
control_d |
|||
</pre> |
|||
Maybe you need a line like this in "/etc/fstab": |
|||
<pre> |
<pre> |
||
serial='pty' |
|||
none /proc/xen xenfs defaults 0 0 |
|||
</pre> |
</pre> |
||
After adding that line to "/etc/fstab" reboot or run "mount /proc/xen". |
|||
* Do you have "xen-evtchn" driver loaded? Check with "lsmod | grep -i xen" and load with "modprobe xen-evtchn". |
|||
* Do you have "xen-gntdev" driver loaded? Check with "lsmod | grep -i xen" and load with "modprobe xen-gntdev" |
|||
* Do you have the required device nodes under "/dev/xen/" directory? An example: |
|||
And then in the HVM guest grub.conf (inside the HVM VM) configure kernel logging to the (virtual) serial port like this: |
|||
<pre> |
|||
# ls -la /dev/xen |
|||
total 0 |
|||
drwxr-xr-x 2 root root 80 Jun 19 19:17 . |
|||
drwxr-xr-x 20 root root 4580 Jun 19 19:33 .. |
|||
crw-rw---- 1 root root 10, 58 Jun 19 19:17 evtchn |
|||
crw-rw---- 1 root root 10, 57 Jun 19 19:17 gntdev |
|||
</pre> |
|||
* Correct major/minor numbers for those device nodes can be checked from file "/proc/misc", the values are dynamic and might change from system to system: |
|||
<pre> |
<pre> |
||
#============================================================ |
|||
# cat /proc/misc | grep xen |
|||
# display the grub kernel selector menu on the serial console |
|||
57 xen/gntdev |
|||
serial --unit=0 --speed=9600 |
|||
58 xen/evtchn |
|||
terminal --timeout=5 serial console |
|||
# kernel entries title openSUSE 11.1 - 2.6.27.29-0.1 |
|||
root (hd0,1) |
|||
kernel /boot/vmlinuz-2.6.27.29-0.1-default root=LABEL=ROOT resume=LABEL=SWAP splash=silent showopts console=tty1 console=ttyS0 |
|||
initrd /boot/initrd-2.6.27.29-0.1-default |
|||
#================================================ |
|||
</pre> |
</pre> |
||
* Do you have SElinux running? Did you try turning it off? Run "setenforce 0" or disable it in "/etc/selinux/config" and reboot dom0. |
|||
* Do you have xenstored or oxenstored running? xend required xen store daemon to be running before starting xend. |
|||
* If you're using certain Debian or Ubuntu (10.04+) versions, and you're compiling Xen from source (.tar.gz), you might need to run "make install-tools PYTHON_PREFIX_ARG=" to install Xen.. notice the empty argument to PYTHON_PREFIX_ARG to get the Xen python modules installed to correct directory location. |
|||
* If you upgraded from older Xen version, did you first make sure all the files from earlier Xen versions were completely removed before installing the new version? Xend might fail to start when there's a bad installation mixing files from multiple Xen versions. |
|||
So basicly you need to add "console=ttyS0" to the kernel line, and also configure grub to display the kernel selector on the (virtual) serial console using "serial" and "terminal" settings. |
|||
For other troubleshooting tips related to pvops dom0 kernels try reading [[XenParavirtOps]] wiki page. |
|||
After these settings "'''xl console <hvmguest>'''" works just like it does for PV (paravirtual) guests and allows you to see grub and the Linux kernel boot messages of the HVM guest. You can also use other tools (minicom, screen, etc) in dom0 to access the VM console pty device directly. |
|||
== How to specify custom (non-default) vif-script for some domU network interface? == |
|||
Here's an example how to have 2 nics (vifs) for the domU, each using different vif-script: |
|||
Also remember to set up a getty in the guest for the serial console device, ttyS0, so that you can also login from the serial console! See above for tips about that. |
|||
<!-- This should stay the last entry --> |
|||
<pre> |
|||
== Where do I find more Console FAQs? == |
|||
vif = [ 'mac=00:16:5e:72:04:01,bridge=xenbr0,script=your_custom_script1', 'mac=00:16:5e:72:04:02,bridge=xenbr1,script=your_custom_script2' ] |
|||
See [[Xen FAQ Console]] |
|||
</pre> |
|||
= Other Problems / Questions = |
|||
== Starting xend fails? == |
|||
Xend has been deprecated as of Xen 4.2.0. You should therefore not use the command '''xm''' anymore. Instead, you should use the new '''xl''' command, which should be binary compatible. |
|||
== Problems with Xen on Redhat Enterprise Linux 5 (RHEL5) or CentOS5 == |
== Problems with Xen on Redhat Enterprise Linux 5 (RHEL5) or CentOS5 == |
||
Line 779: | Line 661: | ||
* http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html-single/Virtualization/index.html#part-Virtualization-Troubleshooting |
* http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html-single/Virtualization/index.html#part-Virtualization-Troubleshooting |
||
== I |
== Can I Use the Xen Project Hypervisor in CentOS 6? == |
||
Yes, using [[Xen4CentOS]]. |
|||
== Can I back up Xen domains == |
|||
See this wiki page for a Xen 4.0 with RHEL6 tutorial and more info: [[RHEL6Xen4Tutorial]] . |
|||
Yes, see [http://serverfault.com/questions/368578/backing-up-xen-domains Backing up Xen domains @ serverfault] |
|||
= USB, PCI and VGA passthrough = |
|||
== Starting Xen HVM guests fails when using Xen 4.x and gcc 4.6 == |
|||
== Can I use 3D graphics in Xen? == |
|||
When Xen 4.x is compiled with gcc 4.6 compiler it seems Xen hvmloader binary gets miscompiled and makes it impossible to run HVM VMs. This issue does not happen when using gcc 4.5 or older gcc versions. The error message might be something like this: |
|||
Yes, please see the [[XenVGAPassthrough]] wiki page for more information how to give a VM direct/full access (including video and 3d acceleration) to a graphics (VGA) card. |
|||
== Can I passthrough an USB device connected to dom0 to a Xen guest? == |
|||
Yes, please see the [[XenUSBPassthrough]] wiki page. |
|||
== Can I passthrough a PCI device to Xen guest? == |
|||
<pre> |
|||
Yes, please see the [[XenPCIpassthrough]] wiki page. |
|||
(XEN) io.c:194:d18358 MMIO emulation failed @ 0018:9ffff: 00 e0 de be 00 83 |
|||
(XEN) hvm.c:1099:d18358 Triple fault on VCPU0 - invoking HVM system reset. |
|||
</pre> |
|||
== Can I passthru a VGA graphics adapter to Xen guest? == |
|||
Yes, please see the [[XenVGAPassthrough]] wiki page. |
|||
== I have problems using my graphics card in Xen dom0, with the pvops dom0 kernel.. any tips? == |
|||
or then just a line with words "HVM Loader" and nothing more, followed by a VM crash a couple of seconds after it started. |
|||
Yes, please see the [[XenPVOPSDRM]] wiki page. |
|||
This bug is fixed in xen.org repositories, but the fix is not yet in Xen 4.0.2 or 4.1.1, because the bug was found and fixed after the release of Xen 4.0.2 and Xen 4.1.1. See this email for info about the bugfix changesets: http://lists.xensource.com/archives/html/xen-devel/2011-07/msg00922.html . Especially users of Debian Wheezy, Ubuntu 11.10+ and Fedora 15/16 have seen this issue. |
|||
== Is there more information about Xen PVSCSI passthrough functionality? == |
|||
== xm: [[ImportError]]: No module named xen.xm == |
|||
Yes, please see the [[XenPVSCSI]] wiki page. |
|||
After installing Xen from source (either mercurial/hg repository or from .tar.gz) you get an error when trying to start xend or run "xm" commands. |
|||
The error looks like: |
|||
<pre> |
|||
ImportError: No module named xen.xm |
|||
</pre> |
|||
This means Xen python modules are not installed to correct directory. Debian/Ubuntu changed the location of python modules include directory, so you need to use the following when installing Xen: |
|||
<pre> |
|||
make install-tools PYTHON_PREFIX_ARG= |
|||
</pre> |
|||
Notice the empty parameter to PYTHON_PREFIX_ARG. Re-install the modules/tools and the problem should get fixed. |
|||
== With Linux 3.0 as a dom0 kernel using dom0_mem=<xyz> option for Xen in grub.conf doesn't work == |
|||
This is a known bug in Linux 3.0 kernel. It is fixed in Linux 3.1 and Linux 3.0.5 stable update. If using 3.0 older than 3.0.5 the workaround is to use, in addition to "dom0_mem=2048M" for Xen hypervisor (xen.gz), also "mem=2048M" option for dom0 Linux kernel (vmlinuz) in grub.conf. |
|||
Also see [[Linux_30_bugs:]] wiki page for other known issues in upstream Linux 3.0 kernel. |
|||
== How do I change the resolution of Xen PV domU vfb graphical VNC console? == |
== How do I change the resolution of Xen PV domU vfb graphical VNC console? == |
||
Line 856: | Line 720: | ||
After increasing the size of vram configure the resolution from inside the HVM guest in the usual way, just like you'd do on baremetal/native, using the resolution selector or configfile provided by the operating system in the VM. |
After increasing the size of vram configure the resolution from inside the HVM guest in the usual way, just like you'd do on baremetal/native, using the resolution selector or configfile provided by the operating system in the VM. |
||
<!-- This should stay the last entry --> |
|||
== I'm trying to create a new Xen VM but I get error there's not enough free memory == |
|||
== Where do I find more VGA Passthrough FAQs? == |
|||
See [[Xen VGA Passthrough]] |
|||
= HA and Fault Tolerance = |
|||
Tools like "free" or "top" in Xen dom0 show that you have a lot of free memory, but Xen still complains that there's not enough free memory to create/start a new VM, giving errors such as "Out of memory". This usually happens because dom0 is using all the memory, so there's no free memory in the Xen hypervisor (xen.gz) for other VMs. Note that dom0 is actually a Xen virtual machine! |
|||
== Is there more information about Xen Fault Tolerance, aka Remus Transparent High Availability (HA) for VMs? == |
|||
Xen hypervisor dedicates physical memory for each VM, so you need to have actual free unallocated memory in the hypervisor to start a VM. You can check the Xen hypervisor memory usage with the following commands: |
|||
Yes, please see the [[Remus]] wiki page for more information. |
|||
== Arp change notification problems after live migration when using pvops 2.6.32.x dom0 kernel == |
|||
Check the amount of total, used and free memory in Xen hypervisor: |
|||
You need to have new enough version of pvops dom0 kernel (xen/stable-2.6.32.x branch, Aug 2010 or newer) and then you can enable "net.ipv4.conf.<dev>.arp_notify" sysctl setting for the devices where you want to send the arp notifications (gratuitous ARP). See this email for more information: http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01595.html . |
|||
<pre> |
|||
xm info |
|||
</pre> |
|||
<!-- This should stay the last entry --> |
|||
== Where do I find more High Availability FAQs? == |
|||
and check how much memory each VM is using: |
|||
See [[Xen FAQ High Availability]] |
|||
<pre> |
|||
xm list |
|||
</pre> |
|||
It's possible that dom0 is using most of your memory and Xen hypervisor doesn't have any free memory left. You should use "dom0_mem=" setting for Xen in grub to configure dom0 a fixed/dedicated amount of memory, so the rest of the memory is free for other VMs to use. See [[XenBestPractices:]] wiki page for more info about configuring "dom0_mem=" option for Xen. |
|||
== Error: (4, 'Out of memory', 'panic: xc_dom_core.c:442: xc_dom_alloc_segment: segment ramdisk too large (0xee93 > 0x8000 - 0x1755 pages)') == |
|||
Getting this error when trying to start a new VM (running "xm create") means you're trying to use too big ramdisk image (initrd/initramfs file) for the domU. The ramdisk image configured is bigger than the amount of available memory for the VM. Remember the ramdisk images are compressed, and they need to fit as uncompressed to the domU memory. The solution is to edit "/etc/xen/<domU>" configuration file and increase the amount of memory for the VM, or switch to using a smaller ramdisk image for the domU kernel. |
|||
== What's the difference between vifX.Y and tapX.Y network interfaces in dom0? == |
|||
vifX.Y network interfaces are used with domUs (VMs) using paravirtualized network drivers, which means for pure PV domUs or for Xen HVM guests with paravirtualized PVHVM drivers in use. tapX.Y interfaces are used for HVM guests which are using emulated virtual NICs (Intel E1000, Realtek RTL8139, NE2k). |
|||
vifX.Y interfaces are created by the xen-netback backend driver in dom0 kernel. The frontend driver xen-netfront runs in the kernel of each VM. |
|||
There's exactly one vif/tap interface per virtual NIC in the VM. "X" means the domain ID, and "Y" is the number of the virtual NIC. So if you have a domU with ID 5 with 3 virtual NICs (eth0, eth1, eth2), the corresponding VIF interfaces in dom0 would be vif5.0, vif5.1, vif5.2. |
|||
== How can I use Xen PVHVM optimized paravirtualized drivers with Ubuntu 11.10 or Fedora 16 HVM guests? == |
|||
Please see the [[Xen_Linux_PV_on_HVM_drivers]] wiki page for more information about Xen PVHVM drivers. |
|||
[[Category:Xen]] |
[[Category:Xen]] |
Latest revision as of 03:05, 26 March 2015
This page contains answers to some common problems and questions about Xen. This list contains the most frequently asked questions. You may also want to check out the articles in Category:FAQ. Each section in this document links to further questions in other FAQ documents. |
General
I'd like to contribute to the Xen Project wiki pages, I have something to add/edit/fix, how can I do it?
Contributions are very welcome! You should create yourself a wiki account, then fill out this form to get editing rights (we used to allow anyone to edit, but spammers have ruined that). More info on getting started at
- Create an account or log in
- Play with the Sandbox
- MediaWiki Cheat Sheet
- MediaWiki Help Contents
- MediaWiki Formatting
- Books about MediaWiki
- Wiki Community Portal
- Wiki Management Tools
- Multi-language Conventions
I'm interesting in being a Xen Project developer! Are there projects to work on?
Yes! Please check the Xen Development Projects wiki page for more information!
How does Xen Project compare to KVM? Which one is better?
Please see this blog post for more information: http://blog.xenproject.org/index.php/2010/05/07/xen-%E2%80%93-kvm-linux-%E2%80%93-and-the-community/
Also check these documents:
- http://www.slideshare.net/xen_com_mgr/why-xen-slides
- http://blog.xenproject.org/index.php/2010/07/30/why-xen-paper-published/
Is there a "Best Practices" document available?
See the Xen Project Best Practices wiki page.
Is there a list of various 3rd party management tools and (web) interfaces for Xen Project software?
Yes, please see the Xen Project Ecosystem Directory for tools and solutions using Xen Project.
Yes, please see the Research Papers Directory
What's the difference between Xen Project Hypervisor (from XenProject.org) and Citrix XenServer (or XCP)?
The Xen Project Hypervisor from XenProject.org is the core hypervisor used in many different products. It includes basic command line management tools. It is distributed as a tarball and from mercurial source code repositories. You need to compile and install Xen hypervisor from sources, and combine it with a kernel of your choice. It can be thought as the "core engine" you can use to build your own virtualization platform.
Many Linux distributions package Xen and distribute it as prebuilt binaries, combined with Xen capable kernels of their choice. There are many additional thirdparty management tools available to manage the Xen hypervisor.
There are multiple companies shipping products based on the Xen hypervisor, including Citrix, Oracle, SUSE, Ubuntu, and others.
Citrix XenServer is a commercial product that includes the core Xen Project Hypervisor from XenProject.org, combined with CentOS-based dom0 distro, management toolstack, and everything else required to build a ready made virtualization platform. XenServer was Open Sourced in 2014. Citrix XenServer is a dedicated virtualization platform (not a general purpose Linux distro), and it is shipped as a ready to install ISO-image that contains everything you need out-of-the-box. Citrix XenServer includes the XAPI management toolstack, allowing you to pool multiple Xen hosts together and manage them centrally using either the graphical Citrix XenCenter management tool, the 'xe' commandline tool or using the XenAPI directly from your scripts. Citrix XenCenter graphical management tool is only available for Windows.
Can I browse the Xen Project source trees online?
Yes, you can browse the source tree and see the changelogs/summaries and track changes online from the Xen Project Repositories wiki page.
Can I browse the Xen Project Qemu-dm (HVM guest ioemu) source repositories online?
Yes, you can see the changelogs/summaries and track changes online from the Xen Project Repositories wiki page.
Where do I find more General FAQs?
See Xen FAQ General
Compatibility
Where can I find a list of available Xen Project Domain 0 kernels?
See the Dom0 Kernels for Xen wiki page.
Where can I find a list of available features in different Xen Project enabled kernels?
See the Xen Kernel Feature Matrix wiki page.
Where can I find information about Xen Project on RISC CPUs?
- Please see Xen ARM (PV) wiki page for Xen Project on ARM CPUs. The Xen ARM project is no longer actively developed. It has been superseded by the Xen ARM with Virtualization Extensions effort.
- Please see Xen ARM with Virtualization Extensions wiki page for Xen Project on ARMv7 CPUs with Virtualization Extensions. This project is actively developed.
- Xen Project has also been ported to MIPS64 platform. See the Netlogic Microsystems press release for more information: http://vmblog.com/archive/2012/01/30/netlogic-microsystems-announces-the-industry-s-first-open-source-xen-hypervisor-for-multi-core-mips64-processors.aspx or the xen-devel mailinglist post: http://lists.xenproject.org/archives/html/xen-devel/2012-01/msg00301.html .
- Please see XenPPC wiki page for Xen on PowerPC CPUs. XenPPC project is not active anymore.
How can I check the version of Xen Project hypervisor?
Run "xl info" in domain 0 (on older versions, you might need to use "xm info"). You can find the hypervisor version in "xen_major", "xen_minor" and "xen_extra" fields. The version is major.minor.extra.
Determining the version from within a domU is dependent on the guest operating system. For Linux guests:
$ dmesg | grep Xen\ version Xen version: 4.2.0 (preserve-AD)
- Xen supports running PV (paravirtualized) VMs on any PAE-capable x86 or x86_64 CPU (both Intel and AMD CPUs). CPU Virtualization extensions are NOT required or used to run Xen PV domUs.
- Xen requires CPU Virtualization Extensions to run Xen HVM (Fully Virtualized) VMs. Also the system BIOS needs to support and enable the CPU Virtualization extensions.
- CPU Virtualization extensions are called Intel VT-x or AMD-V and they are required for running Xen HVM guests.
- HAP (Hardware Assisted Paging) can be optionally used to boost the performance of Xen memory management for HVM VMs. HAP is an additional feature of the CPU, and it's not present on older CPUs. Intel HAP is called Intel EPT (Extended Page Tables) and AMD HAP is called AMD NPT (Nested Page Tables). AMD NPT is sometimes also referred as AMD RVI (Rapid Virtualization Indexing).
- IOMMU (IO Memory Management Unit) support from CPU/BIOS/chipset is needed for Xen IO Virtualization. IOMMU makes it possible to dedicate PCI device securely to a Xen VM by using Xen PCI passthru. Intel IOMMU is called Intel VT-d, and AMD IOMMU is called just AMD IOMMU.
- SR-IOV (Single Root IO Virtualization) can be used together with IOMMU PCI passthru and PCI Express SR-IOV capable devices. SR-IOV needs to be supported and enabled by the system chipset, BIOS and the PCI-e device itself. For example Intel 82599 10 Gigabit Ethernet NIC supports 64 Virtual Functions (VFs), which means the NIC can be configured to show up as 64 different PCI devices (PCI IDs), so you can use Xen PCI passthru to passthrough each VF to some Xen VM and give the VM direct access to the PCI-e device. SR-IOV provides excellent IO performance and very low overhead.
How can I check if I'm able to run Xen HVM (fully virtualized) guests?
Xen requires CPU virtualization support/extensions (Intel VT, AMD-V) for running HVM guests (=Windows). Virtualization support needs to be enabled in the system BIOS. Intel calls this feature also as "VT-x". Also note that Intel "VT-x" is different from "VT-d", which is a totally different feature (see the next section below).
NOTE that Linux dom0 kernel doesn't see 'vmx' or 'svm' CPU flags in "/proc/cpuinfo" because Xen *hypervisor* (xen.gz) is using the hardware virtualization features and hiding the flags from dom0! Xen dom0 is actually a virtual machine, so it doesn't see all the cpu flags as Xen hypervisor is hiding some flags from dom0.
You can run "xl info" in dom0 and check from the 'xen_caps' line if Xen is able to run hvm guests. Also Xen hypervisor boot messages in "xl dmesg" show if hardware virtualization (HVM) is enabled or disabled.
Example "xl dmesg | grep -i hvm" output for an Intel system where HVM is supported by the CPU:
(XEN) HVM: VMX enabled
Example "xl dmesg" output for an Intel system where HVM is supported by the CPU but it's disabled in the system BIOS:
(XEN) VMX disabled by Feature Control MSR.
Example "xl dmesg | grep -i hvm" output for an AMD system where HVM is supported:
(XEN) HVM: SVM enabled
You can also see the HVM support status from the "xen_caps" line on Xen hypervisor "xl info | grep xen_caps" output:
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
How can I check if my CPU supports HAP (Hardware Assisted Paging) ?
You can check Xen dmesg by running "xl dmesg" to verify if HAP is supported on your CPU:
(XEN) HVM: Hardware Assisted Paging detected and enabled.
Newer Xen versions (4.1.3+, 4.2.x+) will have info like this:
(XEN) HVM: Hardware Assisted Paging (HAP) detected (XEN) HVM: HAP page sizes: 4kB, 2MB
HAP support is provided by the following features on CPUs:
- Intel EPT (Extended Page Tables).
- AMD NPT (Nested Page Tables, sometimes also called as AMD RVI - Rapid Virtualization Indexing).
How can I check if my hardware has an IOMMU (VT-d) and it's enabled and supported?
Hardware IOMMU (Intel VT-d) is required for hardware assisted PCI passthru (I/O virtualization) to Xen HVM (fully virtualized) guest VMs. You can check for IOMMU status from "xl dmesg" output.
Example "xl dmesg" output for a system where IOMMU is supported:
(XEN) I/O virtualisation enabled
Example "xl dmesg" output for a system where IOMMU is not supported:
(XEN) I/O virtualisation disabled
You might also see additional output like:
(XEN) Intel VT-d Snoop Control supported. (XEN) Intel VT-d DMA Passthrough not supported. (XEN) Intel VT-d Queued Invalidation supported. (XEN) Intel VT-d Interrupt Remapping not supported.
And if hardware IOMMU is used for PV guest PCI passthru or not:
(XEN) I/O virtualisation for PV guests enabled
Xen doesn't require hardware IOMMU for PCI passthru to PV guests, but having an IOMMU makes it more secure. PCI passthru to Xen HVM guests requires hardware IOMMU.
Remember there's usually a separate configuration option for IOMMU IO Virtualization (VT-d) in the BIOS, so you need to enable IOMMU from the system BIOS before booting to Xen.
For more information about using an IOMMU with Xen see Xen_PCI_Passthrough and VTd_HowTo wiki pages.
Are there FreeBSD Xen PV kernels/images available?
Please check the following link: http://wiki.freebsd.org/FreeBSD/Xen .
Where can I find information about NetBSD Xen support?
NetBSD supports both Xen dom0 and PV domUs. For more information see: http://www.netbsd.org/ports/xen/
Booting
Is there a list of all available Xen hypervisor (xen.gz) commandline boot options for grub.conf?
Yes, please see the XenHypervisorBootOptions wiki page.
What's Xen pygrub?
Pygrub allows you to simply specify in Xen PV guest "/etc/xen/<guest>" cfgfile:
bootloader = "/usr/bin/pygrub"
Which replaces all these options:
kernel = "vmlinuz-2.6.32.12" ramdisk = "initrd-2.6.32.12.img" root = "/dev/xvda1" extra = "earlyprintk=xen console=hvc0"
When you start a Xen PV guest pygrub will be executed in dom0 and it'll access the guest disk configured in the "/etc/xen/<guest>" cfgfile, find "/boot/grub/grub.conf" (or menu.lst) from the guest filesystem, parse it, fetch the kernel, initrd image and kernel parameters configured in the guest to dom0, and then boot up the guest using those kernel + initrd + parameters. All the domU specific settings are configured inside the domU, in grub.conf.
Requirements for using pygrub for Xen PV domUs:
- Pygrub binary available in dom0, installed together with Xen.
- Pygrub configured for the guest in "/etc/xen/<guest>" cfgfile
- Guest has /boot/grub/grub.conf (or menu.lst) with proper entries in it. There's actually no need to install the real grub to the MBR of the guest disk, it's enough to just have the grub.conf/menu.lst in the guest.
Pygrub makes it much easier to:
- Manage the guest kernels inside every guest, keeping the guest distribution package managers (dpkg,rpm) and package dependencies happy.
- Upgrade guest kernels without touching dom0 or guest configuration files in "/etc/xen/" in dom0.
- Each guest distribution can easily use the default kernel provided by the distribution.
- Pygrub allows you to select which kernel to boot, in the "xl console <guest>" session. It's easiest to start the guest with "xl create -c /etc/xen/guest" to attach to the console immediate for selecting the kernel from pygrub menu. If nothing is chosen then the default entry will be booted automatically.
Management tools like "virt-install" and "virt-manager" will use Xen pygrub as a default when you install new guests using them.
What's Xen pvgrub?
Xen pvgrub is like pygrub but more secure.
Pygrub is executed in dom0, so it could have security concerns/issues, if bugs were found from it. Pvgrub is executed in the Xen PV guest, so there are no such security issues with it.
Pvgrub is a separate build and separate tool, so usually it's easier to begin with pygrub, and then later switch to pvgrub.
See PvGrub wiki page for more information and usage of pvgrub.
Does Xen pygrub support booting PV guests using GRUB2 config files?
Yes, pygrub supports guests using GRUB2 config files.
How can I boot Xen HVM guest from a virtual emulated floppy, using an image file as the floppy?
This is the required configuration in "/etc/xen/<hvmguest>" cfgfile:
fda = '/path/to/floppy.img' boot=a
You can also use this cmdline method while creating the guest:
xl create /etc/xen/hvmguest.cfg fda=/path/to/floppy.img boot=a
Important note: Make sure SElinux access restrictions are not blocking access to /path/to/floppy.img!
I have problems getting Xen or dom0 kernel to boot, how can I set up a serial console to log and troubleshoot the boot process?
See the XenSerialConsole wiki page.
Where do I find more Booting FAQs?
See Xen FAQ Booting
Guest / DomU
Where can I find a list of all the available domU configuration options in /etc/xen/<guest> cfgfile?
See the XenConfigurationFileOptions wiki page.
Where can I find optimized Xen PV-on-HVM drivers for Linux HVM (fully virtualized) guests?
Please see the XenLinuxPVonHVMdrivers wiki page.
I can't start any HVM guests, I get error "libxl__domain_make domain creation fail: cannot make domain: -3". PV guests work fine.
This means you likely have an Intel CPU with Trusted Execution Technology. Enabling this feature in your BIOS can have a negative impact on the availability of VT-d, which is a prerequisite of running HVM guests. Please disable TXT in the BIOS and you will be able to boot your HVM guests.
I upgraded PV domU from old Xenlinux kernel to new pvops kernel, and now the domU doesn't work anymore!
Many people seem to upgrade their Xen guest PV kernels at the same time they upgrade to a newer Xen version. This is actually not a required step! You can still use your old domU kernels with the new Xen version, and with a new dom0 kernel version. Xen hypervisor is the compatibility layer, so dom0 and domUs can have totally different kernels.
Old Xenlinux PV kernels (linux-2.6.18-xen, ubuntu 2.6.24, debian 2.6.26, sles11 2.6.27, sles11 sp1 2.6.32, opensuse 2.6.31 etc) have different device names for virtual disks and virtual console than the new pvops (upstream kernel.org) Linux kernels. The old device names in Xenlinux kernels usually are:
- /dev/sdX for virtual disks, for example /dev/sda
- /dev/xvc0 for the virtual console
The new device names in pvops kernels are:
- /dev/xvdX for virtual disks, for example /dev/xvda. XVD = Xen Virtual Disk.
- /dev/hvc0 for the virtual console
So you need to do changes in the guest for it to boot up and work properly with the new kernel:
- Fix "/etc/xen/<guest>" configuration file and change the virtual disks from /dev/sdX to /dev/xvdX
- Fix domU kernel root filesystem parameter, ie. change root=/dev/sda1 to root=/dev/xvda1
- Fix domU kernel console parameter, ie. have "earlyprintk=xen console=hvc0" in the extra="" section.
- If you use pygrub to load the kernel/initrd from the guest filesystem then you need to make the changes above in the domU /boot/grub/grub.conf (or menu.lst).
- Make sure the domU kernel has xen-blkfront driver built-in, or if it's built as a module (most common option), then you need to have a proper initrd (ramdisk) image for the domU kernel that actually loads the xen-blkfront driver so that the guest kernel can access the root filesystem! Failing to do this will cause the domU kernel to crash on boot because it can't find the root filesystem!
- Note that you usually can't use the dom0 initrd image for a domU! dom0 initrd is generated for *dom0*, so it tries to load all the drivers for the *physical* hardware, while you have only virtual hardware in the domU! initrd ramdisk images are system specific, where dom0 and domU are different systems. Usually it's easiest to build an initrd/initramfs image for the domU in the *domU*. So boot the domU up with the old kernel, and generate an initrd image for the new pvops kernel. Make sure the new generated initrd-image loads xen-blkfront driver!
- You need set up (or modify) a getty for the new console device in the domU init/inittab settings, so you can get a login prompt on the "xl console" session.
- You need to add the console device name to "/etc/securetty" in the domU so root is allowed to login from the console.
- If you're having networking problems with the new pvops domU kernels make sure you have "xen-netfront" driver loaded in the new kernel. It's usually built as a module in the recent pvops/upstream/distro kernels.
Also see Migrate_from_Linux_2.6.18_to_2.6.31_and_higher wiki page for more information.
My Xen PV guest kernel crashes, how can I debug it and get a stack/call trace?
Edit "/etc/xen/<guest>" cfgfile, and set:
on_crash="preserve"
Then when your domU guest crashes, run this in dom0:
/usr/lib/xen/bin/xenctx -s System.map-domUkernelversion <domUid> <vcpu-number>
If you're running 64bit dom0, then xenctx might be under "/usr/lib64/". This command will give you a stack trace of the crashed domU kernel on the specified vcpu, allowing you to see where it crashes. You should get the stack trace for every vcpu your guest has! Vcpu numbers start from 0.
Note that you need to use the "System.map" file from the exact kernel version the domU is running, otherwise the stack trace results are not correct!
How do I change virtual/emulated CD .iso image for a Xen HVM guest?
First check "/etc/xen/<guest>" cfgfile and check what is your cdrom device in the guest. It's usually "/dev/hdc".
An example to swap the emulated CD using an iso image:
xl block-configure <guest> file:/path/to/new/cd.iso hdc:cdrom r
I'm trying to create a new Xen VM but I get error there's not enough free memory
Tools like "free" or "top" in Xen dom0 show that you have a lot of free memory, but Xen still complains that there's not enough free memory to create/start a new VM, giving errors such as "Out of memory". This usually happens because dom0 is using all the memory, so there's no free memory in the Xen hypervisor (xen.gz) for other VMs. Note that dom0 is actually a Xen virtual machine!
Xen hypervisor dedicates physical memory for each VM, so you need to have actual free unallocated memory in the hypervisor to start a VM. You can check the Xen hypervisor memory usage with the following commands:
Check the amount of total, used and free memory in Xen hypervisor:
xl info
and check how much memory each VM is using:
xl list
It's possible that dom0 is using most of your memory and Xen hypervisor doesn't have any free memory left. You should use "dom0_mem=" setting for Xen in grub to configure dom0 a fixed/dedicated amount of memory, so the rest of the memory is free for other VMs to use. See XenBestPractices wiki page for more info about configuring "dom0_mem=" option for Xen.
Error: (4, 'Out of memory', 'panic: xc_dom_core.c:442: xc_dom_alloc_segment: segment ramdisk too large (0xee93 > 0x8000 - 0x1755 pages)')
Getting this error when trying to start a new VM (running "xl create") means you're trying to use too big ramdisk image (initrd/initramfs file) for the domU. The ramdisk image configured is bigger than the amount of available memory for the VM. Remember the ramdisk images are compressed, and they need to fit as uncompressed to the domU memory. By modifying /etc/initramfs-tools/initramfs.conf, to set MODULES=dep, you can decrease the size of the generated initramfs.
How can I use Xen PVHVM optimized paravirtualized drivers with Ubuntu 11.10 or Fedora 16 HVM guests?
Please see the Xen_Linux_PV_on_HVM_drivers wiki page for more information about Xen PVHVM drivers.
I followed a third-party HOWTO for creating or converting a VM, but it doesn't start. There are errors around access of qemu-dm as the device model. Why?
Apparently, some older documentation and third-party instructions suggest using the following line in a VM config file:
device_model = 'qemu-dm'
However, the use of qemu-dm in this context is no longer correct (as of 4.4, at least). The term qemu-dm is a generic term meaning "the current qemu device model". It is not an actual configuration file option. If you need to select a device model, use the configuration syntax:
device_model_version = 'qemu-xen'
to use the default qemu, or alternatively, if you want to use the older version of qemu bundled with the hypervisor:
device_model_version = 'qemu-xen-traditional'
Where do I find more DomU FAQs?
See Xen FAQ DomU
Host / Dom0
How can I limit the number of vcpus my dom0 has?
The recommended way is to use "dom0_max_vcpus=X" boot time option for Xen hypervisor (xen.gz) in grub.conf. You need to reboot after modifying grub.conf. Using this method makes sure you allocate resources only for the actual number of vcpus you need in dom0.
Can I dedicate a cpu core (or cores) only for dom0?
Yes, you can. It might a good idea especially for systems running IO intensive guests. Dedicating a CPU core only for dom0 makes sure dom0 always has free CPU time to process the IO requests for the domUs. Also when dom0 has a dedicated core there are less CPU context switches to do, giving better performance.
Specify "dom0_max_vcpus=X dom0_vcpus_pin" options for Xen hypervisor (xen.gz) in grub.conf and reboot.
After rebooting you can verify with "xl vcpu-list" that dom0 vcpus are pinned to only use the matching physical cpus.
The next step is to configure all the guests (domUs) to NOT use those same physical cpus. This can be done by specifying for example cpus="2-7" to all /etc/xen/<guest> cfgfiles. This example would leave physical cpus/cores 0 and 1 only for dom0, and make the guests use cpus/cores 2 to 7.
In dom0 how can I access and mount partitions inside a Xen disk image?
The easiest way is to use "kpartx" in dom0. It allows you to easily access all the partitions inside an image file or inside LVM volume.
You can use "kpartx -l /path/guestdisk" to list the partitions the image has, and "kpartx -a /path/guestdisk" to add the partition mappings. After the device mapper (dm) mappings have been added, you can access the partitions using "/dev/mapper/guestdiskpX" block devices. There's a separate block device for each partition. You can mount, copy, format, or whatever you need to do and it works just like for "real" partitions.
When you're done using the partitions in dom0, and you have unmounted them, you have to remove the kpartx mappings by running "kpartx -d /path/guestdisk". It's important to do this before using the image again for other purposes or starting the guest again! If you forget to remove the mappings the image might get corrupted when you access the image with other tools or start the guest.
Another neat way which works for me, is to simply attach the block device to dom0 as you would to a domU. e.g.:
xl block-attach Domain-0 file:/disk/image/for/domU xvda w
I have found this to work for OSs which use slices (such as Solaris and *BSD), and are not picked up using kpartx. You should check dmesg and see which device nodes were created for you. Once you are done working with the disk image you can:
xl block-detach Domain-0 xvda
If your domU is LVM-based, see Access_Disk_from_DomUs_when_Xen_was_installed_with_LVM
Xen dom0 complains about not enough free loop devices when trying to start a new domU or when trying to "mount -o loop" from the cmdline
Linux "loop" module has max 8 loop devices (/dev/loop*) as a default. Every Xen "file:" backed domU disk uses one loop device in dom0, and if you do "mount -o loop disk.img /mnt" in dom0 that uses a loop device aswell.
You can check all the loop devices in use by running "losetup -a". You can detach a loop device (free it) by running "losetup -d /dev/loopX" when it's not mounted or otherwise in use.
You can increase the amount of available loop devices by loading the linux "loop" module with an option "max_loop=X", for example "modprobe loop max_loop=128". You can add "max_loop=X" option to /etc/modprobe.conf, /etc/modules (or whatever cfgfile your dom0 distribution uses for module options) to make it boot time default.
You can also use Xen "phy:" backed LVM volumes instead of disk images. "phy:" doesn't require loop devices.
Such an error message may also be indicative of other issues (such as the guest crashing and restarting so quickly that xend does not have time to free the older loopback device).
Can I run graphical X applications in Xen dom0 without installing X server and display drivers?
Yes, you can. Many people prefer to not install any graphical drivers or X on dom0 for maximum stability. You can still run graphical applications using ssh X11 forwarding. You can run for example "virt-manager" in dom0 and display the GUI on your desktop/laptop over ssh.
1) Install "xorg-x11-xauth" package in dom0 (centos/rhel/fedora, "xauth" in debian/ubuntu, other distros might have different name for it).
2) Log in to dom0 from your Linux workstation like this: ssh -X root@dom0.
3) After the password is accepted you should notice ssh setting up the ssh X11 forwarding like this:
/usr/bin/xauth: creating new authority file /root/.Xauthority
4) You can now run graphical X applications, for example vnc viewer, virt-viewer etc, and the GUI will be tunneled securely over ssh to your local X desktop.
If you're using Windows you can install "xming" and "putty". Start Xming, and after that enable X11 forwarding in putty settings (Connection -> ssh -> X11 -> Enable X11 forwarding) and then connect to your dom0.
I'd like to run Xen hypervisor/dom0 on Redhat Enterprise Linux 6 (RHEL6)
See this wiki page for a Xen 4.0 with RHEL6 tutorial and more info: RHEL6Xen4Tutorial or check out the newer Xen4CentOS for CentOS 6.4+.
Where do I find more Dom0 FAQs?
See Xen FAQ Dom0
Networking
Is there more information about Xen "blktap" disk backend?
Yes, Xen actually has two blktap backends:
- blktap1: please see the blktap wiki page for more information.
- blktap2: please see the blktap2 wiki page for more information.
blktap2 supports VHD images, and is considered much more robust than the old blktap1 qemu/qcow image file support. Xen 4.0 includes blktap2 support. Note that also the dom0 kernel needs to have the blktap2 driver.
What emulated NIC types/models are available in Xen HVM fully virtualized guests?
The following emulated network interface cards are available for Xen HVM guests in Xen 3.4:
- e100
- e1000
- rtl8139
- ne2k_pci
- pcnet
Emulation is done by Qemu-dm running for each Xen HVM guest. Intel e1000 is known to be the best performing emulated NIC. Even faster is to use PV-on-HVM drivers, which totally bypasses emulation.
Older Xen versions might not have all the above NIC options available.
Xen complains about "hotplug scripts not working"
This problem is often related to udev. Do you have udev installed? Is your udev the correct/supported version? This error usually has more information in the end revealing the real reason.. for example:
Error: Device 0 (vif) could not be connected. Could not find bridge device br0.
Which means exactly what it says.. the guest is configured to to use a bridge called "br0", but there's no such bridge in dom0. Run "brctl show" to verify what bridges you have. Create the missing bridge, or edit the VM cfgfile and make it use another (correct) bridge.
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
This problem is often caused by not having "xen-netback" driver loaded in dom0 kernel.
The hotplug scripts are located in /etc/xen/scripts by default, and are labeled with the prefix vif-*. Those scripts log to /var/log/xen/xen-hotplug.log, and more detailed information can be found there.
Error: Device 5632 (vbd) could not be connected. Path closed or removed during hotplug add: backend/vbd/2/5632 state: 1"
This problem can be caused by not having "xen-blkback" driver loaded in dom0 kernel.
So when dealing with these problems always check you have all the required xen backend driver modules loaded in dom0 kernel! netbk or xen-netback for networking, and blkbk or xen-blkback for block devices (virtual disks).
Also read /var/log/xen/xl*.log, it most probably includes additional information about the problem and the error messages.
How to specify custom (non-default) vif-script for some domU network interface?
Here's an example how to have 2 nics (vifs) for the domU, each using different vif-script:
vif = [ 'mac=00:16:5e:72:04:01,bridge=xenbr0,script=your_custom_script1', 'mac=00:16:5e:72:04:02,bridge=xenbr1,script=your_custom_script2' ]
What's the difference between vifX.Y and tapX.Y network interfaces in dom0?
vifX.Y network interfaces are used with domUs (VMs) using paravirtualized network drivers, which means for pure PV domUs or for Xen HVM guests with paravirtualized PVHVM drivers in use. tapX.Y interfaces are used for HVM guests which are using emulated virtual NICs (Intel E1000, Realtek RTL8139, NE2k).
vifX.Y interfaces are created by the xen-netback backend driver in dom0 kernel. The frontend driver xen-netfront runs in the kernel of each VM.
There's exactly one vif/tap interface per virtual NIC in the VM. "X" means the domain ID, and "Y" is the number of the virtual NIC. So if you have a domU with ID 5 with 3 virtual NICs (eth0, eth1, eth2), the corresponding VIF interfaces in dom0 would be vif5.0, vif5.1, vif5.2.
Using SR-IOV Virtual Function (VF) PCI passthru with Xen
Check RHEL5_CentOS5_Xen_Intel_SR-IOV_NIC_Virtual_Function_VF_PCI_Passthru_Tutorial for tutorial how to use and configure Xen SR-IOV VF PCI passthru on RHEL5 / CentOS5 Xen with Intel 10 Gbit/sec 82599 (ixgbe) SR-IOV NIC. The same general idea applies to upstream Xen and other distros, but the steps required are probably slightly different.
Where do I find more Networking FAQs?
Console
I can't connect to the console of my guest using "xl console <guest>"
Do you have "xenconsoled" process running in dom0? If you do, did you try killing it and restarting it? Also, only one console session per domU can exist at a time. Currently, attempting to use more than one console session per domU will not raise an error, but will result in strange behavior.
Console of my PV guest shows kernel boot messages and then it stops and doesn't work anymore
Do you have a getty configured for the console device in the guest? You usually need to add an entry to /etc/inittab in the guest to make the guest present login prompt on the "xl console" session. Is the getty configured for a correct console device? See the chapter below for correct guest console devices.
Example "/etc/inittab" entry for Debian Lenny (linux-image-2.6.26-2-xen) guest, write this on a new (last) line:
vc:2345:respawn:/sbin/getty 38400 hvc0
Example "/etc/inittab" entry for CentOS 5 (kernel-xen-2.6.18) guest:
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
After modifying /etc/inittab in the guest, run "kill -1 1" to make init (process id 1) reload the configuration file on-the-fly, or reboot the guest. This should make the console work and login prompt appear on the "xl console" session.
NOTE! Some distros (like newer Ubuntu) don't use "/etc/inittab" anymore, but instead you have to configure the gettys in other places! Ubuntu 9.10 and newer use "/etc/init/*.conf".
# hvc0 - getty # # This service maintains a getty on hvc0 from the point the system is # started until it is shut down again. start on stopped rc RUNLEVEL=[2345] stop on runlevel [!2345] respawn exec /sbin/getty -L hvc0 9600 linux
Console of my PV guest is totally empty, it doesn't show anything, not even kernel boot messages!
This usually means your PV (paravirtual) guest is using a newer pv_ops (upstream Linux kernel.org) kernel that has different console device name. You need to add "console=hvc0" to the guest kernel command line options.
If you're using Xen pygrub or pv-grub to load the kernel from guests filesystem, then you need to configure the guest kernel settings in the guest /boot/grub/grub.conf (or menu.lst), not in dom0! So edit the guest /boot/grub/grub.conf (or menu.lst) and add the "console=hvc0" option there for the default kernel.
If you're not using pygrub or pv-grub, aka you're configuring everything in /etc/xen/<guest> configuration file in dom0, and you have the kernel/initrd in dom0 filesystem, then you can specify the additional "console=hvc0" parameter in the /etc/xen/<guest> configuration file in dom0, on the extra="" line.
What's the correct console device name for my Xen PV guest
- Most kernels use "hvc0" as the console device
How do I exit domU "xl console" session
Press ctrl+] or if you're using Putty press ctrl+5.
Everything seems OK but I still can't access the domU "xl console"!
A couple of things to check:
- Do you have some old already running "xl console" session running on the host? possibly stuck in some dead ssh connection?
- Do you have virt-manager running on the host 'reserving' the guest console?
- Did it work earlier?
- Do you have problems with only one guest, or with all guests?
- Does shutting down and then re-starting the guest help?
- Are you really sure you are running a getty in the guest for the correct console device? :)
- Is the guest really up and running? Can you access it over the network with ssh? Can you ping it?
Can I set up Xen HVM Linux guest to display the kernel boot messages on "xl console" ?
Yes, you can. You need to add this line to the "/etc/xen/<hvmguest>" configuration file in dom0:
serial='pty'
And then in the HVM guest grub.conf (inside the HVM VM) configure kernel logging to the (virtual) serial port like this:
#============================================================ # display the grub kernel selector menu on the serial console serial --unit=0 --speed=9600 terminal --timeout=5 serial console # kernel entries title openSUSE 11.1 - 2.6.27.29-0.1 root (hd0,1) kernel /boot/vmlinuz-2.6.27.29-0.1-default root=LABEL=ROOT resume=LABEL=SWAP splash=silent showopts console=tty1 console=ttyS0 initrd /boot/initrd-2.6.27.29-0.1-default #================================================
So basicly you need to add "console=ttyS0" to the kernel line, and also configure grub to display the kernel selector on the (virtual) serial console using "serial" and "terminal" settings.
After these settings "xl console <hvmguest>" works just like it does for PV (paravirtual) guests and allows you to see grub and the Linux kernel boot messages of the HVM guest. You can also use other tools (minicom, screen, etc) in dom0 to access the VM console pty device directly.
Also remember to set up a getty in the guest for the serial console device, ttyS0, so that you can also login from the serial console! See above for tips about that.
Where do I find more Console FAQs?
See Xen FAQ Console
Other Problems / Questions
Starting xend fails?
Xend has been deprecated as of Xen 4.2.0. You should therefore not use the command xm anymore. Instead, you should use the new xl command, which should be binary compatible.
Problems with Xen on Redhat Enterprise Linux 5 (RHEL5) or CentOS5
Try these links:
- http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html-single/Virtualization/index.html
- http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html-single/Virtualization/index.html#part-Virtualization-Troubleshooting
Can I Use the Xen Project Hypervisor in CentOS 6?
Yes, using Xen4CentOS.
Can I back up Xen domains
Yes, see Backing up Xen domains @ serverfault
USB, PCI and VGA passthrough
Can I use 3D graphics in Xen?
Yes, please see the XenVGAPassthrough wiki page for more information how to give a VM direct/full access (including video and 3d acceleration) to a graphics (VGA) card.
Can I passthrough an USB device connected to dom0 to a Xen guest?
Yes, please see the XenUSBPassthrough wiki page.
Can I passthrough a PCI device to Xen guest?
Yes, please see the XenPCIpassthrough wiki page.
Can I passthru a VGA graphics adapter to Xen guest?
Yes, please see the XenVGAPassthrough wiki page.
I have problems using my graphics card in Xen dom0, with the pvops dom0 kernel.. any tips?
Yes, please see the XenPVOPSDRM wiki page.
Is there more information about Xen PVSCSI passthrough functionality?
Yes, please see the XenPVSCSI wiki page.
How do I change the resolution of Xen PV domU vfb graphical VNC console?
You can specify the pvfb (paravirtual framebuffer) resolution and bpp (amount of colors) for the VM while loading the xen-fbfront driver in the domU kernel.
If xen-fbfront is built as a module, use the following options:
modprobe xen-fbfront video="32,1024,768"
Or add the options to "/etc/modprobe.conf", or whatever file your domU distro uses for driver module options. Note that you might need to regenerate the initrd/initramfs image for the domU kernel if the xen-fbfront driver is auto-loaded at boot time.
Or if xen-fbfront driver is built-in to the domU kernel, use the following cmdline options for the domU kernel:
xen-fbfront.video=32,1024,768
If you're using Xen pygrub you can place that option to grub configfile inside the domU "/boot/grub/" directory, or if you're using kernel/ramdisk from dom0, then add those options to "extra" line on /etc/xen/<domU> on dom0.
How can I get resolutions larger than 800x600 for Xen HVM guest graphical VNC console?
Edit "/etc/xen/<hvmvm>" cfgfile and add the following options:
stdvga=1 videoram=16
This will increase the amount of virtual video memory in the HVM VM, allowing it to use bigger resolutions, up to 2048x1536 @ 32bpp. If you don't specify "stdvga=1", ie. you keep using the Cirrus emulated graphics adapter, resolutions up to 1280x1024 are possible with "videoram=16".
After increasing the size of vram configure the resolution from inside the HVM guest in the usual way, just like you'd do on baremetal/native, using the resolution selector or configfile provided by the operating system in the VM.
Where do I find more VGA Passthrough FAQs?
HA and Fault Tolerance
Is there more information about Xen Fault Tolerance, aka Remus Transparent High Availability (HA) for VMs?
Yes, please see the Remus wiki page for more information.
Arp change notification problems after live migration when using pvops 2.6.32.x dom0 kernel
You need to have new enough version of pvops dom0 kernel (xen/stable-2.6.32.x branch, Aug 2010 or newer) and then you can enable "net.ipv4.conf.<dev>.arp_notify" sysctl setting for the devices where you want to send the arp notifications (gratuitous ARP). See this email for more information: http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01595.html .