Installing XCP-XAPI on Ubuntu Server 12.04 LTS

As part of my 2012 projects (see here plus an update here), I’ve been familiarizing myself with the Xen hypervisor. To that end, I’ve been working to get XCP (Xen Cloud Platform, the open source version of XenServer) running on a test system in my home office. It’s been a bit of a struggle, but I think I’ve finally got it, and I wanted to share the information here.

Here are the steps that I followed to install XCP-XAPI on a system running Ubuntu Server 12.04 LTS. Much of the credit goes to Project Kronos and this page in particular on the XCP toolstack on a Debian-based installation. While the XCP toolstack page is quite helpful, I found that the instructions were confusing (for me, at least). Hence, I’m writing up my steps in the hopes that they will prove useful to someone else.

Before Installing XCP-XAPI

Before I started the installation of the XCP-XAPI packages, I first made sure that all the various networking interfaces were configured correctly and working as expected. For my particular system (a Dell Latitude E6400), this meant installing some proprietary Broadcom wireless firmware (using the firmware-b43-lpphy-installer package) and configuring /etc/network/interfaces. I also ran apt-get update and apt-get upgrade to install the latest versions of all packages. Credit goes to this page for instructions on how to configure the wireless NIC from the CLI, with one small correction. In the /etc/network/interfaces file, I had to use this as the pre-up parameter (the example on the page above used “-Bw” instead of “-B”):

pre-up wpa_supplicant -B -Dwext -iwlan0
 -c/etc/wpa_supplicant/wpa_supplicant.conf

(Naturally you’d write that all as one line; it’s broken here for readability.)

Installing XCP-XAPI

First, I edited /etc/apt/sources.list to add repositories for the XCP-XAPI packages. Although Ubuntu 12.04 LTS provides XCP-XAPI packages, the Project Kronos page indicated that there were dependency issues, so I went with these packages instead. If anyone has any experience with the Ubuntu-provided XCP-XAPI packages, please let me know.

I added these lines:

deb http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main
deb-src http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main

Then I ran this command:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9273A937

That was followed by:

apt-get update
apt-get install xcp-xapi

From there, apt-get started fetching and installing the necessary packages (and there are quite a few). When prompted, I selected to use OpenvSwitch as the networking backend (instead of standard Linux bridging).

Before rebooting—which you’ll need to do in order to boot into the Xen kernel—I also performed the following steps.

  1. I edited the /etc/init.d/xend file to prevent xend from starting up. (Note that I deliberately split the two sed commands here for easier readability.)
     
  2. sed -i -e 's/xend_start$/#xend_start/' /etc/init.d/xend
    sed -i -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend
    update-rc.d xendomains disable
  3. I set the XAPI toolstack as the default by editing /etc/default/xen and changing the line TOOLSTACK="" to TOOLSTACK="xapi".

  4. I made the Xen kernel the default grub entry by editing /etc/default/grub and setting GRUB_DEFAULT="Xen 4.1-amd64". Then I ran update-grub.

  5. I added a symbolic link from /usr/share/qemu-linaro/keymaps to /usr/share/qemu/keymaps.

At this point, the system is ready for a reboot.

Verifying that XCP-XAPI Works

I’m still working on a more comprehensive set of tests, but some basic tests should tell you whether the system is working or not:

  1. Run xe host-list. It should return a single host, which is the system you just built.
  2. Run xe vm-list. The information returned should list a single VM described as the control domain on the host.
  3. Run xe network-list. You should get back a network for each network interface, plus another network for XenAPI communications.
  4. Run xe sr-list. You should get back a single SR (storage repository) used for XenServer Tools ISOs.

(By the way, note that xe requires a username and password, even if you’re running it against the local host. I found it easiest to create a password file and then create an alias for xe that included the -pwf parameter.)

I have future posts planned that will talk more about networking and SRs with this Ubuntu-based XCP-XAPI system, so stay tuned for those. Also, if you have any tips or tricks for making this process easier (or if I’ve stated something incorrectly), please speak up in the comments. Thanks!

