...making Linux just a little more fun! |
By Sunil Thomas Thonikuzhiyil |
Knoppix is a live cd distribution based on debian GNU/Linux.It contains a large number of applications which can come in handy even on minimal hardware.Knoppix supports alarge number of graphics cards sound cards scsi and USB devices.It can be used as a Linux demo, educational cd, rescue system or adapted and used as a platform for commercial product demo. It is not necesary to install anything to hard disk There is an installation program which can install the entire cd to a hard disk, if you like. It means that you have a full fledged debian installation in 20 minutes. This document describes how I built a custom live cd from knoppix. My primary motivation to build this cd was to include some of my favorite applications which are missing from stock knoppix CD. If you find any errors in this document please drop me a mail here
To start with you have to download knoppix image from knoppix site. There is a release every one or two week. There are 2 images: German and English. I did my setup based on 31-10-2002-EN release.
If you already have an image you can try to rsync it to the most recent version as below. However don't expect much bandwidth saving since the knoppix image is compressed. If you have a knoppix cdrom create an image by #dd if=/dev/cdrom of=knoppix.iso)
Rename the Knoppix iso image to reflect the current release name.
Example
I have downloaded
KNOPPIX_V3.1-23-10-2002-EN.iso
I want to update it to KNOPPIX_V3.1-31-10-2002-EN.iso
Rename KNOPPIX_V3.1-23-10-2002-EN.iso
to KNOPPIX_V3.1-31-10-2002-EN.iso
Then
rsync -P --stats ftp.leo.org::Knoppix/KNOPPIX_V3.1-31-10-2002-EN.iso
.
( you can use any other rsync site of knoppix. Always check the site for latest release)
A Computer with tons of free hard disk space and memory. I did this on a Pentium 3 950MHZ machine with 128 mb RAM.
Make a lot of disk space free You need a lot of real estate for
re-mastering KNOPPIX CD
I made two fresh partitions on my 20 GB Hard disk
hda2 with 2GB for swap
hda3 with 5 GB for re-mastering work ( you can also use an existing Linux partition if it has sufficient free space)
Now boot the machine with Knoppix cd ( You can also do the re-mastering after a hard disk install of knoppix . A how to for hard disk install can be found here )
At boot prompt press enter. Knoppix now boots into GUI. The default is KDE . You can change it at boot prompt if you want . I did re-mastering while booted to KDE. It is assumed that you are somewhat familiar with Knoppix. Read Knoppix cheat codes on the CD for more information on booting.
I am connected to a Lan and I configured IP address, netmask, name server and gateway This step is very important since you have to get the custom stuff to be installed from else where
Open a root shell from KDE menu (K/Knoppix/Root-shell) You will get # prompt
Run cfdisk
Next you have to make the necessary partitions . I created two partitions hda2 with 2 GB and hda3 with 5 GB
Make the 2GB partitions type as swap ( /hda2 in my case)
Make the 5 GB partitions type as Linux native( ext2) (hda3 here)
Save the modified partition information
Quit cfdisk
For creating compressed file system we need a lot of swap space .
I created the swap with
# mkswap /dev/hda2
# swapon /dev/hda2
Create an ext2 file system on the 5GB partition
# mke2fs /dev/hda3
Mount the 5GB partition to the Knoppix file system
# mount /dev/hda3 /mnt/hda3
The basic setup for re-mastering is ready
The knoppix CD is organized somewhat like the figure below ( Correct me if I am wrong. it may look different when you look at it from windows or another Linux distro)
/--demos |--talks |--index.html |--autorun.bat |--autorun.inf |--knoppix.ico |--KNOPPIX |--KNOPPIX |--boot.img |--background.gif |- (Some more files here)
The file KNOPPIX in /KNOPPIX directory on the cd is approxiamtley 700MB. The file contains a compressed image of the file system. We have to modify this file alone and can leave the rest of the cd intact (unless you want to modify boot image startup files etc).
You have to install/uninstall software under this tree ( if you don't have networking copy your sources to (say) /mnt/hda3/KNOPPIX/root/ and if you have debs copy them to /mnt/hda3/KNOPPIX/var/cache/apt/archives)
Now we are going to change the root of the file system to /mn/hda3/KNOPPIX
#chroot /mnt/hda3/KNOPPIX
you will get back # prompt ( If you get /dev/null permission denied message here just press control C)
You are at / ( chrooted to /mnt/hda3/KNOPPIX)
Next mount the proc file system
#mount -t proc /proc proc
Verify your ip address now with ifconfig. (It should be same as what you have out side chroot) Then try ping google.com. If you can ping google.com your network setup is ok under chroot.Do an apt get update
You can install /uninstall whatever software you need using apt. Since the original Cd has a lot of software installed it may not be an easy task.The following is a partial list of packages I removed
I copied the above list to a file ( say kicklist)
then did
#dpkg -P `cat kicklist`
It removed all files listed (notice the back quote
above )
If you are looking for big installed packages
# dpkg-awk "Status: .* installed$" -- Package Installed-Size| awk
'{print $2}' | egrep -v '^$' | xargs -n2 echo | perl -pe 's/(\S+)\s(\S+)/$2
$1/' | sort -rg
will list the packages with size in descending order.
Finally run deborphan to check if there are any orphaned packages
#deborphan > /tmp/orphanlist
#dpkg -P `cat /tmp/orphanlist`
# rm /tmp/orphanlist
An alternate method is to use synaptic and add/remove packages from GUI. Synaptic is good graphical front end to apt
For this do
# apt-get install synaptic
You have to export DISPLAY environment variable for synaptic to work properly
#DISPLAY=myip:0.0 ( replace my ip with your actual IP)
#export DISPLAY
#synaptic
It will start synaptic
Enjoy apt through synaptic
Once you are finished with synaptic you can re master the cd. If you are working from a hard disk install of knoppix and want synaptic to work, look in/etc/X11/xinit/xserverrc and see that -nolisten tcp is removed.Also do xhost + as a non root user)
Unmount proc ( This is very important)
#umount /proc
Press control D to leave chrooted environment
Download the software source inside chroot environment. Compile and install as usual . If it is an X11 application export display before you test
I use checkininstall asic-linux.com.mx/~izto/checkinstall/ to install and maintain home brew debs
Remember to remove the sources once you are finished (it will take up space on your CD).
It is possible to set password for users. Just set it under chrooted environment
3) Changing backgrounds/usr/local/lib/knoppix.gif is the default background image in X
4) Modifying Boot Screen The Knoppix Cd uses syslinux to boot. If you want to change the boot screen/messages do the
following. Make a temporary directory on your hard disk (I did mkdir
/mnt/hda3/image)
Copy the boot.img file from Knoppix directory of your knoppix cd
#cp /KNOPPIX/boot.img /mnt/hda3
Mount the image as follows
# mount -t msdos -o loop /mnt/hda3/boot.img /mnt/hda3/image
Now look in the image directory you created. There are a number of interesting files in this directory
#pngtopnm <logo.png >logo.pnm
#ppmtolss16 <logo.pnm >logo.16
# cp logo.16 /mnt/hda3/image/logo.16
(Keep the size of the final log.16 around 50 k). Unmount image directory. Copy the boot.img to a floppy
#dd if=boot.img of=/dev/fd0
Boot the machine from the floppy you have made.
If it boots up properly you are done
Make a new custom kernel using kernel package . Keep the kernal
size small. Copy the kernal to and modules to boot.img file. replace /lib/modules/2.4.19-xfs with modules of your new kernel
Replace files in /boot
Look for the following lines
---------------------------------------
#Also read desired desktop, if any
DESKTOP="$(getbootparam desktop 2>/dev/null)"
# Allow only supported windowmanagers
case "$DESKTOP" in gnome|kde|larswm|xfce|windowmaker|wmaker|icewm|fluxbox|twm) ;; *)
DESKTOP="KDE"; ;; esac
-------- ^^ --------------------------------------
Change the KDE above to gnome and that is all
7) Remove any temporary files(* link to the script goes here*)
1) Make a new directory on /mnt/hda3
I called it NewCd
Copy Everything except Compressed image file(KNOPPIX) from
knoppix cd (look at /cdrom). You can safely delete the directories demos and talks
2) Create the compressed Image
#mkisofs -R /mnt/hda3/KNOPPIX | create_compressed_fs - 65536 > /mnt/hda3/NewCD/KNOPPIX/KNOPPIX
3) Recreate the bootable CD
#cd /mnt/hda3
#mkisofs -r -J -b KNOPPIX/boot.img -c KNOPPIX/boot.cat -o myknoppix.iso NewCd
b)Testing the image Create a boot floppy
# dd if=/mnt/hda3/KNOPPIX/boot.img of=/dev/fd0
Copy the compressed file you created to a directory /KNOPPIX on any partition. The boot floppy i will look for /KNOPPIX/KNOPPIX on hard disk partitions.This makes your testing easy. Once you are satisfied with your image burn
itto a CD
1) How do I stop konquerer at startup
To stop konquerers you have to modify
/etc/X11/Xsession.d/45xsession
Look for the following lines
-------------------------------------------
if [ -e "$INDEXFILE" ]; then
cat >> $HOME/Desktop/KNOPPIX.desktop <<EOF
[Desktop Entry]
Name=KNOPPIX
Exec=kfmclient openProfile webbrowsing $INDEXFILE
Type=Application
Icon=html
Terminal=0
EOF
ln $HOME/Desktop/KNOPPIX.desktop $HOME/.kde/Autostart/showindex.desktop
fi
It makes an autostart file. Comment it out
2) I have booted knoppix cd and mounted a hard disk how do i copy something via scp to the hard disk
Open a shell
set a password for user knoppix
start ssh (/etc/init.d/ssh start)
Then copy with scp
3 I am at $ prompt I want to su
Do sudo passwd
set a root password
then su
4) default text mode boots up in frame buffer and characters are very small
how do I fix it
Mount boot.img
look for syslinux.cfg
under Default vmlinuz
change VGA=791 to VGA=normal
5 )My keyboard lay out is German. How do i change it to English
Open KDE control center select system ->keyboard and change
it to US English
I work as consultant information technology at the Kerala Legislative
Assembly Trivandrum India. I have been hooked on Linux since 1996. I have a
Masters in Computer Science from Cochin University. I am interested in all
sorts of operating systems. In my free time I love to listen to Indian
classical music.