Wednesday, August 14, 2013

lxc with fast cloning via overlayfs and userdata via clone hooks

Serge Hallyn and St├ęphane Graber made some really nice improvements to LXC in the last few months.  These include:
  • user namespaces, which will bring us secure containers in 14.04 and the ability to safely run containers without root. 
  • a library with bindings for C, go and python3.
  • cloning with overlayfs
  • hooks executed at clone time.
I had previously worked with Ben Howard on the 'ubuntu cloud' template, and I just finished some updates to it that take advantage of overlayfs and clone hooks to provide a great environment to use or test cloud-init.

Previously the ubuntu cloud template (which downloads a cloud image to create a container) allowed the user to specify userdata or public keys at container creation time.  The change was really just to move the container customization code to a clone hook.

Thanks to the daily build ppa, you can do this on any release from 12.04 to 13.10.

Hopefully the example below explains this better.  The times reported are from my Thinkpad X120e, which is a netbook class cpu and slow disk.  Times clearly will vary, and these are not meant to be scientific results.
If you do not see the embedded file below, please read the remainder of this post in the gist on github.

Tuesday, July 23, 2013

Using Ubuntu cloud images on VirtualBox

A few months ago, I wrote an article on "Using Ubuntu cloud-images without a cloud".  That article showed how to do this with kvm.  Virtualbox is another virtualiztion technology that is especially popular on Mac and Windows.  So, I figured I'd give the same basic article a try, but using virtualbox rather than kvm.

I used 'virtualboxmanage' and 'virtualbox' here, but I'm sure the same can be accomplished via the virtuabox gui, and probably similar commands to do the same thing on Mac/OSX or windows.

So, below is roughly the same thing as the kvm post but with virtualbox.  Also to verify function, I did this on Ubuntu 12.04 host with Ubuntu 12.04 guest, but later versions should also work.

Monday, February 11, 2013

Using Ubuntu cloud-images without a cloud

Since sometime in early 2009, we've put effort into building the Ubuntu cloud images and making them useful as "cloud images". From the beginning, they supported use as an instance on a cloud platform. Initially that was limited to EC2 and Eucalyptus, but over time, we've extended the "Data Sources" that the images support.

A "Data Source" to cloud-init provides 2 essential bits of information that turn a generic cloud-image into a cloud instance that is actually usable to its creator. Those are:
  • public ssh key
  • user-data
Without these, the cloud image cannot even be logged into.

Very early on it felt like we should have a way to use these images outside of a cloud. They were essentially ready-to-use installations of Ubuntu Server that allow you to bypass installation. In 11.04 we added the OVF as a data source and a tool in cloud-init's source tree for creating a OVF ISO Transport that cloud-init would read data from. It wasn't until 12.04 that we improved the "NoCloud" data source to make this even easier.

Available in cloud-utils, and packaged in Ubuntu 12.10 is a utility named 'cloud-localds'. This makes it trivial to create a "local datasource" that the cloud-images will then use to get the ssh key and/or user-data described above.

After boot, you should see a login prompt that you can log into with 'ubuntu' and 'passw0rd' as specified by the user-data provided.

Some notes about the above:
  •  None of the commands other than 'apt-get install' require root.
  •  The 2 qemu-img commands are not strictly necessary. 
    • The 'convert' converts the compressed qcow2 disk image as downloaded to an uncompressed version.  If you don't do this the image will still boot, but reads will go decompression.
    • The 'create' creates a new qcow2 delta image backed by 'disk1.img.orig'. It is not necessary, but useful to keep the '.orig' file pristine. All writes in the kvm instance will go to the disk.img file.
  • libvirt, different kvm networking or disk could have been used. The kvm command above is just the simplest for demonstration. (I'm a big fan of the '-curses' option to kvm.)
  • In the kvm command above, you'll need to hit 'ctrl-alt-3' to see kernel boot messages and boot progress. That is because the cloud images by default send console output to the first serial device, that a cloud provider is likely to log.
  • There is no default password in the Ubuntu images. The password was set by the user-data provided.
The content of 'my-user-data' can actually be anything that cloud-init supports as user-data.  So any custom user-data you have can be used (or developed) in this way.

Wednesday, January 4, 2012

$40 mp3 player with wifi, speaker, linux support (palm pixi plus)

For almost 4 years I have used a mp3 player from Creative Labs named "ZEN Stone Plus with built-in speaker". It was used it to play music for our toddler all night long, nearly every night.

It was an absolutely wonderful product. Battery life via rechargeable battery was excellent, it was small enough to forget about in your pocket, and the speaker was sufficient for what we needed

The only deficiency in my opinion was that it could not play music while plugged into AC power. That meant that a.) the battery would have to last the 10+ hours every night and b.) we had to plug it into AC power every morning to charge it. In the end, it was the latter that caused me to need to replace it. After probably 1000+ plug-in and remove (many by a child under 5 years old) the pins in the USB connection eventually failed.

