How-to remaster Knoppix to include GNUmed and other med software

Date of revision: 2002-11-13
Author: Jubal John (jubaljTAmetahelpTODcoTODnz),
Last Edited: Jubal John

Introduction

Knoppix is a self-configuring CD based debian distro. More information can be found here: http://www.knopper.net/knoppix/index-en.html. It is an ideal platform to develop demo CD's from, because of its good autodetection and because it runs completely of the CD. It uses a transparent compression technology to fit close to 2 GB of data on a 700MB CD. A good bonus feature of the CD is that it can easily be installed onto the computer with knx-hdinstall.

The process

Step 1: Getting the data off the knoppix CD

Remastering the CD involves creating a partition (or two) which can be used to store the uncompressed CD, to modifying it and then to recompress and test it. I will assume that two seperate partitions are being used, although you could just use seperate directories on a free partition with sufficient space. In addition to space for the data, a large swap partition is required for the step which involves creating the compressed file - I'm not sure what the minimum size of this partition is but it needs to be about 2GB.

If you have setup two partitions for the data, one will act as a source and the second will act as the the master (or you may use two seperate directories named appropriately).

Source (contents of main compressed file): This contains the files that form the compressed part of the Knoppix cd - which is basically most of the knoppix files. We will be chrooting to this directory to make the desired changes.

Master (used to make final iso): This directory contains the files as they should appear in a knoppix cd, ie. it contains the files that make the CD bootable + a big file called KNOPPIX which is a compressed version of everything contained in the source directory.

rip-cd.sh script

This script is useful if you have already setup three partitions, that are ready to be used as source, master and swap. Note: this is a dangerous script and you need to edit it to let it know which partitions you have setup for various purposes, also make sure you understand all the commands that the script is executing.
This script needs to be run from a root console (ctrl-alt-F1) after you have booted from the Knoppix cd that you want to remaster. The script will basically copy all the stuff of the CD onto your hard disk so that you are ready to make the desired changes.

Step 2: Making the changes

The final thing that the previous script does is chroot to the source. This now allows you to mount proc, edit sources.list, edit /etc/resolv.conf and do an apt-get update etc. Basically now you are free to tailor knoppix to your requirement.

Setting up gnu-med

Get the dependencies (install any additional things that it wants to install):
apt-get install postgresql python2.2-psycopg;
apt-get -t unstable install libwxgtk2.3-python python-pgsql
Get gnumed from the CVS (then copy it to the standard location /usr/share/gnumed (just need client and server subdirectories))
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/gnumed login
cvs -z9 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/gnumed co gnumed
Export GNUMED_DIR (/usr/share/gnumed/client) variable for user knoppix
Gnumed can be run by typing python2.2 gnumed.py in the /usr/share/gnumed/client/wxpython/ directory. [you need to have setup postgresql and then have booted from your new remastered knoppix to test if this works]

Setting up postgresql

Apt-get would have setup postgresql but to to get it to work correctly in knoppix a few things have to be done.
Allowing write access to database
A script like debian-med placed in /etc/init.d with a symlink to it /etc/rc5.d/S19debian-med (ln -s /etc/init.d/debian-med /etc/rc5.d/S19debian-med) allows for the execution of any initiallisation steps while the knoppix CD starts up. To make the database work correctly, the script removes the symlinks to the CD that exist in the /var/lib/postgres/data directory with a copy of the real files (rm -rf /var/lib/postgres/; cp -Rp /KNOPPIX/var/lib/postgres /var/lib/)

Creating users/database
Once you have the database working, you need to run the createdb scripts the in the gnumed/server directory and also createuser knoppix and guest.

Authentication
Since this is just a demo cd, /etc/postgresql/pg_hba.conf can be edited to allow access without authentication by changing 'indent sameuser or reject' to 'trust'
Setting up Apache

If the medical software requires the apache webserver like odontolinux; you could do a ln -s /etc/init.d/apache /etc/rc5.d/S20apache so that apache starts up on knoppix startup.


changes.sh script

This is not really a script at the moment, more a checklist of sorts.. so dont execute it. You might just want to leave it open on a virtual console if you need something to prompt you on what needs to be done.. (I need to improve it by including a generic 'apt-get remove' line to remove unwanted software from the knoppix cd to create space for the stuff we have added)

Step 3: Testing the remastered CD

Fortunately you dont need to create a cd everytime you need to test your changes, you can just use the knoppix boot floppy. It can be created by a command similar to:
dd if=/mnt/master/KNOPPIX/boot.img of=/dev/fd0 
The boot floppy will start up and look for the the hard disk partition which contains a KNOPPIX directory (make sure its using the partition with the master files). If you have used a partition for source, it will also contain a KNOPPIX directory that you will need to rename (if its partition number comes first.. the floppy searches hda1, a2, a3, b1, b2, b3 etc... and uses first partition with a KNOPPIX directory)

Now, before we can actually boot the remaster knoppix we need to create the compressed KNOPPIX file in the master directory/partition. I can do this step from within RH8 after i've copied create_compressed_fs (/mnt/source/usr/bin/create_compressed_fs) into my path.

testknoppix.sh script

This script  if setup correctly will create the compressed KNOPPIX file in the master partition so that if you reboot with the knoppix floopy in your drive you will be greeted with the remastered version of your knoppix.

Now if things aren't up to scratch you'll need to go back to the chrooted enviroment to make any changes - you can do this in one of the knoppix root consoles. You might be able to get away by making some changes by being chrooted from within the usual linux you are using. eg, I can chroot from RH8 to make any minor changes and then run the testknoppix.sh script.

Step 4: Making the final iso

Ah.. so u made it this far. Just make sure you do an apt-get clean and an updatedb when you are chrooted to clean up things. Rest is quite straight forward (have a look at the script)

make-iso.sh script

Removes the ogg files and makes the iso...

References / other useful links:

http://www.linux.net.nz/lists/NZLUG/2002/08/0609.html
http://www.geocities.com/ted_johnson2/knoppix.txt
http://alamo.satlug.org/pipermail/satlug/2002-August/004254.html

http://www.linuxtag.org/cgi-bin/yabb/YaBB.pl?board=knoppix-en;action=display;num=1025275154

Disclaimer

Standard disclaimers apply. I am in no way responsible for any loss of information or other damage that you may suffer as a consequence of reading this material or using any scripts. USE AT OWN RISK.

I am happy to hear suggestions on any improvements to scripts / content.