How-To: Customize your Ubuntu Live CD

2 minute read

Live CD are great, they let you try out a distribution without installing it. They allow you to run your favorite distribution on any computer and on the top of this, they become handy to recover a system.

Ubuntu live CD is already packed up with some pretty nifty software that allow you to do pretty much everything with the Live CD, but still, they might be some software you don’t need that are include with it or, some software you need might be missing.

Another Pro for this is that by customizing your image, you will be able to install

This tutorial will show the steps to follow in order to customize an Ubuntu Live CD to your need by removing some component and adding some others.

During this tutorial, we are going to remaster our Ubuntu Gutsy Gibbon 7.10 Live CD with the following spec:

  • remove non english language pack
  • Update the softwares release shiiped in the live CD
  • Enable universe and multiverse repository
  • Include divx, mp3 support, realplayer ….
  • Include ndiswrapper support
  • Add Firefox flash-nonfree plugin, add skype.
  • Add some network troubleshooting tools: traceroute, wireshark, kismet…

The resulting image will be bigger that 800M, so it won’t fit on a CD, but will be fine on a DVD.

1. Preparing the host

First of all, we need to get the current Gutsy Gibbon Live CD image and store it let say on ~/Desktop , also, we will need to install an extra piece of software to rebuild our gutsy live CD’s squashfs:

$ sudo apt-get install squashfs-tools chroot

Now let’s get started by setting up our working environment. First, we are going to mount the iso under /tmp/livecd:

$ mkdir /tmp/livecd
$ sudo mount -o loop ~/Desktop/ubuntu-7.10-desktop-i386.iso /tmp/livecd

Then create a directory containing our future CD image (cd) in our working directory (~/livecd) and copy all the CD content but casper/filesystem.squashfs in our ~/livecd/cd directory:

$ mkdir ~/livecd
$ mkdir ~/livecd/cd
$ rsync --exclude=/casper/filesystem.squashfs -a /tmp/livecd/ ~/livecd/cd

This copy all but the squashfs file, which is the compressed file containing our live CD filesystem.

Now we need to mount casper/filesystem.squashfs onto a directory called ~/livecd/squashfs in order to copy its content in a directory where we are going to edit our live CD filesystem: ~/livecd/custom

$ mkdir ~/livecd/squashfs
$ mkdir ~/livecd/custom
$ sudo modprobe squashfs
$ sudo mount -t squashfs -o loop /tmp/livecd/casper/filesystem.squashfs ~/livecd/squashfs/
$ sudo cp -a ~/livecd/squashfs/* ~/livecd/custom

And finally, let copy /etc/resolv.conf and /etc/hosts to our ~/livecd/custom/etc so we will be able to access network from within the image we are going to customize (through chroot):

$ sudo cp /etc/resolv.conf /etc/hosts ~/livecd/custom/etc/

2. Getting into our future image:

In order to customize the image, we will chroot into ~/livecd/custom directory, mount some necessary pseudo-filesystem (/proc and /sys). From there, we will be able to customize our Live CD.

$ sudo chroot ~/livecd/custom
# mount -t proc none /proc/
# mount -t sysfs none /sys/
# export HOME=/root

Now we are ready, let’s customize….