Advertisment

Customize a Live Distro

author-image
PCQ Bureau
New Update

Live Linux distros have now become an integral part of the Linux story. The most effective use of these distros is in community (cluster) computing. Just boot a networked PC with a cluster-aware Linux distro and you have one more processing node added. An equally compelling use is in rescuing PCs that have crashed or have been a victim of any kind of an attack.

Advertisment

If there was a limitation to live distros, then it was that you couldn’t add software that you wanted to the distro. Now, there is a way out for this too. Slax is a live distro based on Slakware Linux and comes with some tools (basically shell scripts) that make it possible for you to customize it and add new modules to it, or even create a new one with all your favorite software. 

In this article we will see how you can install a new module (software) to the existing Slax Live CD ISO and create a new one. To test this, we will call Cinelerra–a video-editing package (for more on it, read Rendering Video on a Cluster, page 26, October 2003 issue of PCQuest)–into the live CD. For this you will need a PC running Linux, preferably PCQLinux 2004 or PCQLinux 8.0, and the Slax ISO image, which is there on this month’s PCQXtreme CD and, of course, a CD writer to burn the final ISO image.

Getting started



First, copy the 130 MB ISO image of Slax to your home directory. Now create a new folder, say /slax and mount the ISO on it , as shown below.

Advertisment
Snapshot
Applies to System administrators
Usp Further customize a live Distro
Links slax.linux-live.org/ Linux-live.org 

#mount —o loop ~/slax-4.0.1.iso /slax







Now create a new folder called ‘liveCD_data’ under your ‘/tmp’ directory and copy all the content from the /slax directory to it like this





#cp /slax/* /tmp/liveCD_data -rf







Now, again copy the linux-live tar ball from the /slax directory (from within the ISO image on the CD) to your home directory like this





#cp /slax/devel/linux-live-4.0.1.tar.gz ~1







And unpack it as shown





#tar —zxvf linux-live-4.0.1.tar.gz







porting the live script from pcqlinux 2004
The shell scripts of Slax, called Linux-Live, are developed under Slakeware Linux and use some commands which are not available in PCQLinux 2004. So, a very common problem you will face when running most of these scripts is a ‘tempfile: command not found’ message and the script will terminate. 



To resolve this problem either edit all the shell scripts that use the tempfile command and change it to the mkemp command or, better still, just create a simlink of the mktemp command to a new file called tempfile like this


#ln —s /bin/mktemp /bin/tempfile


before running the scripts.

Advertisment

Now, get hold of the software you want to add to the live distro. In our case it is Cinelerra-1.1.7-1.i386.rpm. First, generate a list of the output files (the actual files that are installed from the RPM on to your system) and their location. To do so, run the following command.






#rpm —qpl cinelerra-1.1.7-1.i386.rpm >> ~/list.txt







This command will create a file called list.txt in your home directory that will contain the list of the files and the path where they will be installed. If you look in this file, you will find that Cinelerra creates a folder under /usr/lib called ‘cinelerra’ and installs all the libraries there and copies seven commands (files) to the /usr/bin directory. This means that you have to customize only the usr.img file and add the above mentioned files and folders to it. To do so, first unpack the usr.img file from /tmp/liveCD_data to a blank folder, say /usrdata by running:





#~/linux-live-4.0.1/tools/img2dir /tmp/liveCD_data/base/usr.img
/usrdata





This command will unpack all the contents of the image file usr.img to the /usrdata folder. Now, install the cinelerra rpm by running the following command and copy the /usr/lib/cinelerra folder and the above mentioned seven files (in the list .txt file) from /usr/bin directory to /usrdata/data/usr/lib/ and /usrdata/ data/usr/bin directories, respectively.






#rpm —ivh cinelerra-1.1.7-1.i386.rpm


what’s a live

distro?
Live distro is a very commonly used term to describe a Linux distribution that doesn’t require to be installed on to the hard disk. Instead, it loads itself directly from any external media, most likely a CD, DVD or a USB Pen drive to the RAM and runs directly from there.



These distributions are useful for Linux newbies who want to check out Linux before installing it and for system administrators who can use these to boot into crashed machines and perform data recovery.
Advertisment

Now you have to recreate the usr.img file from the /usrdata folder so that you can replace the modified usr.img to the actual usr.img file. For this issue the following command.






#~/linux-live-4.0.1/tools/dir2img /usrdata/data /tmp/liveCD_data/base/usr.img /data 







This command will replace the original usr.img file with the modified usr.img file that contains the cinelerra files. Now you are ready to create the ISO out of this dump in /tmp/liveCD_data. To create the ISO, issue the following commands.





#cd /tmp/liveCD_data/


#./createbootdisk.sh /tmp/cust_slax.iso








And your customized live CD is ready under /tmp directory with the name of ‘cust_slax.iso’. Just burn the ISO (using K3B for example) and boot a PC with it. 


Slax not only gives you the option to modify itself but it also lets you create a live CD out of your installed Linux system using the shell scripts provided. A word of caution on that: it needs devfs(experimental) and ovlfs(pre-beta) compiled into the kernel and that is not as easy as it sounds. If you are using kernel-2.4.22.nptl (that shipped with Fedora Core 1 and PCQLinux 2004), then compiling devfs will need a lot of tweaks to the kernel source. If you are courageous enough, then go ahead and do it with information from

http://linux-live.org.

Anindya Roy

Advertisment