Tuesday, March 31, 2015

Modifying an existing cloud image

We recently updated emis.eucalyptus.com to point to official cloud images created by Linux distribution providers themselves rather than creating sample one's ourselves. While this goes a long way toward making it easy to grab a stable, up to date image, there are still cases where you might need to update software that exists on the image already or add more software of your own.

For most images, including all of those referenced on emis.eucalyptus.com, this is a fairly straightforward process.  Once you have downloaded an image, just perform the following steps:

Decompress the image, if necessary. The Fedora image, for instance, needs to be decompressed using xunzip/xz

Convert the image to RAW format, if necessary.  If your image ends in .img or .qcow2, it is likely in QCow2 format and needs to be converted using qemu-img from qemu-utils:

qemu-img convert -0 raw disk.img disk.raw

Add the raw disk image using kpartx:

kpartx -a -v disk.raw

Mount the first partition of the disk image:

mount /dev/mapper/loop0p1 /mnt

chroot into the mounted volume:

chroot /mnt

Once inside the chroot, you may update and/or add any software you need.  For Debian/Ubuntu images, you might want to run apt-get update followed by apt-get upgrade to ensure the latest versions of system packages in the image.  For Fedora/CentOS images, run yum upgrade.  Once finished with your changes, exit the chroot environment:

umount /mnt

You should now have an updated image ready to push to your Eucalyptus cloud.  To do this, simple follow the instructions provided on http://emis.eucalyptus.com.


  1. we have mounted but how can we update as how to change the network configuration so that it can use the connection of the OS on which it is mounted for updating.

  2. There should be no need to do that as DHCP is enabled on the images by default. You can run euca-get-console output on the image after it has booted to see the dmesg output and diagnose what might be the problem.