Diff for "UEC/Images"


Differences between revisions 8 and 36 (spanning 28 versions)
Revision 8 as of 2010-08-20 17:29:09
Size: 9278
Editor: d14-69-66-169
Comment:
Revision 36 as of 2014-11-20 00:03:45
Size: 15968
Editor: 175
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
||<style="background-color: #e0e0e0;"><<TableOfContents()>>||
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents>>||

<<Anchor(Intro)>>
Line 4: Line 5:
The term 'UEC Images' refers to the Official Ubuntu images that are available at http://uec-images.ubuntu.com . These images are built by Canonical. They are then registered on EC2, and compressed tarfiles are made available for download. The downloaded content can be used as a starting point for [[http://alestic.com/2010/01/ec2-ebs-boot-ubuntu|creating your own image]], or published unmodified to your own UEC.

== Daily and Released Images ==
"Daily" builds are made available for testing and continuous integration. The daily builds are not tested at all. However, the content of the images has already been through the [[https://wiki.ubuntu.com/StableReleaseUpdates|SRU process]], so in general the daily builds for stable releases are stable. Quality of daily builds for the development release will vary.

Prior to a milestone or release, a daily builds is selected, tested and then promoted. Only a limited number of daily images are kept around (see the [[https://wiki.ubuntu.com/UEC/Images/NamingConvention|removal policy]]). Any build that is marked as 'released' will never be deleted.

Daily builds are available under http://uec-images.ubuntu.com/server/<codename> . For example, daily builds of lucid (10.04 LTS) are available at http://uec-images.ubuntu.com/server/lucid/ . Released builds are available under http://uec-images.ubuntu.com/server/releases/<codename> .

To use the images on EC2, simply start an instance with the command line tools using command lines given at [[http://uec-images.ubuntu.com/releases/lucid/release/|uec-images]], or launch one of these from the Amazon EC2 Console.

== Features of the Images ==
=== Version Controlled Build Process ===
Its not really an end user feature, but a reliable build process in place. Images are built on a 10.04 LTS host from a [[https://code.launchpad.net/~ubuntu-virt/vmbuilder/0.11|0.11 branch]] of [[https://launchpad.net/vmbuilder|vmbuilder]]. The build scripts are available under the [[https://code.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds|automated-ec2-builds]], and published to uec-images and EC2 using [[https://code.launchpad.net/~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts|ec2-publishing-scripts]].

=== CloudInit ===
The images contain [[CloudInit]]. CloudInit allows for dynamic run-time customization of images via user-data.

=== Run Images locally without a Cloud ===
Images after 10.10 can now be run outside of the cloud environment without any difficult setup, and even provide an easy way to provide metadata to the instance.
 * download a suitable image from [[http://uec-images.ubuntu.com/server/maverick/current/]] . The file name will vary. For this example, it is "maverick-server-uec-amd64.tar.gz". {{{
The term 'Ubuntu Cloud Guest' refers to the Official Ubuntu images that are available at http://cloud-images.ubuntu.com . These images are built by Canonical. They are then registered on EC2, and compressed tarfiles are made also available for download. For using those images on a public cloud such as Amazon EC2, you simply choose an image and launch it. To use those images on a private cloud, or to run the image on a local hypervisor (such as KVM) you would need to download those images and either publish them to your private cloud, or launch them directly on a hypervisor. The following sections explain in more details how to perform each of those actions

<<Anchor(PubCloud)>>
== Ubuntu Cloud Guest on Amazon EC2 Cloud ==

In order to start using official Ubuntu images on the public cloud (ex. Amazon EC2), you
  * Choose an Ubuntu release you want to use (Lucid, Maverick, Natty...etc)
  * Get the latest AMI ID corresponding to the release you want to use
  * Launch your chosen image on EC2

<<Anchor(PubCloudChooseRelease)>>
=== Choosing an Ubuntu Release ===

Choosing the Ubuntu release depends on a lot of factors such as whether or not you would like to launch an LTS image for long term support, or whether you need specific versions of libraries or applications. If in doubt, choose the latest LTS release (currently Trusty 14.04)

<<Anchor(PubCloudAMIID)>>
=== Get Ubuntu AMI-ID ===

As Ubuntu Cloud Guest images are uploaded and registered on the Amazon EC2 cloud, they are referred to as AMI (Amazon Machine Images). Each AMI is a machine template from which you can instantiate new servers. Each AMI has its own unique ID. In order to launch an instance on the EC2 cloud, you first need to locate its ID. The [[http://cloud.ubuntu.com/ami|AMI Locator]] web application can help you quickly locate an AMI ID. Here's how to use it
  * Visit [[http://cloud.ubuntu.com/ami|AMI Locator]]
  * Type a few characters in the search box signifying what you're searching for. For example if you would like to find out the AMI-ID for the latest release of Maverick Meerkat to run on a 64 bit ebs instance in the us-east region, you would search for "mav 64 us-east ebs" or a subset thereof.
{{attachment:ami-locator-small.png}}

<<Anchor(PubCloudLaunchAMI)>>
=== Launch Ubuntu AMI ===
  * For a video tutorial on starting your first Ubuntu Cloud Guest on the Amazon EC2 cloud using the web management console (recommended for newcomers), check out this video tutorial http://www.youtube.com/user/ubuntucloud#p/u/4/rYJLIfVuSMY
  * For using the ec2 command line tools (recommended for advanced users and script writers), check out the [[https://help.ubuntu.com/community/EC2StartersGuide|EC2 Starters Guide]]

<<Anchor(PrivCloud)>>
== Ubuntu Cloud Guest on UEC Private Cloud ==

If you are running your own private UEC cloud, you may wish to publish new Ubuntu Cloud Guest images (as they are made available) to your cloud infrastructure.

<<Anchor(DownloadUECImages)>>
=== Downloading Daily and Released Images ===
Ubuntu Cloud Guest images are created in two flavors. "Daily" is a daily composed image that provides a fresh but perhaps less tested image. and "Release" that provides regularly updated and well tested images

"Daily" builds are made available for testing and continuous integration. The daily builds are not tested at all. However, the content of the images has already been through the [[https://wiki.ubuntu.com/StableReleaseUpdates|SRU process]], so in general the daily builds for stable releases are stable. Quality of daily builds for the development release will vary.

Daily builds are available under http://cloud-images.ubuntu.com/server/<codename> .

  * 10.04LTS Lucid http://cloud-images.ubuntu.com/server/lucid/
  * 10.10 Maverick http://cloud-images.ubuntu.com/server/maverick/
  * 11.04 Natty http://cloud-images.ubuntu.com/server/natty/
  * 11.10 Oneiric http://cloud-images.ubuntu.com/server/oneiric/

Released builds are available under http://cloud-images.ubuntu.com/server/releases/<codename> .

  * 10.04LTS Lucid http://cloud-images.ubuntu.com/server/releases/lucid/
  * 10.10 Maverick http://cloud-images.ubuntu.com/server/releases/maverick/
  * 11.04 Natty http://cloud-images.ubuntu.com/server/releases/natty/
  * 11.10 Oneiric http://cloud-images.ubuntu.com/server/releases/oneiric/

Once you have downloaded a suitable image, you most likely want to publish it to your private cloud, a process called [[https://help.ubuntu.com/community/UEC/BundlingImages|BundlingImages]]

<<Anchor(LocalHypervisor)>>
== Ubuntu Cloud Guest images on Local Hypervisor (Maverick) ==

Images after 10.10 (maverick) can now be run outside of the cloud environment without any difficult setup, and even provide an easy way to provide metadata to the instance! If you would like to run a Ubuntu Cloud Guest image on your local KVM hypervisor, checkout the previous section explaining [[#DownloadUECImages| Downloading Daily and Released Images]] then untar the image and boot it. Here is an example to make things clearer

 * The Image file name will vary. For this example, it is "maverick-server-uec-amd64.tar.gz". {{{
Line 27: Line 68:
 * extract the tar file and set some variables names for its contents {{{  * Extract the tar file and set some variables names for its contents. Here is an example {{{
Line 40: Line 81:
 * boot the image in kvm {{{  * Create a copy on write disk image, based on the disk image we downloaded and boot that image in local kvm {{{
Line 45: Line 86:
 * get the password for 'ubuntu' and log in<<BR>>The default selection in the grub menu will result in a randomly generated password for the 'ubuntu' user on first boot. The password is written two places, the console and the serial device. On the console, you will see lines like: {{{  * Get the password for 'ubuntu' and log in<<BR>>The default selection in the grub menu will result in a randomly generated password for the 'ubuntu' user on first boot. The password is written two places, the console and the serial device. On the console, you will see lines like: {{{
Line 55: Line 96:

=== Advanced use of Images ===
 * command line parameters used by 'cloud-init' and 'uncloud-init'<<BR>>By modifying the kernel command line, you can change the behavior of the 2 programs affect the early boot.
  * ubuntu-pass=[password|random]<<BR>>On first boot, uncloud-init will set the password to be 'password'. If the string provided is literally the string 'random' then a random pass will be created and written to the console.
  * ds=nocloud;[key=val] or ds=nocloud-net;[key=val]
   * s=<seedlocation> | seedfrom=<seedlocation> [default=""]<<BR>>This allows you to set the 'seed location'. The value can be a url of 'file:///' format, or of 'http://' format. If you want to use http or another network based seed, then 'nocloud-net' must be used as the data source, rather than 'nocloud'. meta-data and user-data will be read from <seedlocation>meta-data and <seedlocation>user-data respectively.<<BR>>For example I set up the tiny urls http://tinyurl.com/sm-user-data and http://tinyurl.com/sm-meta-data . These redirect to pages on my hosted system, the tinyurl is only used to make the urls shorter. Then, I can pass boot with a command line like:{{{
 "ro init=/usr/lib/cloud-init/uncloud-init root=LABEL=uec-rootfs ds=nocloud-net;s=http://tinyurl.com/sm- ubuntu-pass=random"
}}} in , and the user-data and meta-data are pulled from the respective URLs. The format of user-data and meta-data is described in cloud-init's documentation [[http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/files/head%3A/doc/examples/seed/|doc/examples/seed]].
   * h=hostname | local-hostname=hostname [default="ubuntuhost"]<<BR>>Set the local hostname for this instance.
   * i=id | instance-id=id [default="nocloud"]<<BR>>This sets the the 'instance-id' for the boot. In EC2 or Eucalyptus, this would be something like 'i-abcdefg' and changes for each instance. The cloud-init code uses 'instance-id' to indicate whether this is the first boot. What this means is that, by default, the constant string 'nocloud' as an instance id will on ever initialize once. If youwant to test initialization again, you would have to remove files in /var/lib/cloud/sem or change this string.
 * boot with kvm '-kernel' command line arguments rather than with the boot floppy: {{{
kvm -drive file=disk.img,if=virtio,boot=on \
   -kernel "${kernel}" \
   -append "root=/dev/vda ro init=/usr/lib/cloud-init/uncloud-init ds=nocloud ubuntu-pass=ubuntu"
}}}

== Machine Consumable Data [query] ==
In order to provide information about what builds are available for download or running on ec2, a 'query' interface is exposed at http://uec-images.ubuntu.com/query . This will allow users of the service to download images or find out the latest ec2 AMIs programmatically.
 * Want to get that first boot again? Easy, just delete the cow disk, create a new one and boot it {{{
$ rm -rf disk.img && qemu-img create -f qcow2 -b ${img} disk.img
$ kvm -fda ${floppy} -drive if=virtio,file=disk.img -boot a
}}}

You can customize the way Ubuntu Cloud Guest images boot under a local KVM instance by passing certain kernel command line variables. This approach enables you to pass custom cloud-init data-sources, set the instance's password, hostname, instance-id ...etc. If that interests you, you can read more about passing [[/KVMKernelOptions|KVM Kernel Options]]

== Ubuntu Cloud Guest images on Local Hypervisor 11.04 (Natty) or 11.10 (Oneiric) ==
Booting from local disk is greatly simplified compared to the above in Natty (11.04) and going forward. The process is [[http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/view/head:/doc/ovf/README|documented in cloud-init's source]].

== Ubuntu Cloud Guest images on 12.04 LTS (Precise) and beyond using NoCloud ==
In 12.04 and later, you can use the "NoCloud" datasource. The cloud-utils package included in 12.10 and later contains a tool '''cloud-localds''' that helps in creating this data.

There is a [[http://ubuntu-smoser.blogspot.com/2013/02/using-ubuntu-cloud-images-without-cloud.html|blog post]] and a [[https://gist.github.com/smoser/4756561|gist]] that describes how to use this. It is copied below.

{{{
## Install a necessary packages
$ sudo apt-get install kvm cloud-utils genisoimage
 
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
$ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
## download the image
$ wget $img_url -O disk.img.dist

## Create a file with some user-data in it
$ cat > my-user-data <<EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
EOF
 
## Convert the compressed qcow file downloaded to a uncompressed qcow2
$ qemu-img convert -O qcow2 disk.img.dist disk.img.orig

## Resize the image to 52G from original image of 2G
$ qemu-img resize disk.img.orig +50G

## create the disk with NoCloud data on it.
$ cloud-localds my-seed.img my-user-data
 
## Create a delta disk to keep our .orig file pristine
$ qemu-img create -f qcow2 -b disk.img.orig disk.img
 
## Boot a kvm
$ kvm -net nic -net user -hda disk.img -hdb my-seed.img -m 512
}}}


<<Anchor(ARMImages)>>
== ARM Images ==

Starting with Oneiric, two different ARM images are being built. Both images have the OMAP kernel installed and are provided in QCOW2 format. The root file-system on both images are identical.

How to identify the images
{{{
oneiric-server-cloudimg-armel-disk1.img: non-bootable
oneiric-server-cloudimg-armel_omap-disk1.img: bootable
}}}

The non-bootable image contains a single partitioned file system.

The bootable image contains two partitions, with the first being a OMAP3/4 bootloader and the second containing the root file system.

==== Conversion to RAW Disk formats ====

To use/mount these images you will need to convert the image into a raw format. To due so:

{{{
qemu-img convert -O raw <DISK>.img <DISK>.raw
}}}

==== QEMU invocation ====

The initial releases of the bootable QCOW2 images will need modification in order to be usable within QEMU, this is due to the installation of Cloud-init. Unlike traditional x86 hardware, Linux on ARM is booted with u-boot. If these images are booted with a meta-data service compatible with Cloud-init, the will work like a normal cloud image.

==== Modify the image ====

  * Install uboot-tools and qemu-kvm packages
  * Convert the image to raw format {{{
qemu-img convert -0 raw <DISK>.img <DISK>.raw
}}}
  * Add the raw disk image via kpartx: {{{
kpartx -a -v <DISK>.raw
}}} Output will look something like: {{{
add map loop0p1 (254:0): 0 144584 linear /dev/loop0 1
add map loop0p2 (254:1): 0 4192965 linear /dev/loop0 144585
}}} In this example, loop0p1 is the boot partition for the image, and the device mapper path is /dev/mapper/loop0p1.
  * Mount the first partition: {{{
mount /dev/mapper/loop0p1 /mnt
}}}
  * Create a new boot.cmd file in /tmp. Populate it with the following {{{
setenv dvimode 1280x720MR-16@60
setenv vram 12MB
setenv bootcmd 'fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80300000 0x81600000'
setenv bootargs console=ttyO2 omapfb.mode=dvi init=/usr/lib/cloud-init/uncloud-init root=LABEL=cloudimg-rootfs rw fixrtc ubuntu-pass=ubuntu ds=nocloud
boot
}}}
  * Compile the boot.cmd to boot.scr{{{
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ubuntu" -d /tmp/boot.cmd /mnt/boot.scr }}}
  * Umount /mnt: {{{
umount /mnt}}}
  * Remove the loop mapping: {{{
kpartx -d /dev/loop0; losetup -d /dev/loop0}}}
  * Boot or burn the image

==== Booting in QEMU ====

To boot these images into QEMU, run:
{{{qemu-system-arm -M beaglexm -drive file=<DISK>.img,if=sd,cache=writeback -nographic}}}



== Customizing Ubuntu Cloud Guest images Boot Sequence with Cloud-Init ==
cloud-init is the Ubuntu package that handles early initialization of a cloud instance. It is installed in the Ubuntu Cloud Guest images and also in the official Ubuntu images available on EC2. Images contain [[CloudInit]] as well as uncloud-init

uncloud-init, is a behind the scenes tool that helps configure Ubuntu Cloud Guest images to run in a local hypervisor environment. uncloud-init helps set a password for user "ubuntu", enables password authentication in sshd configuration and spawns a login tty on the serial console


== Building Your Own Ubuntu Cloud Guest images ==
A reliable build process in place. Current images are built on a 10.04 LTS host from a [[https://code.launchpad.net/~ubuntu-virt/vmbuilder/0.11|0.11 branch]] of [[https://launchpad.net/vmbuilder|vmbuilder]]. The build scripts are available under the [[https://code.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds|automated-ec2-builds]], and published to cloud-images and EC2 using [[https://code.launchpad.net/~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts|ec2-publishing-scripts]].

Read more about [[http://alestic.com/2010/01/ec2-ebs-boot-ubuntu|creating your own image]]

== Machine Consumable Ubuntu Cloud Guest images Availability Data ==
In order to provide information about what builds are available for download or running on ec2, a 'query' interface is exposed at http://cloud-images.ubuntu.com/query . This will allow users of the service to download images or find out the latest ec2 AMIs programmatically.
Line 89: Line 239:
 * The downloadable image data files contain 6 tab delimited fields: {{{
<suite> <build_name> <label> <serial> <arch> <download_path>
maverick server daily 20100819 i386   server/maverick/20100819/maverick-server-uec-i386.tar.gz
}}}
 Download path is relative to "http://uec-images.ubuntu.com/"
 * The downloadable image data files contain 7 tab delimited fields: {{{
<suite> <build_name> <label> <serial> <arch> <download_path> <suggested_name>
maverick server daily 20100826 i386 server/maverick/20100826/maverick-server-uec-i386.tar.gz ubuntu-maverick-daily-i386-server-20100826
}}}
 Download path is relative to "http://cloud-images.ubuntu.com/". Suggested name is the basename that this build would be published as in EC2.

Intro

The term 'Ubuntu Cloud Guest' refers to the Official Ubuntu images that are available at http://cloud-images.ubuntu.com . These images are built by Canonical. They are then registered on EC2, and compressed tarfiles are made also available for download. For using those images on a public cloud such as Amazon EC2, you simply choose an image and launch it. To use those images on a private cloud, or to run the image on a local hypervisor (such as KVM) you would need to download those images and either publish them to your private cloud, or launch them directly on a hypervisor. The following sections explain in more details how to perform each of those actions

Ubuntu Cloud Guest on Amazon EC2 Cloud

In order to start using official Ubuntu images on the public cloud (ex. Amazon EC2), you

  • Choose an Ubuntu release you want to use (Lucid, Maverick, Natty...etc)
  • Get the latest AMI ID corresponding to the release you want to use
  • Launch your chosen image on EC2

Choosing an Ubuntu Release

Choosing the Ubuntu release depends on a lot of factors such as whether or not you would like to launch an LTS image for long term support, or whether you need specific versions of libraries or applications. If in doubt, choose the latest LTS release (currently Trusty 14.04)

Get Ubuntu AMI-ID

As Ubuntu Cloud Guest images are uploaded and registered on the Amazon EC2 cloud, they are referred to as AMI (Amazon Machine Images). Each AMI is a machine template from which you can instantiate new servers. Each AMI has its own unique ID. In order to launch an instance on the EC2 cloud, you first need to locate its ID. The AMI Locator web application can help you quickly locate an AMI ID. Here's how to use it

  • Visit AMI Locator

  • Type a few characters in the search box signifying what you're searching for. For example if you would like to find out the AMI-ID for the latest release of Maverick Meerkat to run on a 64 bit ebs instance in the us-east region, you would search for "mav 64 us-east ebs" or a subset thereof.

ami-locator-small.png

Launch Ubuntu AMI

Ubuntu Cloud Guest on UEC Private Cloud

If you are running your own private UEC cloud, you may wish to publish new Ubuntu Cloud Guest images (as they are made available) to your cloud infrastructure.

Downloading Daily and Released Images

Ubuntu Cloud Guest images are created in two flavors. "Daily" is a daily composed image that provides a fresh but perhaps less tested image. and "Release" that provides regularly updated and well tested images

"Daily" builds are made available for testing and continuous integration. The daily builds are not tested at all. However, the content of the images has already been through the SRU process, so in general the daily builds for stable releases are stable. Quality of daily builds for the development release will vary.

Daily builds are available under http://cloud-images.ubuntu.com/server/<codename> .

Released builds are available under http://cloud-images.ubuntu.com/server/releases/<codename> .

Once you have downloaded a suitable image, you most likely want to publish it to your private cloud, a process called BundlingImages

Ubuntu Cloud Guest images on Local Hypervisor (Maverick)

Images after 10.10 (maverick) can now be run outside of the cloud environment without any difficult setup, and even provide an easy way to provide metadata to the instance! If you would like to run a Ubuntu Cloud Guest image on your local KVM hypervisor, checkout the previous section explaining Downloading Daily and Released Images then untar the image and boot it. Here is an example to make things clearer

  • The Image file name will vary. For this example, it is "maverick-server-uec-amd64.tar.gz".

    $ tarball=maverick-server-uec-amd64.tar.gz
  • Extract the tar file and set some variables names for its contents. Here is an example

    $ contents=${tarball}.contents
    $ tar -Sxvzf ${tarball} | tee "${contents}"
    maverick-server-uec-amd64.img
    maverick-server-uec-amd64-vmlinuz-virtual
    maverick-server-uec-amd64-loader
    maverick-server-uec-amd64-floppy
    README.files
    $ base=$(sed -n 's/.img$//p' "${contents}")
    $ kernel=$(echo ${base}-vmlinuz-*)
    $ floppy=${base}-floppy
    $ img=${base}.img
  • Create a copy on write disk image, based on the disk image we downloaded and boot that image in local kvm

    # make a qcow image just to keep the original pristine
    $ qemu-img create -f qcow2 -b ${img} disk.img
    $ kvm -fda ${floppy} -drive if=virtio,file=disk.img -boot a
  • Get the password for 'ubuntu' and log in
    The default selection in the grub menu will result in a randomly generated password for the 'ubuntu' user on first boot. The password is written two places, the console and the serial device. On the console, you will see lines like:

    [    1.820549] EXT4-fs (sda): re-mounted. Opts: (null)
    ::uncloud-init: settting ubuntu pass = qlnYZTSy
    ::uncloud-init: changing ubuntu user's password!
    ::uncloud-init: enabled console on ttyS0

    The password is also written to the kvm serial console. You can see the kvm serial console by hitting ctrl-alt-3. On first boot, you will see lines like

    ===                                                                             
    ubuntu_pass = PhAKp1kx                                                          
    ===   
  • Want to get that first boot again? Easy, just delete the cow disk, create a new one and boot it

    $ rm -rf disk.img && qemu-img create -f qcow2 -b ${img} disk.img
    $ kvm -fda ${floppy} -drive if=virtio,file=disk.img -boot a

You can customize the way Ubuntu Cloud Guest images boot under a local KVM instance by passing certain kernel command line variables. This approach enables you to pass custom cloud-init data-sources, set the instance's password, hostname, instance-id ...etc. If that interests you, you can read more about passing KVM Kernel Options

Ubuntu Cloud Guest images on Local Hypervisor 11.04 (Natty) or 11.10 (Oneiric)

Booting from local disk is greatly simplified compared to the above in Natty (11.04) and going forward. The process is documented in cloud-init's source.

Ubuntu Cloud Guest images on 12.04 LTS (Precise) and beyond using NoCloud

In 12.04 and later, you can use the "NoCloud" datasource. The cloud-utils package included in 12.10 and later contains a tool cloud-localds that helps in creating this data.

There is a blog post and a gist that describes how to use this. It is copied below.

## Install a necessary packages
$ sudo apt-get install kvm cloud-utils genisoimage
 
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
$ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
## download the image
$ wget $img_url -O disk.img.dist

## Create a file with some user-data in it
$ cat > my-user-data <<EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
EOF
 
## Convert the compressed qcow file downloaded to a uncompressed qcow2
$ qemu-img convert -O qcow2 disk.img.dist disk.img.orig

## Resize the image to 52G from original image of 2G
$ qemu-img resize disk.img.orig +50G

## create the disk with NoCloud data on it.
$ cloud-localds my-seed.img my-user-data
 
## Create a delta disk to keep our .orig file pristine
$ qemu-img create -f qcow2 -b disk.img.orig disk.img
 
## Boot a kvm
$ kvm -net nic -net user -hda disk.img -hdb my-seed.img -m 512

ARM Images

Starting with Oneiric, two different ARM images are being built. Both images have the OMAP kernel installed and are provided in QCOW2 format. The root file-system on both images are identical.

How to identify the images

oneiric-server-cloudimg-armel-disk1.img: non-bootable
oneiric-server-cloudimg-armel_omap-disk1.img: bootable

The non-bootable image contains a single partitioned file system.

The bootable image contains two partitions, with the first being a OMAP3/4 bootloader and the second containing the root file system.

Conversion to RAW Disk formats

To use/mount these images you will need to convert the image into a raw format. To due so:

qemu-img convert -O raw <DISK>.img <DISK>.raw

QEMU invocation

The initial releases of the bootable QCOW2 images will need modification in order to be usable within QEMU, this is due to the installation of Cloud-init. Unlike traditional x86 hardware, Linux on ARM is booted with u-boot. If these images are booted with a meta-data service compatible with Cloud-init, the will work like a normal cloud image.

Modify the image

  • Install uboot-tools and qemu-kvm packages
  • Convert the image to raw format

    qemu-img convert -0 raw <DISK>.img <DISK>.raw
  • Add the raw disk image via kpartx:

    kpartx -a -v <DISK>.raw

    Output will look something like:

    add map loop0p1 (254:0): 0 144584 linear /dev/loop0 1
    add map loop0p2 (254:1): 0 4192965 linear /dev/loop0 144585
    In this example, loop0p1 is the boot partition for the image, and the device mapper path is /dev/mapper/loop0p1.
  • Mount the first partition:

    mount /dev/mapper/loop0p1 /mnt
  • Create a new boot.cmd file in /tmp. Populate it with the following

    setenv dvimode 1280x720MR-16@60
    setenv vram 12MB
    setenv bootcmd 'fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80300000 0x81600000'
    setenv bootargs console=ttyO2 omapfb.mode=dvi init=/usr/lib/cloud-init/uncloud-init root=LABEL=cloudimg-rootfs rw fixrtc ubuntu-pass=ubuntu ds=nocloud
    boot
  • Compile the boot.cmd to boot.scr

    mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ubuntu" -d /tmp/boot.cmd /mnt/boot.scr 
  • Umount /mnt:

    umount /mnt
  • Remove the loop mapping:

    kpartx -d /dev/loop0; losetup -d /dev/loop0
  • Boot or burn the image

Booting in QEMU

To boot these images into QEMU, run: qemu-system-arm -M beaglexm -drive file=<DISK>.img,if=sd,cache=writeback -nographic

Customizing Ubuntu Cloud Guest images Boot Sequence with Cloud-Init

cloud-init is the Ubuntu package that handles early initialization of a cloud instance. It is installed in the Ubuntu Cloud Guest images and also in the official Ubuntu images available on EC2. Images contain CloudInit as well as uncloud-init

uncloud-init, is a behind the scenes tool that helps configure Ubuntu Cloud Guest images to run in a local hypervisor environment. uncloud-init helps set a password for user "ubuntu", enables password authentication in sshd configuration and spawns a login tty on the serial console

Building Your Own Ubuntu Cloud Guest images

A reliable build process in place. Current images are built on a 10.04 LTS host from a 0.11 branch of vmbuilder. The build scripts are available under the automated-ec2-builds, and published to cloud-images and EC2 using ec2-publishing-scripts.

Read more about creating your own image

Machine Consumable Ubuntu Cloud Guest images Availability Data

In order to provide information about what builds are available for download or running on ec2, a 'query' interface is exposed at http://cloud-images.ubuntu.com/query . This will allow users of the service to download images or find out the latest ec2 AMIs programmatically.

The data is laid out as follows:

  • There are 2 files in top level director 'daily.latest.txt' and 'released.latest.txt'. Each of these files contains tab delimited data, with 4 fields per record. daily.latest.txt has information about the daily builds, released.latest.tt about released builds:

       <suite> <build_name> <label>     <serial>
       hardy   server       release     20100128
  • For each record in the top level files another set of files will exist: \
    • File

      Description

      <suite>/<build_name>/daily-dl.txt

      downloadable images data for all daily builds currently available

      <suite>/<build_name>/daily-dl.current.txt

      downloadable images data for the most recent daily build

      <suite>/<build_name>/released-dl.txt

      downloadable images data for all released builds

      <suite>/<build_name>/released-dl.current.txt

      downloadable images data for the most recent released build

      <suite>/<build_name>/daily.txt

      registered ec2 AMI data for all daily builds ever

      <suite>/<build_name>/daily.current.txt

      registered ec2 AMI data for the most recent daily build

      <suite>/<build_name>/released.txt

      registered ec2 AMI data for all released builds

      <suite>/<build_name>/released.current.txt

      registered ec2 AMI data for the most recent released built

  • The downloadable image data files contain 7 tab delimited fields:

    <suite>  <build_name> <label> <serial> <arch> <download_path> <suggested_name>
    maverick server       daily   20100826 i386   server/maverick/20100826/maverick-server-uec-i386.tar.gz  ubuntu-maverick-daily-i386-server-20100826

    Download path is relative to "http://cloud-images.ubuntu.com/". Suggested name is the basename that this build would be published as in EC2.

  • The registered ec2 AMI data contain 10 tab delimited fields:

    <suite>  <build_name> <label> <serial>    <root-store>   <arch> <region>  <ami>         <aki>        <ari>
    maverick server       alpha3  20100803.2  instance-store i386   us-west-1 ami-ebdc8dae  aki-99a0f1dc <ari>


    For many images, there may be no ari registered, so the field may be blank.

UEC/Images (last edited 2014-11-20 00:03:45 by 175)