CirrOS is a a trimmed-down OS that has been developed to run on cloud environments. When deployed on Eucalyptus clouds, CirrOS is very effective in confirming the clouds have been set up to provide instance networking, and instance services (metadata and userdata – similar to whats provided on AWS). Because its seen as being so helpful to cloud administrators, Eucalyptus added both 32 and 64 bit CirrOS images to eustore. This blog entry will cover how to use eustore to bundle, upload and register the CirrOS image, and how to use it to test out instance services on a Eucalyptus cloud.
Before discussing how to use CirrOS on Eucalyptus for instance debugging, I would like to thank the following people:
- Victor Iglesias – Quality Engineer at Eucalyptus Systems, Inc – for introducing me to CirrOS.
- Scott Moser – Ubuntu Server Technical Lead at Canonical – for creating CirrOS, along with other great cloud tools like Cloud-Init.
Deploying CirrOS on Eucalyptus
As a cloud administrator, adding CirrOS is relatively straight-forward when using eustore. To start out, make sure the latest version of euca2ools has been installed. After downloading and sourcing the cloud administrator (i.e. admin user of the eucalyptus account) credentials, use eustore-describe-images to discover the CirrOS images on emis.eucalyptus.com:
$ eustore-describe-images | grep cirros 4001243952 cirros x86_64 experimental-images kvm CirrOS x86-64, Tiny image used for testing - root user login 1765979475 cirros i386 experimental-images kvm CirrOS i386, Tiny image used for testing - cirros user login 0300949733 cirros x86_64 experimental-images kvm CirrOS x86_64, Tiny image used for testing - cirros user login
To bundle, upload and register a CirrOS image, choose the image of your choice, and use eustore-install-image. For example:
$ eustore-install-image -i 0300949733 -b cirros-0.3.1-x86_64 \ --hypervisor kvm -s "CirrOS 0.3.1 - x86_64"
The image is now ready to be used on your Eucalyptus cloud. Creating a keypair with euca-create-keypair:
$ euca-create-keypair euca-admin > euca-admin.priv
Use euca-authorize to allow SSH traffic to the instance.
$ euca-authorize -P tcp -p 22 \ -s 0.0.0.0/0 default
Next, launch the CirrOS image using euca-run-instances:
$ euca-run-instances -k euca-admin \ -t m1.medium emi-2611389B
After the instance has been launched successfully, lets look at some of the features of CirrOS that helps with troubleshooting instances.
Instance Status Checks in CirrOS
CirrOS provides great kernel messages when booting. Not only does it show the boot sequence and discovery of devices, but it also shows information regarding network information and status of the instance userdata and metadata services. To view this information, use euca-get-console-output on the instance based off the CirrOS image. For example:
$ euca-get-console-output i-B57B4273 i-B57B4273 2014-02-03T04:25:08.535Z ^[[1;256r^[[256;256H^[[6n Google, Inc. Serial Graphics Adapter 12/07/11 SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (email@example.com) Wed Dec 7 17:04:47 UTC 2011 Term: 80x24 4 0 SeaBIOS (version seabios-0.6.1.2-26.el6) ........ Sending select for 172.17.125.24... Lease of 172.17.125.24 obtained, lease time 86400 deleting routers adding dns 10.104.1.216 adding dns 10.1.1.254 cirros-ds 'net' up at 0.68 checking http://169.254.169.254/2009-04-04/instance-id successful after 1/20 tries: up 0.69. iid=i-B57B4273 failed to get http://169.254.169.254/2009-04-04/user-data warning: no ec2 metadata for user-data found datasource (ec2, net) Starting dropbear sshd: generating rsa key... generating dsa key... OK /run/cirros/datasource/data/user-data was not '#!' or executable === network info === if-info: lo,up,127.0.0.1,8,::1 if-info: eth0,up,172.17.125.24,27,fe80::d20d:b5ff:fe7b:4273 ip-route:default via 172.17.125.1 dev eth0 ip-route:172.17.125.0/27 dev eth0 src 172.17.125.24 === datasource: ec2 net === instance-id: i-B57B4273 name: N/A availability-zone: LayinDaSmackDown local-hostname: euca-172-17-125-24.eucalyptus.internal launch-index: 0 ......
As viewed from the output, it provides some of the metadata information of the instance. Because there was no userdata passed when launching the instance, the following error is seen:
/run/cirros/datasource/data/user-data was not '#!' or executable
To see all the metadata provided to the instance, SSH into the instance and run ‘ec2metadata':
$ ssh -i admin-creds/euca-admin.priv firstname.lastname@example.org The authenticity of host 'euca-10-104-7-11.eucalyptus.euca-hasp.eucalyptus-systems.com (10.104.7.11)' can't be established. RSA key fingerprint is ae:3a:3f:4d:fe:a2:ab:a6:8d:0c:56:3f:18:93:d1:f9. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'euca-10-104-7-11.eucalyptus.euca-hasp.eucalyptus-systems.com,10.104.7.11' (RSA) to the list of known hosts. $ ec2metadata ami-id: emi-2611389B ami-launch-index: 0 ami-manifest-path: cirros-0.3.1-x86_64/cirros-0.3.1-x86_64-rootfs.img.manifest.xml block-device-mapping/ami: sda1 block-device-mapping/emi: sda1 block-device-mapping/ephemeral: sda2 block-device-mapping/ephemeral0: sda2 block-device-mapping/root: /dev/sda1 block-device-mapping/swap: sda3 hostname: euca-172-17-125-24.eucalyptus.internal instance-id: i-B57B4273 instance-type: m1.small kernel-id: eki-37D335EF local-hostname: euca-172-17-125-24.eucalyptus.internal local-ipv4: 172.17.125.24 mac: D0:0D:B5:7B:42:73 placement/availability-zone: LayinDaSmackDown public-hostname: euca-10-104-7-11.eucalyptus.euca-hasp.eucalyptus-systems.com public-ipv4: 10.104.7.11 public-keys/0: openssh-key ramdisk-id: eri-487537CB reservation-id: r-87584400 security-groups: default
Thats it! As demonstrated, CirrOS helps cloud administrators test networking and instance services for instances relatively quickly. Using CirrOS helps narrow down if there is a Eucalyptus cloud deployment issue versus an image issue. If you feel really adventurous, Scott has provided some great instructions on how cloud administrators can build their own CirrOS image by hand. Hope this helps. Enjoy!