Tags: , , ,

  1. Frederik Vos’s avatar

    username / password is not needed if you’re using sudo

    other tips:
    xe vm-template list
    xe host-list
    xe sr-create host-uuid=… device-config:server= device-config:serverpath= device-config:type=nfs device-config:options=”-o proto=tcp” name-label=”" content-type=user type=nfs
    xe sr-list
    xe vm-install template=… new-name-label=… sr-uuid=…
    xe vm-list
    xe vm-param-set uuid=… other-config:install-repository=http://..
    xe vm-start vm=…

  2. Fabio Rauber’s avatar

    Hi Scott,

    I followed your excellent tutorial and all went great, except for the administration via XenCenter: the virtual machine’s console is not accepting any keystrokes. Did you try to manage virtual machines with XenCenter? It occurs with every HVM VM, even with Ubuntu installation.

    Thanks in advance.

  3. jawrat’s avatar

    Hi Fabio…

    I ran into the same issue with my install. The solution (for the moment) appears to be to use vncviewer on a separate ubuntu machine using the -via argument to tunnel through ssh to the actual server and use the separate ubuntu machine’s xserver to display the screen. it works.

    Now my issue is the whole networking stack is just weird. I’m trying to use openvswitch (since bridge just didn’t seem to be working at all), but it’s just not there at the moment. Not sure what i’m doing wrong, but i’m about ready to bail on the whole thing and try something different. (I have three 2950s that I need to configure in some sort of cloud configuration to be redundant and highly available running w2k3 and w2k8 web servers)

  4. Graham’s avatar

    I’ve tried a very similar setup tutorial which can be found here:
    http://www.chimos.de/stuff/xen-xcp-ubuntu-manual/xen-xcp-ubuntu-manual.txt

    xe host-list lists the host but when trying to connect using xencenter I get connection refused. Any ideas?

  5. jawrat’s avatar

    So, i’m *so* almost there with XCP-XAPI. i’ve followed most of the above and i’ve reached the point where I have it running, can create vms in xencenter, installed an OS in the vm (using a third machine to connect to the vncterm), but I just *cannot* for the life of me get openvswitch to work properly. xapi appears to add the vif and add the vif to the bridge (shows up in ovs-vsctl show)

    Have you any ideas as to how to debug this?

  6. Nandakumar’s avatar

    Hi Scott,

    I tried all your given instructions and finally tested after rebooting but I got an error “server internal error” when i run xe commands.

  7. kabir’s avatar

    Hi Nandakumar,
    Just got out your problem. The following should solve the issues with xe commands

    sed -i -e ‘s/xend_start$/#xend_start/’ /etc/init.d/xend
    sed -i -e ‘s/xend_stop$/#xend_stop/’ /etc/init.d/xend
    update-rc.d xendomains disable

  8. Thierry’s avatar

    you could replace step 2 to 4 by simply doing:
    apt-add-repository ppa:ubuntu-xen-org/xcp-unstable

  9. Thierry’s avatar

    You could replace

    “I added these lines:

    deb http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main
    deb-src http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main

    Then I ran this command:

    apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 9273A937

    By apt-add-repository ppa:ubuntu-xen-org/xcp-unstable

  10. Nandakumar’s avatar

    Also i am getting error when I am trying this command

    “apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 9273A937″

    Error is : ?:keyserver.ubuntu.com:connection timeout
    gpgkeys: HTTP fetch error 7: couldn’t connect: connection timed out
    gpt: no valid OpenPGP data found.
    gpg:no valid OpenPGP data found.
    gpg: Total number processed:0

  11. slowe’s avatar

    Nandakumar, that sounds like a network connectivity issue to me.

  12. Nandakumar’s avatar

    Hi All,

    Thanks for your reply. I have tried deploying the same steps in another system, It was successful. After reading some articles in other forums i found the hardware am installing in it is not supporting.

    That’s the reason the error occurs saying Memory insufficient.

    Thanks,
    Nanda

  13. Nandakumar’s avatar

    Yes slowe that was network connectivity issue..Thanks :)

  14. kobkero’s avatar

    after i reboot after edit grub completely, my server have a reboot loop after booting in xen kernel.

    i don’t know how to debug error because i can’t boot in xen kernel.

  15. Anand’s avatar

    Anyone else run into this bug while trying to install the above ?
    https://bugs.launchpad.net/ubuntu/+source/xen-api/+bug/1004028
    Am scratching my head why none of you ran into it and I ran face first into it. Any help appreciated

  16. david’s avatar

    Great write up got me past the hurdle ( needed the other sources). If it helps anyone xapi is broke on ubuntu (stock). I am at the point of trying to get xencenter working. I have noticed that my new install is not listening on tcp http at all so either the server is not enabled or it does not work. My Xcp box always has thses going ( i do have a ssh going on this)

    tcp 0 52 192.168.0.2:ssh mxdog-pc-n.mxdog.ne
    tcp 0 0 localhost:57091 localhost:http
    tcp 0 0 localhost:http localhost:55853
    tcp 0 0 localhost:36735 localhost:5901

    and my fresh new install (thanks to this page)

    tcp 0 52 mx-nas-01.mxdog.net:ssh mxdog-pc-n.mxdog.:55119

    no listener …not sure how to fix that yet but thought i would post it

    thanks again

  17. david’s avatar

    just a follow up quick ..to get xencenter working stunnel needed to be enabled and the version had to be changed in xen inventory file . i just did 6.0.0 once stunnel was running https was showing and xencenter hooked right up

  18. johnk’s avatar

    To disable xend on ubuntu 12.04, I did this:

    update-rc.d xend disable

  19. GizmoChicken’s avatar

    I was able to install XCP-XAPI onto Ubuntu Desktop. But upon attempting to log into XCP-XAPI from XenCenter using my username and password for my administrator account for Ubuntu, I received the following error:

    “Incorrect username and/or password.”

    I also tried to log into XCP-XAPI from XenCenter using “root” as my username and the corresponding password. Again, no luck.

    After attempting a few other fixes to no avail, I finally enabled the super user account password on Ubuntu using the following:

    $ sudo passwd root
    [sudo] password for admin:
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully

    After the above, I was able to log into XCP-XAPI from XenCenter using “root” as my username and the corresponding password.

    QUESTIONS: Is the above (enabling super user password and logging in as root) typically necessary? Or is there a better approach?

  20. Matt Petersen’s avatar

    Regarding the login error, I had the same problem but put my user into the group root and this fixed it. Hope this helps someone.