Ubuntu Howto: Install Xen

Xen LogoFor a long time I have tested many different virtualization techniques; Xen, VMWare, and Microsoft VM. Until now I’m able to conclude that all of them are usable on my desktop machine, but both VMWare and Microsoft’s VM are more sluggish that Xen. This weekend I deployed my first server based on the upcoming Ubuntu and Xen. Everything worked out of the box ;)

Here is what I did to install Xen on Ubuntu:

sudo aptitude install ubuntu-xen-desktop bridge-utils

Boot into the newly installed Xen enabled Ubuntu Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install xen-tools:

apt-get install xen-tools

Xen tools is a collection package containing different tools related to Xen, a virtual machine creator etc.

Edit adjust the kernel and initrd parameters in /etc/xen-tools/xen-tools.conf to match the ones on your system:

Find out what the kernel image and initrd is named by:

ls /boot/vmlinuz*
/boot/vmlinuz-2.6.19-4-generic

and

ls /boot/initrd*
/boot/initrd.img-2.6.19-4-generic

Adjust the lines

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.19-4-generic
initrd = /boot/initrd.img-2.6.19-4-generic

Further adjust the xen-tools.conf to this settings:

dir = /home/xen
debootstrap = 1
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = edgy # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.

Create a home for all the coming virtual Xen guests:

mkdir /home/xen
mkdir /home/xen/domains

And then ready to create a virtual machine – guest, simply by:

xen-create-image -hostname=mailserver -ip=10.0.0.21 -netmask=255.255.255.0 -gateway=10.0.0.1 -passwd

Afterwards I was able to fire up the newly created virtual machine with:

xm create mailserver.cfg

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

When up and running either “xm list” or “xentop” can be used to get an overview of what instance are currently running

ray:# sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----    657.9
mailserver                                 3      128     1 -b----      8.0

Read more on Xen and Ubuntu on the XenVirtualMachine wiki page at the Ubuntu Wiki

Related posts:

  1. Installing Xen on Debian Etch 4.0
  2. Xen Howto: Install Windows
  3. Howto Install Windows XP / Vista on Xen
  4. Ubuntu Howto: Install Ruby and Ruby on Rails
  5. Ubuntu Howto: Install Oracle
  6. Importing / Exporting Virtual Disk Images with Virtual Box
  7. Ubuntu Howto: Install Sun Java
  8. Seamless Windows Applications on Ubuntu Linux Using VirtualBox
  9. Howto Install Fedora From a USB Flash Key Drive
  10. Ubuntu Server Edition JeOS

Popular Related Items »

