2007-07-27

Working on an Amazon EC2 AMI for the Maemo SDK (scratchbox on Ubuntu)

I'll get into why I want to create this Amazon EC2 AMI thing later, but I thought I'd get information out there on a problem I'm having. Tve did a nice write-up on RightScale on bundling-up an ubuntu EC2 instance. This is a really helpful write-up, but I get a shell script error and a hang when I try to bundle my Ubuntu image.

root@domU-...:~# ec2-bundle-vol -d /mnt -k ~root/pk-....pem -c ~root/cert-....pem -u ...
Copying / into the image file /mnt/image...
Excluding:
/sys
/var/lock
/dev/shm
/proc
/dev/pts
/proc/sys/fs/binfmt_misc
/var/run
/dev
/dev
/media
/mnt
/proc
/sys
/mnt/image
/mnt/img-mnt
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.003492 seconds, 300 MB/s
mke2fs 1.39 (29-May-2006)
warning: 256 blocks unused.

Bundling image file...
sh: Syntax error: Bad substitution
The script keeps running. I don't know Ruby well, but the script seems to be stuck in a shell call to 'openssl'. This seems to occur in bundle.rb line 51. It looks like the 'tar' call on line 57 that is meant to feed the pipe being read by the running 'openssl' died, but I don't see where the "Bad substitution" might be.

Tve didn't have a place to make a comment on the blog entry. Time to debug...

Quick update on when I canceled the process (need to think if this confirms or denies what I was thinking):
sh: Syntax error: Bad substitution
sh: cannot open /tmp/bundleimage-pipe1: Interrupted system call
error executing tar -chS -C /mnt image | tee /tmp/bundleimage-pipe1 |gzip | openssl enc -e -aes-128-cbc -K ... -iv ... > /mnt/image.tar.gz.enc; for i in ${PIPESTATUS[@]}; do [ $i == 0 ] || exit $i; done, exit status code 2
ec2-bundle-vol failed
...need to take a break and get back to my real work.

Update #2: The problem turned out to be assumption in Amazon's Ruby script that 'bash' would be the shell executed by default. The answer was within a script found on the Amazon developer's forum. I've created my first image and I'll be hosting my script using Google's open source code repository when it is done at http://code.google.com/p/maemo-sdk-image/.