If you're looking for a portable MP3 player with a built-in speaker, your options are very few. The Ipod Touch (and Iphone) are perfectly good solutions, but come a hefty price tag even used. So, I had to get creative.

I'd seen the Palm Pixi appear on a couple "deal-a-day" websites at the $30 price range, and that lead me to consider the Palm Pixi Plus. The Pixi Plus has the following features that made it look *very* tempting:

  • 8GB storage
  • Internal Speaker
  • wifi
  • web browser
  • GPS
  • Camera
  • Touch screen and physical keyboard
  • can play music while charging
  • runs linux! (just geeky)
  • open development platform

However, I googling left me unsure about a couple things:

  • Could I use the pixi's wifi without first activating it with some carrier? I had no interest in a phone, or a monthly bill. It did seem that worst case, I could activate on a pay-as-you-go provider and get going for probably less than $10 total.
  • If I could manage to avoid activation, could I still have access to the Palm WebOS Store? Having an "App Store" was an unnecessary upgrade from the zen stone we had before, but sure would be nice.

In the end, the answer to each of the above questions was 'Yes'. I now have a MP3 player with a builtin speaker, that also has all the functions generally associated with a smart phone (see above). I'm really happy with it. It cost me $40 shipped in 2 days (I do have amazon prime, so total cost may be a little bit more). The only two issues at the moment are:

  • Getting it plugged in for charge is a bit of a pain, and it seems to me that likely the thing that will end up failing is that connection, because its not 100% trivial (and remember, toddlers/young kids are using it). There is, however, a $15 solution for that. I've not purchased it yet, so I'm not 100% certain, but it looks like I can get a Touchstone Palm Pixi Charging Dock and Palm Pixi Touchstone Cover shipped for under $10.
  • The music player stops somewhere after 2 hours or so when its on repeat of a single song. Obviously this is not an issue for many people, but it affects my use case.

In Summary, if you think an 8GB mp3 player with GPS, speaker, camera would be a generally cool toy for $40, then buy one today. I'm really happy with this one. I'll try to write another article soon that describes how to use Meta Doctor to flash with activation disabled and then run the first use program to set up a profile.

Thursday, November 17, 2011

Chuck sightings

Chuck loves the Red Wings!




Chuck has a 4 year old

Monday, August 29, 2011

RFC: anyone using vmdk or ovf files from cloud-images?

Friday I posted the following on ec2ubuntu and ubuntu-cloud mailing lists. I'm posting here in an effort to reach a larger audience.

If you are using the OVF files or VMDK files, please respond.

Date: Fri, 26 Aug 2011 16:34:41
From: Scott Moser
Subject: Anyone using the .ovf and/or .vmdk files on cloud-images?

Hey all,

   Is anyone using the .vmdk or .ovf files on
http://cloud-images.ubuntu.com [1] ?

   In the 11.04 cycle, I started building .ovf files with corresponding
.vmdk images.  The goal of this was to make Ubuntu available for use via
software that supported importing OVF.
   I chose to to create the disk as VMDK formated images rather than a
more open-source friendly format such as qcow.   The OVF file and
associated disk image is consumable by both vmware tools and by
VirtualBox.  There are no OVF consumers that I'm aware of that would
function with a qcow (or even 'raw') disk image.  I feel compelled to also
mention that this format of vmdk (compressed) is not supported by qemu-img
or kvm.
   Since having an OVF that could not be used by any software is not
