- Member Success Stories (
-   -   Success: live cd and flash disk with all the tools I needed how I want it (

Jack Sparrow 12-23-2010 01:16 PM

Success: live cd and flash disk with all the tools I needed how I want it
I have used linux for around the past 10 years now, and as my only operating system now for around 3 months (Ubuntu desktop, linux smart phone). I LOVE it.

For the past two weeks I've been screwing around with live CDs, specificly getting all the tools I need on one, and taking off everything else that would slow it down. Before I start, making one of these is vastly EASIER if you have a linux desktop system to make one it.

The seemingly easy way is mowzying on down to, selecting a few packages you want. without ranting too much, slax is a pain the the ass. I gave up after a while.

Assuming your running Ubuntu, We will use the ubuntu customization kit:

Lets start with UCK we use to build this. NOTE, I also added gfxboot-dev, because this has been a requirement since whoever maintains the gfxboot package decided to split gfxboot into gfxboot and gfxboot-dev. The tools needed by UCK are in gfxboot-dev but the dependencies never got updated. So if you don't install it, the program will run, but all your builds will fail.

apt-get install uck gfxboot-dev
NOW, since you've used apt, you have all the dependencies in place. version 2.4.0 is needed for Ubuntu 10.10, due to some bugs in 2.2.x. As of this writing it is NOT in the repositories. Go downloaded it manually.

Next you need an .iso to use as a start point. I recommend lubuntu because its lightweight and far quicker, but still runs the GTK2+ libraries.

Now, run UCK.

It asks you which language you want to use. Really pick the one you use most and leave the rest unselected. Lang packs take up space.

It will also ask you if you want to customize the CD, say yes, and it asks if you want to delete the windows files say yes.

Now if will give you three options, a command line in a chroot of your CD, editing the packages which opens synaptic package manager, and continue building, which builds the CD.

start by adding all the packages you need with synaptic, and removing the ones you don't(remember 700 megabyte limit on CDs).

Now open up the command line. Some tools don't have .deb installers, so if you want to put anything else on the disk, this is how.

the chroot is located in:
so move anything you want inside there, but make sure your root to do it. then from inside the chroot, you can install software.

Truecrypt for example is installed this way. Basicly

tar -zxvf truecrypt*.tar.gz
rm truecrypt*.tar.gz
sudo cp truecrypt* /home/USER/tmp/*root

now from inside the command prompt the installer gives you(chroot), type

chown root:root truecrypt*

and BAM it installs. you can now delete the installer.

a few other things, as some programs need to run in root in ubuntu, like wireshark. Again its real simple, but if you don't, no interfaces show up.


cd /usr/bin
mv wireshark wireshark-bin
echo gksu wireshark-bin > wireshark
chmod 755 wireshark

then before you exit the command line, REMEMBER to do the following.

apt-get udpate
apt-get upgrade
apt-get autoremove
apt-get autoclean

now exit, select option 3 and build your CD. If you forgot something, you can use your already built CD as a start point for the next one. I am sure any Debian based distro that relies on apt and dpkg will work.

At this point, you've already burned a CD, but you want more, a CD is great, but they are still rather bulky, and prone to breakage.

SO, we take your newly minted custom CD and we make it boot of a flash disk. The first thing to do, is find a suitable flash disk. make sure it works, its either empty, or has nothing you don't mind erasing on it. Oh, it should be at least two gigabytes.

I like to do two partitions, one for the system to boot, and another for data. a little more convienant and secure. you can use either the Disk Utility in Ubuntu, or fdisk to partition your hd the way you want it. MAKE SURE YOU USE EXT2 for the boot partition. journaling file systems and flash memory is a real bad idea, its unnecessary slow, and can damage your drive.(or cause premature death).


apt-get install extlinux
- bootloader you'll need later.
Adapted from here:

Re-partition and format the USB drive. Ensure that the first partition is at least 1GiB in size and marked bootable. Any remaining space can be divided as necessary. When formatting choose ext2, do not put a journaling filesystem onto the USB device.

if you made the partitions already in gnome, they are automaticly formatted and you can skip this.

cfdisk /dev/sda
mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/sda2

careful, this is rather old, and /dev/sda1 is the name of the HD you boot off if you have a SATA drive. find out which drive your flash disk is. Its going to be /dev/sd something or another, most likely b through g. subtitute all mention of /dev/sda with this.

for YOURCD.iso use the name of the .iso you made in the first half, or any other .iso of a bootable linux cd should work.

Mount up the fresh partition and the ISO image.

mkdir /mnt/usb_disc
mount /dev/sda1 /mnt/usb_disc
mkdir /mnt/live_cd
mount -o loop /tmp/YOURCD.iso /mnt/live_cd
cd /mnt/live_cd/
cp -aR casper disctree dists install pool preseed .disk /mnt/usb_disc

There is no need to copy the isolinux informations as extlinux will be used.

cd /
mkdir /mnt/usb_disc/extlinux
extlinux -i /mnt/usb_disc/extlinux

OK, here is the tricky part. there is no extlinux.conf by default. make one, copypaste from the line below.

Now edit the config file /mnt/usb_disc/extlinux/extlinux.conf to read something like this.

DEFAULT /casper/vmlinuz
APPEND  file=preseed/kubuntu.seed boot=casper initrd=/casper/initrd.gz ramdisk_size=1048576 root=/dev/ram0 rw quiet splash --

next, where it says initrd.gz change that to initrd.lz

then you are done, unmount everything, and your thumb drive boots your custom installation.

All times are GMT -5. The time now is 07:00 PM.