4

I'm using EC2 user-data to configure certain services before they are launched on newly spun up instances. I've been using #cloud-boothook as the beginning of user data, and it worked like a charm on Precise and newer releases. However, latest cloud-init package on Lucid (0.5.10) doesn't support it. Using #!/bin/bash at the beginning doesn't work as it's executed too late in the boot process (after the services are started).

Is there a way to install cloud-init from scratch, or via some backport package? Or basically any other way to utilize user-data in this way?

Any help is more than appreciated.

Braiam
  • 67,791
  • 32
  • 179
  • 269
ddario
  • 159
  • 4

1 Answers1

1

I think you should ask Amazon to upgrade your instance, instead of backporting something that might have unexpected problems. That said you can build from sources if you have the correct packages. Sadly, the following guide wouldn't help you since python 2.7, a package that cloud-init depends to, is not available in lucid and compiling it from sources and installing it, will break your system. Is advisable to upgrade your server installation instead. The guide below would work if not for the python2.7 dependency:


Before starting:

Remember that this guide won't work. This is the procedure how to build cloud-init from sources. We need couple of build dependencies that are shared along all the packages:

sudo apt-get install dpkg-dev build-essentials cdbs debhelper po-debconf pyflakes pylint python-nose

Continue.

Build dependency problems:

All but one package that cloud-init depends to build is included in the repositories. Luckily there isn't a dependency hell behind it, since only needs python to be built:

mkdir ~/build && cd ~/build
wget http://archive.ubuntu.com/ubuntu/pool/main/m/mocker/mocker_1.0-0ubuntu3.dsc http://archive.ubuntu.com/ubuntu/pool/main/m/mocker/mocker_1.0.orig.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/m/mocker/mocker_1.0-0ubuntu3.debian.tar.gz
dpkg-source -x mocker_1.0-0ubuntu3.dsc
cd mocker*
dpkg-buildpackage -us -uc -nc

Now you have a nice debfile in the parent directory. You can install it just calling:

sudo dpkg -i ../python-mocker_1.0-*.deb

Next

Building cloud-init

This is easy:

cd ~/build
wget http://archive.ubuntu.com/ubuntu/pool/main/c/cloud-init/cloud-init_0.6.3-0ubuntu1.dsc http://archive.ubuntu.com/ubuntu/pool/main/c/cloud-init/cloud-init_0.6.3.orig.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/c/cloud-init/cloud-init_0.6.3-0ubuntu1.debian.tar.gz
dpkg-source -x cloud-init_0.6.3-0ubuntu1.dsc
cd cloud-init*
dpkg-buildpackage -us -uc -nc

Again, we got a nice deb file in the parent directory:

sudo dpkg -i ../cloud-init*

Done... or so I would like to say.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • Thanks for the response. Updating the server is not a solution for me; the thing I'm working on needs to support both Lucid and Precise. I already tried to do something similar to the guide you posted above; tried with 0.5.12 version which is supposed to support #cloud-boothook. But although the dependencies are not a problem, the script doesn't get executed for some reason. – ddario Dec 09 '13 at 14:03
  • @ddario probably because python 2.7 dependencies. If you compile from sources, you are not totally sure that other then build dependencies are installed ;). – Braiam Dec 09 '13 at 19:05
  • Tried to install the Maverick deb package which depends on 2.6, also tried to build the deb package manually (2.6 dependency was set auto) :) I didn't see any errors in cloud-init log, but #cloud-boothook was completely ignored. – ddario Dec 09 '13 at 23:40
  • 1
    @ddario as I said, you want something working, better if you upgrade. Lucid will cease support in April anyways. – Braiam Dec 09 '13 at 23:45