Setup your cloud server in 3 minutes with Xen 4.1 on Ubuntu 11.10
Ubuntu support xen officially since 11.10. It is really easy to install the packages. Although some issues should be fixed manually, it is a painless experience. Here’s the steps to setup your cloud server in 3 minutes with Xen 4.1 on Ubuntu 11.10.
1. Install xen hypervisor and utilities
sudo apt-get install xen-hypervisor-4.1-amd64 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils
sudo apt-get install virtinst virt-viewer virt-manager
2. Restart os, choose the xen kernel, verify xen installation
# xm info
# brctl show
3. Config your xend
$ sudo vim /etc/xen/xend-config.sxp
comment out (xend-unix-server yes) at the file, that means make sure the following line exists or been added :
(xend-unix-server yes)
#vi ~/.bashrc , add the following line:
export VIRSH_DEFAULT_CONNECT_URI="xen:///"
4. Restart, choose the xen kernel, and verify libvirt
# virsh version
Compiled against library: libvir 0.8.3
Using library: libvir 0.8.3
Using API: Xen 3.0.1
Running hypervisor: Xen 4.0.0
Conguratulations, all packages installed successfully.
5. Run virtual machine manager to manage your vms.
# virt-manager
Then you will see the screen virtual machine manager screen:
Create virtual machine in virt-manager,
error occur when finish creation, and show something like:
if ret is None:raise libvirtError(‘virDomainCreateLinux() failed’, conn=self)
….
/usr/lib64/xen/bin/qemu-dm: ….
that means qemu-dm could not be found, try to fix it:
#mkdir /usr/lib64/xen -p
#cp /usr/lib/xen-4.1/* -r /usr/lib64/xen/
then continue to finish creation of the virtual machine, still error occured, and show something like:
libvirtError: POST operation failed: xend_post: error from xen daemon: (xend.err …
or something like this:
libvirtError: POST操作失败: xend_post:来自 xen 守护进程的错误:<Fault 3: ”>
check the error log, it will give you some clues:
# less /var/log/xen/xend.log
the log shows error occured and logged at /var/log/xen/qemu-dm-demo.log, check it:
# less /var/log/xen/qemu-dm-demo.log
it says /usr/share/qemu/keymaps/en-us could not be found, the keymaps really does not exist in my disk.
and find it at /usr/share by :
#ls /usr/share/qemu (and press Tab, it shows qemu-linaro exist)
so just copy it to fix:
#cp -r /usr/share/qemu-linaro/ /usr/share/qemu
then continue to finish the vm creation. Wow, it works!
Comments
52 Comments on Setup your cloud server in 3 minutes with Xen 4.1 on Ubuntu 11.10
-
pawloch on
Mon, 7th Nov 2011 1:54 am
-
Álvaro on
Thu, 17th Nov 2011 6:30 pm
-
euler on
Mon, 21st Nov 2011 9:34 pm
-
Álvaro on
Tue, 22nd Nov 2011 8:07 pm
-
euler on
Thu, 24th Nov 2011 12:46 pm
-
shining365 on
Thu, 17th Nov 2011 2:12 pm
-
wongkey on
Wed, 30th Nov 2011 4:00 pm
-
Konstantin Kurushin on
Tue, 29th Nov 2011 12:10 am
-
wongkey on
Wed, 30th Nov 2011 4:02 pm
-
Tushar on
Sat, 3rd Dec 2011 1:18 am
-
Tushar on
Sat, 3rd Dec 2011 1:29 am
-
mudit on
Fri, 27th Apr 2012 10:57 pm
-
Dustin on
Thu, 28th Jun 2012 12:06 am
-
G-Unit on
Wed, 7th Dec 2011 1:47 pm
-
Nupur on
Wed, 4th Jan 2012 7:27 pm
-
Shailen on
Sun, 8th Jan 2012 4:20 am
-
cihan on
Mon, 9th Jan 2012 6:26 am
-
V@IN on
Tue, 31st Jan 2012 1:02 am
-
Marek on
Sun, 15th Jan 2012 8:07 am
-
Sky on
Wed, 18th Jan 2012 8:37 am
-
Sridutt on
Sun, 29th Jan 2012 12:59 pm
-
V@IN on
Mon, 30th Jan 2012 9:16 pm
-
V@IN on
Mon, 30th Jan 2012 9:55 pm
-
V@IN on
Tue, 31st Jan 2012 1:18 am
-
euler on
Mon, 6th Feb 2012 1:07 pm
-
Shirley on
Wed, 1st Feb 2012 1:50 am
-
Shirley on
Thu, 2nd Feb 2012 7:34 am
-
rum on
Wed, 1st Feb 2012 10:36 am
-
Lichi on
Sat, 4th Feb 2012 3:36 am
-
Rahul on
Tue, 21st Feb 2012 10:42 pm
-
jim on
Wed, 22nd Feb 2012 7:06 pm
-
Alee on
Thu, 23rd Feb 2012 7:30 pm
-
havban on
Tue, 27th Mar 2012 1:16 pm
-
mike on
Fri, 27th Apr 2012 3:22 pm
-
Alee on
Thu, 23rd Feb 2012 7:57 pm
-
wei on
Sat, 25th Feb 2012 8:58 pm
-
tonylyf on
Mon, 5th Mar 2012 9:40 pm
-
Feroz Zahid on
Sun, 18th Mar 2012 8:34 pm
-
yasz on
Mon, 7th May 2012 11:38 am
-
ljw on
Sat, 26th May 2012 6:44 pm
-
ljw on
Sun, 27th May 2012 5:48 am
-
Tosage on
Fri, 25th May 2012 5:53 pm
-
Liuyu on
Sat, 30th Jun 2012 7:07 am
-
liuyu on
Sat, 30th Jun 2012 7:14 am
-
Waqar Ahmed on
Tue, 5th Jun 2012 2:54 pm
-
Waqar Ahmed on
Tue, 5th Jun 2012 2:56 pm
-
Liuyu on
Sat, 30th Jun 2012 7:04 am
-
euler on
Tue, 10th Jul 2012 1:33 pm
-
xiaofei on
Fri, 20th Jul 2012 12:55 pm
-
xiaofei on
Thu, 26th Jul 2012 2:19 pm
-
Farooque Hassan on
Mon, 13th Aug 2012 1:36 am
-
xiaofei on
Thu, 16th Aug 2012 10:50 am
Great post!
Saved me lots of time.
Only the:
export VIRSH_DEFAULT_CONNECT_URI=”xen:///”
should be:
export VIRSH_DEFAULT_CONNECT_URI=”xen:///”
Thanks alot!
You have copied the same line twice: export VIRSH_DEFAULT_CONNECT_URI=”xen:///”
Please write the appropiate one
It’s a problem caused by wordpress, neither bug of the author nor of pawloch.
So the line that is NOW written in this post is correct I suppose, doesn’t it?
At least when I search on the internet it gives the same line
Yes, I’ve updated the line by escaping the character.
非常感谢。借助你的帖子,我也解决了“POST operation failed: xend_post: error from xen daemon: ”的问题。
我的问题在于,/usr/share/qemu根本不存在。我用的是Ubuntu 11.10,通过如下命令可以安装所需的文件:
sudo apt-get install qemu-common
他最后已经说了,有个这样的文件夹/usr/share/qemu-linaro
应该时新版 文件夹名字不叫qemu,叫qemu-***什么什么的,
复制一下就可以了,他已经写的相当详细了
I have done everything from your message but vm creation is still unsuccess.
After copying keymaps I’ve got next errors in “/var/log/xen/qemu-dm-demo.log”:
domid: 3
-c config qemu network with xen bridge for
tap3.0 virbr0
Using file /var/lib/libvirt/images/test1.img in read-write mode
Using file /mnt/data/software/windows/System/wxphe.iso in read-only mode
Watching /local/domain/0/device-model/3/logdirty/cmd
Watching /local/domain/0/device-model/3/command
Watching /local/domain/3/cpu
char device redirected to /dev/pts/1
qemu_map_cache_init nr_buckets = 10000 size 4194304
shared page at pfn feffd
buffered io page at pfn feffb
Guest uuid = a8783bdc-b921-cc44-4cdd-b179ce49481a
Time offset set 0
xen be core: xen be core: can’t open gnttab device
can’t open gnttab device
Register xen platform.
Done register platform.
platform_fixed_ioport: changed ro/rw state of ROM memory area. now is rw state.
xs_read(/local/domain/0/device-model/3/xen_extended_power_mgmt): read error
cirrus vga map change while on lfb mode
mapping video RAM from f0000000
platform_fixed_ioport: changed ro/rw state of ROM memory area. now is ro state.
xs_read(): vncpasswd get error. /vm/a8783bdc-b921-cc44-4cdd-b179ce49481a/vncpasswd.
medium change watch on `hdc’ (index: 1): /mnt/data/software/windows/System/wxphe.iso
I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0
Log-dirty: no command yet.
vcpu-set: watch node error.
xs_read(/local/domain/3/log-throttling): read error
qemu: ignoring not-understood drive `/local/domain/3/log-throttling’
medium change watch on `/local/domain/3/log-throttling’ – unknown device, ignored
Can you help?
Thank you in advance.
thanks a lot,this article helps me a lot.
after restarting no option to chose xen in grub..help..!!
w.r.t. my previous comment i got it. jst needed to install linux-image-server
Hi Martin,
Thanks for the blog. I freshly installed Ubuntu 11.10 and installed all the necessary packages for xen as you mentioned above. I see xen-4.1-i386.gz in /boot dir but when I do upadate-grub xen kernel entry is not there. I check /boot/grub/grub.cfg file and even there the entry for xen is empty. I don’t know what is going wrong.
…
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
…
I also did install linux-image-server but nothing happened …
I tried installing reinstalling multiple times but no luck. I tried this on friend’s laptop and there also it doesn’t work. It just simply doesn’t show up in grub.
Also, may you please give me your grub.cfg file, just to see whats missing.
Have you run ‘sudo update-grub’ after installing linux-image-server? That made the xen boot entry available for me.
Hi,
Great post, this is spot on. The only issue I had was not getting the grub menu to boot into Xen kernel. Stupid thing, hold down shift when grub loads, then menu will display and you can choose the Xen Kernel.
I did get the grub entry by ” apt-get install linux-image-server”
There were actually 2xen entries xen-4.1-i386 and xen-4.1-amd.
Then again there was another grub entry after selecting either one of them. Selecting the linux 3.0.0.14pae with xen entry i login.
But
” # xm info “gave me this error:
root@nupur-Inspiron-N5010:~# xm info
Error: Unable to connect to xend: No such file or directory. Is xend running?
Any suggestions.
so the env var should be eq to xen:double_forward_slash
or xen:triple_forward_slash ??
when I say
$virsh version
I get the followings:
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: Xen 3.0.1
Cannot extract running Xen hypervisor version
any suggestions?
You just have to place export VIRSH_DEFAULT_CONNECT_URI=”xen:///” at the beginning of the #vi ~/.bashrc file
I hit error:
oot@taxed01:/opt/VMs# xm new cod
Unexpected error:
Please report to xen-devel@lists.xensource.com
Traceback (most recent call last):
File “/usr/lib/xen-4.1/bin/xm”, line 8, in
main.main(sys.argv)
File “/usr/lib/xen-4.1/bin/../lib/python/xen/xm/main.py”, line 3983, in main
_, rc = _run_cmd(cmd, cmd_name, args)
File “/usr/lib/xen-4.1/bin/../lib/python/xen/xm/main.py”, line 4007, in _run_cmd
return True, cmd(args)
File “”, line 1, in
File “/usr/lib/xen-4.1/bin/../lib/python/xen/xm/main.py”, line 1518, in xm_importcommand
cmd = __import__(command, globals(), locals(), ‘xen.xm’)
File “/usr/lib/xen-4.1/bin/../lib/python/xen/xm/new.py”, line 26, in
from xen.xm.xenapi_create import *
File “/usr/lib/xen-4.1/bin/../lib/python/xen/xm/xenapi_create.py”, line 24, in
from lxml import etree
ImportError: No module named lxml
so apt-get install python-lxml resolved problem
thanks for great POST
Great article but I’m still stuck where a few other people are. Fresh install of 11.10 and this is what I get:
$ sudo virsh version
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: QEMU 0.9.2
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for i686
I commented out the line I was suppose to comment out (meaning, take out the # ? because the default file has the line already commented out, as in, there’s a # there already) and added export VIRSH_DEFAULT_CONNECT_URI=”xen:///” where it goes.
Any help would be great.
I have installed all the modules/packages, etc.
Finished successfully step 4
When I start with step 5, I cannot get it working, Gives some ~GTK error (I am default booting up in the Shell mode)
PS: When I boot up via the XEN, I get into shell mode, not GUI, can anyone tell me what may I have missed in the installation and obviously how to repair up to get the GUI of Ubuntu even through XEN.
@sky: can u help me out if you have found solution to your problem. I am facing the same problem .
@cihan: I am facing the same problem as you
~$ virsh version
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: Xen 3.0.1
Cannot extract running Xen hypervisor version
if any one can help me
Unable to complete install: ‘POST operation failed: xend_post: error from xen daemon: (xend.err “Error creating domain: device model ‘/usr/lib/xen/bin/qemu-dm’ not found”)’
I other major issue is i didn’t get this error at beginning
if ret is None:raise libvirtError(‘virDomainCreateLinux() failed’, conn=self)
….
/usr/lib64/xen/bin/qemu-dm: ….
that means qemu-dm could not be found, try to fix it:
even though i didn’t get it i have done following
#mkdir /usr/lib64/xen -p
#cp /usr/lib/xen-4.1/* -r /usr/lib64/xen/
My machine is 32 bit – i386
so guide me ..
i get this
less /var/log/xen/qemu-dm-demo.log
/var/log/xen/qemu-dm-demo.log: No such file or directory
please guide me …
since you are using 32 bit i386, in the install command, replace amd64 with i386, and shall copy the xen folder to /usr/lib/xen after installation:
#mkdir /usr/lib/xen -p
#cp /usr/lib/xen-4.1/* -r /usr/lib/xen/
Good luck.
Hi —
I’m trying this install on my ubuntu 11.10 system and getting the follow errors.
$ sudo apt-get install xen-hypervisor-4.1-amd64 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package xen-tools is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
bash-completion
Package xen-utils-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package xen-hypervisor-4.1-amd64
E: Couldn’t find any package by regex ‘xen-hypervisor-4.1-amd64’
E: Unable to locate package xen-utils-4.1
E: Couldn’t find any package by regex ‘xen-utils-4.1’
E: Package ‘xen-tools’ has no installation candidate
E: Package ‘xen-utils-common’ has no installation candidate
E: Unable to locate package xenstore-utils
Has anyone else seen this? What might I be doing wrong?
Thanks
–Shirley
I pull packages from http://packages.ubuntu.com/
and installed them.
Had trouble running xm info. Got:
/etc/bash_completion.d/xm: line 3: have: command not found
Found link, http://www.schuerig.de/michael/blog/index.php/2007/02/24/gem-bash-completion/, which talked about missing “have” function. So created /etc/bash_completion/have file which contains:
have()
{
unset -v have
PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
have=”yes”
}
This got ride of the error, but the “xm info” command did not generate any output.
Suggestions?
In third step it is about editing of two files.
If the second one gives as follows it would be more clear.
#vi ~/.bashrc
Then write this line in opened file.
export VIRSH_DEFAULT_CONNECT_URI=”xen:///”
After rebooting and entering the grub boot menu I get a Xen 4.1-i386 option and after selecting that option I get:
Xen 4.1-i386 and linux 3.0.0-15 generic-pae
Xen 4.1-i386 and linux 2.6.38-13 generic-pae
Anyone I choose ends up in full reboot… no log at all.
Did this happen to anyone else?
Could someone fix this?
Thanks in advance…
Thanks a lot,
That works like a charm.
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: Xen 3.0.1
Cannot extract running Xen hypervisor version
Sort of Solution :
#sudo -s
root@xs:~# virsh version
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: Xen 3.0.1
Running hypervisor: Xen 4.1.0
but how can i get it to work for user, maybe adding the user to superusers, not the preferred solution.
Any ideas peeps ?
Hi dude!
Help me out..
I have the same problem as above mention.
root@cluster:~# sudo virsh version
Compiled against library: libvir 0.9.2
Using library: libvir 0.9.2
Using API: QEMU 0.9.2
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for i686
I have read all the comments and tried everythng.. But couldn’t solved 🙁
The solution is by not using sudo anymore, since you’re already signed in as root.
Here is what I tried:
root@smart:~# sudo virsh version
Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for i686
but if I use it without sudo:
root@smart:~# virsh version
2012-03-27 05:15:37.473+0000: 20599: info : libvirt version: 0.9.8
Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: Xen 0.9.8
Running hypervisor: Xen 4.1.0
I get the same way whether running as root or sudo.
and one more thing..
What happen iff i skip it and proceed to next steps??
I have problems on creating domain u.
Help me.
‘Could not find an installable distribution at ‘http://archive.Ubuntu.com/ubuntu’
The location must be the root directory of an install tree.’
Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 44, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File “/usr/share/virt-manager/virtManager/create.py”, line 1899, in do_install
guest.start_install(False, meter=meter)
File “/usr/lib/pymodules/python2.7/virtinst/Guest.py”, line 1206, in start_install
self._prepare_install(meter, dry)
File “/usr/lib/pymodules/python2.7/virtinst/Guest.py”, line 963, in _prepare_install
meter=meter)
File “/usr/lib/pymodules/python2.7/virtinst/DistroInstaller.py”, line 426, in prepare
dev = self._prepare_kernel_and_initrd(guest, meter)
File “/usr/lib/pymodules/python2.7/virtinst/DistroInstaller.py”, line 365, in _prepare_kernel_and_initrd
self.os_type)
File “/usr/lib/pymodules/python2.7/virtinst/OSDistro.py”, line 156, in acquireKernel
scratchdir, type)
File “/usr/lib/pymodules/python2.7/virtinst/OSDistro.py”, line 150, in _acquireMedia
None, media_cb)
File “/usr/lib/pymodules/python2.7/virtinst/OSDistro.py”, line 129, in _locationCheckWrapper
arch=arch)
File “/usr/lib/pymodules/python2.7/virtinst/OSDistro.py”, line 112, in _storeForDistro
baseuri))
ValueError: Could not find an installable distribution at ‘http://archive.Ubuntu.com/ubuntu’
The location must be the root directory of an install tree.
I follow your words and install the xen 4.1 to my ubuntu 11.10. And I have a question ,how to use the minios?or stubdom?
Good Work!. Explains exactly what is needed to do this setup.
Hi,
Has anyone tried doing this on ubuntu 12.04?
thanks
I have tried this on 12.04 and the instruction don’t work.
The api doesn’t load the xen version only the qemu version for some reason. Will post back if I find a solution.
The solution appeared to be
In the /etc/xen/xend-config.sexp file, find and uncommont the lines:
(xend-unix-server no)
(xend-unix-path /var/lib/xend/xend-socket)
and change the “(xend-unix-server no)” line to “yes”:
(xend-unix-server yes)
Add the bashrc command to roots bashrc
Add user to libvirtd and kvm groups so that the user can actually use the xen install.
Hello yaszn i have do this installation on a PE R710 from Dell with an Ubuntu Server 12.04 with GNU/Linux 3.2.0-24-generic x86_64 kernel, and seems to work well.
However i didn’t install the virtual machine manager.
I try to manage this hypervisor with XenCenter as my other XenServer in my park, but it doesn’t work :/
If anyone has an idea 😉
have u successfully install the Xen?
i am using the Ubuntu 12.04 and i want to install the Xen X86_64
when i was following this instruction,
xm info
Error: can’t find the hypervisor info in sysfs!
any suggestion?
Thanks!
hi,
i am now installing the X86_64 on the 12.04 Ubuntu.
i did followed the instruction however after i install everything.
i type xm info: error: can’t find hypervisor information in sysfs!
any suggestion?
Thank you very much , I had successfully installed the XEN hypervisor, the only problem I was getting was that the VM wouldn’t start. It would display that “graphical console is not yet active for guest”
I solved the problem using the FAQ page of “libvirt” library by executing the following two commands:
waqar@Waqar:~$ modprobe tun
waqar@Waqar:~$ virsh net-start default
All is not set !
Thank you for this page, this saved me a lot of time and effort!
Thank you very much , I had successfully installed the XEN hypervisor, the only problem I was getting was that the VM wouldn’t start. It would display that “graphical console is not yet active for guest”
I solved the problem using the FAQ page of “libvirt” library by executing the following two commands:
waqar@Waqar:~$ modprobe tun
waqar@Waqar:~$ virsh net-start default
All is now set ! (I wrote NOT in the last post while I meant NOW)
Thank you for this page, this saved me a lot of time and effort!
hi, i need help
i do as u said install everything and successed.
however ,when i use xm info it always said that can’t find hypervisor inforamtion in sysfs! when i type brctl show i can see the bridge info. I do not know why.
suggestion?
Thanks!
have you installed the kernel which support hypervisor?
无法完成安装:’POST failure: xend_post:the fault from xen proceed:Fault 3: ‘win7’
Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 45, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File “/usr/share/virt-manager/virtManager/create.py”, line 1909, in do_install
guest.start_install(False, meter=meter)
File “/usr/lib/python2.7/dist-packages/virtinst/Guest.py”, line 1236, in start_install
noboot)
File “/usr/lib/python2.7/dist-packages/virtinst/Guest.py”, line 1304, in _create_guest
dom = self.conn.createLinux(start_xml or final_xml, 0)
File “/usr/lib/python2.7/dist-packages/libvirt.py”, line 2166, in createLinux
if ret is None:raise libvirtError(‘virDomainCreateLinux() failed’, conn=self)
libvirtError: POST操作失败: xend_post:来自 xen 守护进程的错误:
Hi,I wan to install vtpm manager,do you know how to install it ? i’ve already installed xen,tpm-emulator,tpmmanager.Thanks a lot!
I am using WUBI in windows 7 and ubunto on dual boot mode , so is it possible for me to use XEN ?
while running this command i get many error messages
sudo apt-get install xen-hypervisor-4.1-amd64 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils
I really need a quick reply !!!
hello,I wan to know how to make it support VTPM?