13 Comments »

  1. noname said,

    September 19, 2008 @ 23:46

    why the heck there is no xenman in Hardy???
    i can’t install xen on hardy since this package is missing.

  2. One Go said,

    November 2, 2008 @ 16:58

    “why the heck there is no xenman in Hardy???
    i can’t install xen on hardy since this package is missing.”

    Because it’s now already included when you install the Xen.

  3. One Go said,

    November 2, 2008 @ 17:00

    “why the heck there is no xenman in Hardy???
    i can’t install xen on hardy since this package is missing.”

    -Because now it’s already included when you install the Xen into Hardy 8.04!

  4. AoYuan said,

    November 6, 2008 @ 16:58

    My cpu dosen’t support pae. After I install XEN by your instruction, I restart the system in server mode, then the warning is given: “CPU doesn’t support PAE”. How can I sovle this problem??

  5. Sriram said,

    November 28, 2008 @ 3:02

    I installed Xen, and rebooted.. It said some stuff when the system was booting,.. but I cannot find the folder /etc/xen !?!?

    Can u please help me ?

    Or is there anything I need to do before following the above steps…

    like apt install xen .. etc etc etc

  6. Robert Shepherd said,

    January 6, 2009 @ 17:10

    “My cpu dosen’t support pae. After I install XEN by your instruction, I restart the system in server mode, then the warning is given: “CPU doesn’t support PAE”. How can I sovle this problem??”

    PAE stands for Physical Address Extention, and it’s for addressing memory above 4G I believe (might be 2G not sure). At any rate it’s usually a setting in the BIOS. You will have to consult the documentation for your motherboard.

  7. Assertions and Deviations :: Virtualization :: Blank or black screen when booting Ubuntu on Xen said,

    May 29, 2009 @ 5:31

    [...] Aspire, with a generic Intel 960 series motherboard and a lack-tastic X3100 video card). There are various tutorials and howtos on doing this, so it went [...]

  8. ha tran said,

    August 3, 2009 @ 20:14

    Hi,
    I got 2 problems.
    Firstly when i type : xm create …
    It shown out an error: ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
    Second, when i try to restart xen with /etc/init.d/xend restart an error displayed: grep: /proc/xen/capabilities: No such file or directory
    I googled and found out that i need to boot with Xen kernel. However i cannot find it. Here is some information in my /boot/grub/menu
    title Ubuntu 9.04, kernel 2.6.28-14-server
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-14-server root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro quiet splash
    initrd /boot/initrd.img-2.6.28-14-server
    quiet

    title Ubuntu 9.04, kernel 2.6.28-14-server (recovery mode)
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-14-server root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro single
    initrd /boot/initrd.img-2.6.28-14-server

    title Ubuntu 9.04, kernel 2.6.28-14-generic
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-14-generic root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro quiet splash
    initrd /boot/initrd.img-2.6.28-14-generic
    quiet

    title Ubuntu 9.04, kernel 2.6.28-14-generic (recovery mode)
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-14-generic root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro single
    initrd /boot/initrd.img-2.6.28-14-generic

    title Ubuntu 9.04, kernel 2.6.28-11-generic
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro quiet splash
    initrd /boot/initrd.img-2.6.28-11-generic
    quiet

    title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=6a12d672-ad34-4ba2-82ab-a87be4c15a8e ro single
    initrd /boot/initrd.img-2.6.28-11-generic

    title Ubuntu 9.04, memtest86+
    uuid 6a12d672-ad34-4ba2-82ab-a87be4c15a8e
    kernel /boot/memtest86+.bin
    quiet

  9. joe_eis said,

    September 11, 2009 @ 12:11

    http://www.nabble.com/grep:–proc-xen-capabilities:-No-such-file-or-directory-td24550003.html

  10. Xen no Ubuntu - dando erro! said,

    January 8, 2010 @ 19:02

    [...] [...]

  11. Varun Pandey said,

    March 1, 2010 @ 5:24

    Hi,
    Nice Article, I am trying to set up private cloud using XEN and EUCALYPTUS. I went through this procedure and every thing was working fine till
    xm create mailserver.cfg

    xm or xend command is giving following error:
    —————————————————————————————

    ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
    Traceback (most recent call last):
    File “/usr/sbin/xm”, line 8, in
    from xen.xm import main
    File “/usr/lib/python2.6/dist-packages/xen/xm/main.py”, line 61, in
    xc = xen.lowlevel.xc.xc()
    xen.lowlevel.xc.Error: (1, ‘Internal error’, ‘Could not obtain handle on privileged command interface (2 = No such file or directory)’)

    ————————————————————————————–

    I am logged on as a super user in the PAE kernel. Still the handler of the privileged method xc() is missing.
    Could you please Help me with this. Its been 4 days since i started installing XEN… Thanx in advance

  12. Varun Pandey said,

    March 1, 2010 @ 5:38

    Hi,
    Nice Article, I am trying to set up private cloud using XEN and EUCALYPTUS. I went through this procedure and every thing was working fine till I use xm or xend command is giving following error:
    ———————————————————————–

    ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
    Traceback (most recent call last):
    File “/usr/sbin/xm”, line 8, in
    from xen.xm import main
    File “/usr/lib/python2.6/dist-packages/xen/xm/main.py”, line 61, in
    xc = xen.lowlevel.xc.xc()
    xen.lowlevel.xc.Error: (1, ‘Internal error’, ‘Could not obtain handle on privileged command interface (2 = No such file or directory)’)

    ———————————————————————–

    I am logged on as a super user in the PAE kernel. Still the handler of the privileged method xc() is missing.
    Could you please Help me with this. Its been 4 days since i started installing XEN… Thanx in advance

  13. Madhu said,

    April 2, 2010 @ 13:16

    Hi Guys,
    I have the same error . I am installing it on Hardy as well and I get the exact same error. Were you able to solve your problems ?
    end
    ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory)
    Traceback (most recent call last):
    File “/usr/sbin/xend”, line 44, in
    from xen.xend.server import SrvDaemon
    File “/usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py”, line 26, in
    import relocate
    File “/usr/lib/python2.5/site-packages/xen/xend/server/relocate.py”, line 26, in
    from xen.xend import XendDomain
    File “/usr/lib/python2.5/site-packages/xen/xend/XendDomain.py”, line 35, in
    from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
    File “/usr/lib/python2.5/site-packages/xen/xend/XendCheckpoint.py”, line 20, in
    from xen.xend import balloon, sxp, image
    File “/usr/lib/python2.5/site-packages/xen/xend/image.py”, line 36, in
    xc = xen.lowlevel.xc.xc()
    xen.lowlevel.xc.Error: (1, ‘Internal error’, ‘Could not obtain handle on privileged command interface (2 = No such file or directory)’)

RSS feed for comments on this post · TrackBack URI

Leave a Comment