Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used ubuntu-cloud template as LXC containers, and they all worked fine. Recently I switched to use libvirt-lxc, and followed instructions in Ubuntu document, but the image initialized differently from LXC:

  1. Tried to connect to AWS's meta-data server and got errors:

    2013-02-05 00:55:48,209 -[WARNING]: '' failed [50/120s]: url error [timed out]
  2. Default password didn't work. I need to enable password by modifying the rootfs' /etc/shadow because the default password of "ubuntu" account had been banned.

I think LXC pre-handle the cloud-init issues and feed it some user-data and meta-data. I tried to find how to do this manually, but the cloud-init document page didn't help, because it's examples are all for euca-tools.

And I also noticed that lxc-start has an option -C :"The -C option will create a cloud container, configured for use with a metadata service." But I just didn't know how to map this option and it's all related settings to libvirt_lxc.

How can I init the image/rootfs correctly ?

share|improve this question

Ok, after searching several days to solve the cloud-init issues, I found I can prepare a seed disk to mount in guest system to let cloud-init boot with. In detail:

  1. Create a libvirt domain XML with LXC rootfs
  2. Prepare meta-data and user-data files just following this reference
  3. Instead of createing a ISO file, we can add a mount option in our domain XML to seed files to cloud-init:

    <!-- language: lang-xml -->
    <filesystem type='mount'>
      <source dir='./seed-dir-path'/>
      <!-- Make sure your rootfs has `/var/lib/cloud/seed` directory first-->
      <target dir='/var/lib/cloud/seed/nocloud'/>
  4. Define the domain and start it. Now the cloud-init will get the meta-data and user-data.

And, cloud-init lacks documents 1,2. I've spent a lots of time on searching pieces of information from issue tracker, blog and even github repos. In contrast, the libvirt, has a useful Wiki at least.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.