significantly more useful than not having an OVF, we went with vmdk.

   Largely prompted by the interest in providing a download format that is
ideal for OpenStack users [2], I am re-considering my decision.  I would
like to avoid adding another full disk image format to the output of the
build scripts.  As a result I'm thinking about replacing the .vmdk images
with compressed qcow images and updating the OVF files to reference those.

   The reason behind not wanting to just add yet another deliverable is
that more downloads are confusing, and disk space is not necessarily free.
If I can drop a deliverable not used by anyone, then I'd like to do that.

   So, would anyone object to the removal of .vmdk files from
cloud-images?  Is anyone using these that could not just as easily use
qcow2 formated images?

   Thanks,
   Scott

--
[1] http://cloud-images.ubuntu.com/server/oneiric/current/
[2] https://bugs.launchpad.net/ubuntu/+bug/833265

Tuesday, August 9, 2011

Amazon issues with EBS affect Ubuntu images in the EU-WEST region

Note: This blog post has been updated in-place.

We have received information from Amazon that the EBS snapshots for our released 10.04 images from 20110719 were not affected (ami-5c417128 and ami-52417126). It seems that an api issue incorrectly marked them as such. It was an error in our logic that associated snapshot-ids with amis that gave us the incorrect output. The only Ubuntu images that were affected were old daily builds and milestone releases. If you are interested in reading the original message, please do so on the Ubuntu cloud-announce mailing list archives.

We received this morning an automated email[1] from Amazon informing us of possible loss of data in EBS snapshots on the EU-WEST-1 region. Our engineering team immediately started an assessment of the damages this might have caused to the EBS images that we publish for our users. We are working with Amazon to re-mediate customer impact and prevent any future outages.

A number of non-current daily build and old alpha or beta images have been affected, but we hope that no one would have been using these images for production use; we are not planning corrective actions for these images. You can see the full list of AMIs affected at http://paste.ubuntu.com/662210/.

To have this type of announcements sent to your email directly, please subscribe to our ubuntu-cloud-announce mailing list at https://lists.ubuntu.com/mailman/listinfo/ubuntu-cloud-announce..

Our support services are available to help customers of the Ubuntu Advantage Cloud Guest program. Details about this program can be found at http://www.canonical.com/enterprise-services/ubuntu-advantage/cloud

[1] Email received from Amazon on Aug 9 2011 at 9:11 UTC


Hello,

We've discovered an error in the Amazon EBS software that cleans up unused snapshots. This has affected at least one of your snapshots in the EU-West Region.

During a recent run of this EBS software in the EU-West Region, one or more blocks in a number of EBS snapshots were incorrectly deleted. The root cause was a software error that caused the snapshot references to a subset of blocks to be missed during the reference counting process. This process compares the blocks scheduled for deletion to the blocks referenced in customer snapshots. As a result of the software error, the EBS snapshot management system in the EU-West Region incorrectly thought some of the blocks were no longer being used and deleted them. We've addressed the error in the EBS snapshot system to prevent it from recurring.

We have now disabled all of your snapshots that contain these missing blocks. You can determine which of your snapshots were affected via the AWS Management Console or the DescribeSnapshots API call. The status for any affected snapshots will be shown as "error."

We have created copies of your affected snapshots where we've replaced the missing blocks with empty blocks. You can create a new volume from these snapshot copies and run a recovery tool on it (e.g. a file system recovery tool like fsck); in some cases this may restore normal volume operation. These snapshots can be identified via the snapshot Description field which you can see on the AWS Management Console or via the DescribeSnapshots API call. The Description field contains "Recovery Snapshot snap-xxxx" where snap-xxx is the id of the affected snapshot. Alternately, if you have any older or more recent snapshots that were unaffected, you will be able to create a volume from those snapshots without error. For additional questions, you may open a case in our Support Center: https://aws.amazon.com/support/createCase

We apologize for any potential impact this might have on your applications.

Sincerely,
AWS Developer Support

This message was produced and distributed by Amazon Web Services LLC, 410 Terry Avenue North, Seattle, Washington 98109-5210