Customizing Ubuntu Live CD 6.06.1

The word came down last week that I was to prepare a demo for yesterday’s Flashforward keynote. They gave me an IBM ThinkPad laptop and told me to install Linux and the current Flash Player onto the machine. I had a better brainstorm– something I keep hearing about called a live CD. So I set out to make my own custom live CD that was already equipped with Flash Player 9. The final CD was able to boot on both an IBM ThinkPad and an Intel-based MacBook and was a much better answer to the question, “What if we need to run the demo on a different machine instead?”

Ubuntu live CD with Flash Player 9

It took me a little while to customize the live CD. Previously, my only encounter with live CDs had only been a “Remastering Knoppix” session at a Linux user group. I couldn’t find good instructions for doing the same when I needed, particularly on a different type of system (Gentoo in my case). As a public service, I thought I would post the hackish instructions that I pieced together from various sources which led me to create the perfect live CD for this demo. The basic idea is to:

  1. unpack the ISO-9660 filesystem
  2. unpack the root squash filesystem
  3. modify the root squash filesystem
  4. re-pack the root squash filesystem
  5. re-pack ISO-9660 filesystem

So it’s not unlike peeling an onion, deep frying it, and putting it back together– not a perfect or elegant process but the end result is much tastier! These are the technical steps:

  • get the “Dapper Drake” Ubuntu 6.06.1 Live CD ISO image
  • mount the ISO image as part of the filesystem
  • copy the ISO contents into a temporary directory
    • the stock live CD comes with Windows installers for various free software packages like Firefox and Thunderbird; if you don’t need these on your live CD, you can save over 30 MB by deleting the programs/ directory
  • mount casper/filesystem.squashfs as part of the filesystem
    • use Squashfs and compile the kernel stuff
    • alternatively, Gentoo kernels seem to already have the squashfs stuff patched in
  • copy the contents into a temporary directory; do this as root and with -a option for a correct copy
  • make any necessary modifications to the root filesystem (in my case, this simply means copying into the correct directory)
  • whittle away any components you don’t strictly need for a demo live CD (OpenOffice, with a 200 MB tree, is a good candidate)
  • rebuild root filesystem; run as root: ‘mksquashfs squashfs-root filesystem.squashfs’
  • overwrite the old casper/filesystem.squashfs file with the newly created one
  • build burnable, bootable ISO: ‘mkisofs -o ubuntu-6.06.1-desktop-i386-custom.iso -b “isolinux/isolinux.bin” -c “isolinux/” -no-emul-boot -boot-load-size 4 -boot-info-table -cache-inodes -r -J -l ubuntu-6.06.1-desktop-i386′
  • test: ‘qemu -cdrom ubuntu-6.06.1-desktop-i386-custom.iso -boot d -m 256′