Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

sponsors


User login

Poll

Syndicate

Syndicate content


Tips


How-To: Customize your Ubuntu Live CD

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....


This almost works perfectly but for one thing..

Once one does all the updates, removal of the old kernels and packages.


How to change packages that are installed?

This works wonderfully, thanks for the detailed guide.

However, when you create a customized boot CD and then decide to install Ubuntu to disk, you end up again with the standard packages again :(.

Is there a way to modify this so that the installed version will all the extra packages as well?

Did you run the first

Did you run the first command block of chapter 5?
As far as I remember, this should have take care of adding the new packages.
The block should actually be something like:

$ chmod +w ~/livecd/cd/casper/filesystem.manifest
$ sudo chroot ~/livecd/custom dpkg-query -W --showformat='${Package} ${Version}\n' | grep -v deinstall> ~/livecd/cd/casper/filesystem.manifest
$ sudo egrep -v '^libdebian-installer4|^casper|^os-prober|^ubiquity|^ubuntu-live|^user-setup' ~/livecd/cd/casper/filesystem.manifest > ~/livecd/cd/casper/filesystem.manifest-desktop

The idea is that any packages which is not listed in both filesystem.manifest and filesystem.manifest-desktop will not be included in the install. Thus, if your filesystem.manifest was not regenerated, your new packages will not be installed.
Debuntu

I've tried this guide both

I've tried this guide both with Gutsy and Feisty but damn, I'm stuck to apt-get update section... I've tried dozens of repos but with no avail, I can surf from the linux box via firefox but they're not solved by apt-get and I'm not able to install anything, not even vmware-server that is my primary goal to embed into live CD

BTW, I tried to go on without installing anything; even with copy-n-paste I'm getting error with the line

"sudo cp ~/livecd/cd/casper/filesystem.manifest ~/livecd/cd/casper/filesystem.manifest-desktop"

Rob

How to customize menus and backgroud

Hi, great guide!

I have a question: how to customize Gnome menus and backgroud (and panel, etc...).

Accounts settings from let's say Skype can be copied to /etc/skel? I mean, the whole .Skype directory could be copied there?

Should do it

Yep, copying the data to /etc/skel should do the trick.

Debuntu

What about Gnome settings

What about Gnome settings?
In my home directory I have hree directories:
.gnome/
.gnome2/
.gnome2_private/

I customized panel - where are the settings?