Xen Cloud Platform (XCP) – License Expired After 30 Days


If you do a clean install of XCP 1.0 or XCP 1.1 Beta you will find that after 30 days and a reboot none of your virtual machines will boot. If you are using XenCenter to manage your server you will see a notification that your license has expired. This is a bug in the current releases of XCP, and should be fixed in future releases. To fix the issue with a quick hack do the following:

Stop the XAPI service

/etc/init.d/xapi stop

Edit the file /var/xapi/state.db and search for 'expiry'. The field should look something like this:

('expiry' '20110810T00:00:00Z')

Change it so that it reads 30 days or more into the future.

('expiry' '20110910T00:00:00Z')

Restart the XAPI service

/etc/init.d/xapi start

You should be able to start all of your virtual machines again. You will need to perform this task again in 30 days until this check is removed from later releases of XCP.

Here is a small script that can be setup in cron to automate the task.


#Script to fix XCP 30 License expire issue
#Script increases the month value by 1
#By: Ronny L. Bull & Alex Stuart
#Version: 1.0
#Date: 8-9-2011

FUTURE=`date --date="next Month" '+%Y%m%d'`

#stop xapi service
/etc/init.d/xapi stop

#Replace the expiry entry
sed -i "s/\(expiry.\{3\}\)[0-9]\{8\}/\1$FUTURE/g" /var/xapi/state.db

#start xapi service
/etc/init.d/xapi start

12 Responses to “Xen Cloud Platform (XCP) – License Expired After 30 Days”

  1. Andy

    This worked on the master but on the slaves it keeps saying that it has expired. Has any one else run into this?

  2. Ronny

    Did you make the change on the slaves as well or just the master?

  3. Edson

    Ronny, I’m using XCP – 1.1.0-48877c and get noticed that if I put an expiry date beyond 2013, the message expiry starts again. Is it normal ? If so, even your workaround will fail.
    Why it is happening ?
    Did I do something wrong ?

    Thank you.

  4. Ronny


    I noticed that if I changed the year as well that it failed. Just bump up the month and days and leave the year the same.

    Did you try the script that I provided?

  5. Sebastian Cruz


    thanks for the info, it’s been really useful. I have one problem though which I wish you could help me solve.

    I have three XCP 1.1 hosts, two in a cluster, and one alone. The odd one and one of the clustered hosts worked as expected, but the other one was “expired” before applying your hack. It’s still “expired” after.

    Do you have any clues? Thanks again!

  6. wushishan

    LZ thank you vxry much, you deal my problem.

  7. Ronny

    For those of you having a problem in a clustered environment I was also also able to duplicate your issue. For some reason whenever the xapi service is restarted the change to the state.db file is being reverted causing the license to remain expired. Looking in /var/log/messages shows more information. However this looks like a bug that needs to be fixed by the developers.

    The only way I was able to fix the license was to remove the server from the pool, which forces a deletion of all local storage. The server is then reset to defaults again. All VLAN settings were lost as well.

  8. Sebastian Cruz

    Thanks again for your time!

  9. Keith Brown

    What I found in another forum is to add a g at the end of the sed command to replace all entries in the states.db file. This will resolve the issue experienced with multiple servers in a cluster. The following is needed.

    sed -i “s/\(expiry.\{3\}\)[0-9]\{8\}/\1$FUTURE/g” /var/xapi/state.db

  10. Ronny

    Thanks for the information Keith! I have updated the script with the ‘g’.

  11. Rogerio da Costa

    Hi, after run the command to change expiry date xapi no more starts. I get this errors:

    Feb 8 12:07:17 xcp01 root: xapi daemon disappeared; aborting

    Feb 8 12:14:31 xcp01 xapi: [error|xcp01|0 thread_zero||xapi] Caught exception at toplevel: ‘Failure(“int_of_string”)’

  12. Habeeb Shamsi

    Hey thanks a lot ronny, this works.. you are a genius man:)