FREIE SOFTWARE KNOPPIX
HOWTO

 

  

Add Freedom to Knoppix

by Dominik Reusser, David Putzer and Vincent Hermenier for Intevation GmbH.
enhanced for Knoppix 3.7 by Sascha Wilde <wilde@intevation.de>
$Id: knoppixAddFreedom.html,v 1.21 2005/02/24 10:29:18 wilde Exp $

1 Introduction

Knoppix is a great platform to develop live CDs which directly boot and run off the CDrom drive. Knoppix is based on Debian GNU/Linux with improved autodetection and a compressed filesystem. However, there are a couple of non-free packages coming with original Knoppix releases. This is a not desirable for Free Software projects. This text will help you to identify and remove the non-free packages and use Knoppix as basis for your own project.

When we started with this description how to put the freedom back into your Knoppix CD we were not aware of any variant of Knoppix having the same goal. Meanwhile knoppix.net has grown a page with http://www.knoppix.net/wiki/Knoppix_Customisations. Most listed custom versions leave the proprietary software on the CD, but some care enough about Freedom to remove it.

Several other descriptions for remastering the Knoppix CD exist. Differently from this description many start with booting from the CD-Rom. Here is an incomplete list:

However, if you get the CD image from the internet, it is desirable to modify the system without burning it to a CD first. Therefore we start with the CD image. A number of bash scripts were developed in order to extract, modify and recreate the iso image. The scripts can be found in the directory /KNOPPIX/src_freedom. They must be executed as root in order to have read and write access to all system files in the Knoppix file system.

Versions known to work

There are many Knoppix version out there, these instructions will be a principle guide, but can only be specific for a range of versions. If you read this file coming with a Knoppix CD itself than you know the version it was applied to. We applied this specific revision of this document to the current version of KNOPPIX, namely the KNOPPIX_V3.7-2004-12-08-DE.

2 Extraction of the Knoppix Environment

Remastering the CD involves creating two new directories to store and modify the uncompressed CD and then recompressing it. The first directory will contain the content of the CD as it appears including the packed file system at ./KNOPPIX/KNOPPIX. The compressed file system (with the actual linux system) will then be extracted into a second directory, which carries the extension _env in this document. Make sure the partition you work on has enough disk space. You will need about 4 GB for the source iso file and the two directories. In addition a large swap partition (about 2GB) is required to create the compressed file system because create_compressed_fs keeps the complete compressed image in the virtual memory. (cloop-presentation K. Knopper).

Starting from the knoppix ISO-image the knoppix environment can be extracted. This is done using the knoppixFreedom.ripISO script which mounts the image, copies the files and extracts the compressed file system. WARNING: Check the script and modify it to your requirements before running them!

The extraction is done using the extract_compressed_fs command from the cloop package. Note that this is safer than mounting the compressed filesystem with the cloop kernel module (Due to bugs in the cloop-module, parts of the system might freeze when the compressed file is heavily accessed; see zork.net and debian bug reports).

Next, files from the compressed filesystem are copied and the timestamps of the files are written into a file called mkisofs.sort which is used to sort the files on the CD (knopper.net) . It is necessary to reduce the positioning of the laser in the CD drive to a minimum for reasonable performance.

$ ./knoppixFreedom.ripISO KNOPPIX_V3.7-2004-12-08-DE.iso
creating directory KNOPPIX_V3.7-2004-12-08-DE

creating directory KNOPPIX_V3.7-2004-12-08-DE_env

copying content of iso image
this might take a while...

extracting compressed file
this might take a while...
copying entire knoppix file system...
this takes a long time

writing sorting information into mkisofs.sort...

deleting temporary files...

Two new directories contain the files from the CD as they appear (KNOPPIX_V3.7-2004-12-08-DE) and the files from the compressed filesystem (KNOPPIX_V3.7-2004-12-08-DE_env). You are now free to tailor the extracted Knoppix to your requirement by chrooting into the directory with the extension _env.

3 Removal of Proprietary Software

Several places can be searched for non-free software.

Debian packages

The easiest part is removing the debian packages in the contrib, non-free and non-us/non-free sections (debian packages). A good way to obtain the installed non-free packages is to use the command:

dpkg-awk -f KNOPPIX_V3.7-2004-12-08-DE_env/var/lib/dpkg/status "Section:.*non-free.*" "Status:.*install ok installed*." -- Package | awk '{print $2}' | egrep -v '^$'

Unfortunatly there are more unfree packages. These are customized packages for Knoppix, which can be found in the Knoppix section. Good news is: they are marked by the suffix "nonfree" in the packagename. We get them with:

dpkg-awk -f KNOPPIX_V3.7-2004-12-08-DE_env/var/lib/dpkg/status "Package:.*nonfree.*" "Section:.*knoppix.*" "Status:.*install ok installed*." -- Package | awk '{print $2}' | egrep -v '^$'

Another suspicious section is "alien", it contains converted packages from other packaging systems.

dpkg-awk -f KNOPPIX_V3.7-2004-12-08-DE_env/var/lib/dpkg/status \
"Section:.*alien.*" "Status:.*install ok installed*." -- Package | \
awk '{print $2}' | egrep -v '^$'

In the end we obtain:

  • bluez-firmware
  • 3270-common
  • unarj
  • lha
  • acroread
  • giflib-bin
  • x3270
  • giflib3g
  • smbconf-pfeifle-nonfree
  • prism54-nonfree
  • ipw2100-nonfree
  • captive-static
  • fonts-ttf-west-european
  • fonts-ttf-decoratives
Unp must be added to this list, because it depends on unarj. captive-ntfs-knoppix captive-installer-knoppix are related to captive-static as smbconf-pfeifle is to smbconf-pfeifle-nonfree and xfonts-x3270-misc to x3270 so we'll remove them, too.

The package atmel-firmware contains a firmware blob, which is not realy free, too. But we think of this kind of firmware blobs as a part of the hardware, so we leave it. If you think this is not the right thing to do, feel free to remove it.

These packages can be removed by chrooting into knoppixFreedom_env and by using dpkg or dselect. To remove them we use (after a chroot KNOPPIX_V3.7-2004-12-08-DE_env):

dpkg --purge bluez-firmware unp 3270-common unarj lha acroread \
giflib-bin x3270 giflib3g pdf-printerconfig \
smbconf-pfeifle smbconf-pfeifle-nonfree prism54-nonfree ipw2100-nonfree \
xfonts-x3270-misc captive-ntfs-knoppix captive-installer-knoppix captive-static

The deinstallation of 3270-common and x3270 still leaves some charsets in /etc/3270, we don't need them so we remove the directory

rm -rf /etc/3270

And erasing the captive stuff leaves /usr/share/lufs useless so remove it as well

rm -rf /usr/share/lufs

In the case of acroread, the above command is not enough. In fact, the system keeps acroread as the default pdf viewer. On top of that we remain with acroread menu entries and the acroread icons. The first step is to get rid of the menu entries and the icons, this can be performed using:

cd KNOPPIX_V3.7-2004-12-08-DE_env
rm etc/skel/.acrorc \
etc/skel/.kde/share/applnk/.hidden/acroread.desktop \
usr/share/apps/kappfinder/apps/Office/acroread.desktop \
usr/share/apps/kdisplay/app-defaults/AcroRead.ad \
usr/share/icons/crystalsvg/128x128/apps/acroread.png \
usr/share/icons/crystalsvg/16x16/apps/acroread.png \
usr/share/icons/crystalsvg/32x32/apps/acroread.png \
usr/share/icons/crystalsvg/48x48/apps/acroread.png \
usr/share/icons/crystalsvg/64x64/apps/acroread.png \
usr/share/icons/crystalsvg/scalable/apps/acroread.svgz

The next step is to change the default viewer to be used for the pdf files and to remove references to the Icons we deleted. This can be done edititing the files

etc/X11/icewm/menu
etc/menu-methods/zzz-update-menus-knoppix
etc/skel/.kde/share/config/profilerc
usr/share/apps/kdeprint/specials.desktop

Helpers downloading non-free software

We also removed the non-free entries from the KNOPPIX_V3.7-2004-12-08-DE_env/etc/apt/sources.list file.

Kernel modules

Beside the non-free packages, there might be non-free kernel modules installed. A list of available binary-only modules was published on the linux-kernel mailinglist . However, it is very difficult to get the module names from the descriptions in this list (usually, the package has to be downloaded and unpacked). Therefore a different approach works better: After chrooting into knoppixFreedom_env, names and license-information is obtained for all modules:

chroot KNOPPIX_V3.7-2004-12-08-DE_env
cd /lib/modules/2.4.27/
find -name *.o -exec modinfo \{\} \; | grep '^license\|^filename' %gt;/module_license-2.4.27.txt
cd /lib/modules/2.6.9/
find -name *.ko -exec modinfo \{\} \; | grep '^license\|^filename' >/module_license-2.6.9.txt
exit
mv KNOPPIX_V3.7-2004-12-08-DE_env/module_license-2.4.27.txt ./
mv KNOPPIX_V3.7-2004-12-08-DE_env/module_license-2.6.9.txt ./

There might be additional directorys in /lib/modules which have to be scanned. For KNOPPIX_V3.7-2004-12-08 there are only two: airo_mpi/ (for Cisco/Aironet) and extra/ which contains alsa modules for 2.4.27 -- these are all free software under the GPL.

All non-GPL Modules are obtained using vim:

cp module_license-2.4.27 module_license_nonGPL.txt
cat module_license-2.6.9 >>module_license_nonGPL.txt
vim module_license_nonGPL.txt
:%s/filename.*\nlicense.*GPL.*\n*//g
:wq

There is only one proprietary module: /lib/modules/2.4.27/net/ath_hal.o which we remove

rm -f /lib/modules/2.4.27/net/ath_hal.o

There are about 20 modules with no license information. It is easy to check the sources for the corresponding license and confirm that no non-free kernel-modules are installed.

After changing the installed modules we run depmode on the modified modules directory

chroot KNOPPIX_V3.7-2004-12-08-DE_env depmod -a 2.4.27 2>/dev/null

Also, one should check for non-free graphic card drivers. However, these seem to be restricted to two main packages, the nvidia driver for GeForce cards and the ATI firegl XFree86 package (xfree-features).

It can also be checked, whether installed fonts and xine binary-plugins are distributed under GPL. This is confirmed consulting the source codes and searching the internet. (rpmfind)

Other software

Knoppix might contain other non-free software or data that is not registered as a Debian packet or with the kernel. It is difficult to search for this systematically. Knoppix 3.7 for instance does have Java installed from a tarball. So you need to remove it manually like

rm -r KNOPPIX_V3.7-2004-12-08-DE_env/usr/lib/j2se

This leaves some broken symlinks, remove them too

rm KNOPPIX_V3.7-2004-12-08-DE_env/usr/bin/java rm KNOPPIX_V3.7-2004-12-08-DE_env/etc/alternatives/j2sdk-config rm KNOPPIX_V3.7-2004-12-08-DE_env/usr/bin/awt_robot rm KNOPPIX_V3.7-2004-12-08-DE_env/usr/bin/j2sdk-config rm KNOPPIX_V3.7-2004-12-08-DE_env/usr/lib/mozilla/plugins/javaplugin_oji.so

5 Changing other stuff

In order to make the freedom added CD distinguishable, background pictures and documentation were adjusted. As mentioned in section 2, background pictures and html files were copied to the directory doc if it did not exist at that point. Changes can be made in this directory. At the same time, pictures were converted from the patent encumbered gif format to the free PNG format. Therefore configuration files also had to be adjusted. Files in /etc were searched for the strings .gif. Relevant files to adjust were found to be
  • KNOPPIX_V3.7-2004-12-08-DE_env/etc/skel/.kde/share/config/kcontrolrc
  • KNOPPIX_V3.7-2004-12-08-DE_env/etc/skel/.kde/share/config/kdesktoprc
  • KNOPPIX_V3.7-2004-12-08-DE/KNOPPIX/*.gif
  • KNOPPIX_V3.7-2004-12-08-DE/KNOPPIX/images/*

Now that we've finished remastering and to update the databases used by locate, dlocate we perform the command:

chroot KNOPPIX_V3.7-2004-12-08-DE_env/ touch /etc/mtab && updatedb && rm -f /etc/mtab chroot KNOPPIX_V3.7-2004-12-08-DE_env/ debfoster -q chroot KNOPPIX_V3.7-2004-12-08-DE_env/ update-dlocatedb

6 Performing steps 4 and 5

A nice way to perform the steps 4 and 5 is to use the script called knoppixFreedom.purge:

$ ./knoppixFreedom.purge KNOPPIX_V3.7-2004-12-08-DE

7 Changing boot.img

In order to make the freedom added CD distinguishable, we also modified the boot.img file, thus enabling us to modify the linuxrc, boot.msg, f2 and logo.16 files. Details on how to perform this action can be found on knopper.net for example

8 Recreating CD-Rom

Once the knoppixFreedom environment sadisfies your requirements, it is fairly easy to create the ISO-image. All you have to do, is to run a sh-script which was derived from Knoppix.mkcompressed (you have to be root to do this, otherwise files like /etc/sudoers will not be properly included.):

$ ./knoppixFreedom.mkCompressed KNOPPIX_V3.7-2004-12-08-DE
Recreate KNOPPIX compressed FS? y
KNOPPIX_V3.7-2004-12-08-DE_env/etc/sudoers
Warning: creating filesystem that does not conform to ISO-9660.
mkisofs 1.15a34 (i686-pc-linux-gnu)
Scanning KNOPPIX_V3.7-2004-12-08-DE_env
Scanning ...
...
Block# 1 size 65536 -&gr; 25743 [compression ratio ....
...
Done.
Recrate KNOPPIX isofile 'KNOPPIX_V3.7-2004-12-08-DE.iso.modified? y
mkisofs 1.14 (i686-pc-linux-gnu)
...

As a reminder, sorting of files in the compressed file system is usefull to reduce the positioning of the laser in the CD drive to a minimum for reasonable performance during the boot process.

Before creating the compressed file system, the script tries to read the file sortfile.template. The files listed in sortfile.template will appear at the start of the compressed file system with the first file at the very beginning. This method was suggested by Stephan Walter on the knoppix mailinglist in May 2002. All files not mentioned in sortfile.template will be placed later in the compressed file system sorted alphabetically. If sortfile.template is not present, the existing mkisofs.sort will be used. If no mkisofs.sort exists, a warning will be given.

The compressed file system is created much faster (5 instead of 90 minutes on a fast computer) with the alternate method based on the sortfile.template. However, we recommend to use the slower method (without the sortfile.template present), because the CD will boot slower, if the sortfile.template is not optimized. So far we do not have an optimized version of this file.

Another quick way to get an iso of the modified system is to use:

mkisofs -R -l -V "Freie Software KNOPPIX" -hide-rr-moved -v KNOPPIX_V3.7-2004-12-08-DE_env | create_compressed_fs - 65536 > KNOPPIX_V3.7-2004-12-08-DE/KNOPPIX/KNOPPIX
mkisofs -l -r -J -V "Freie Software KNOPPIX" -hide-rr-moved -v -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o freeKNOPPIX-3.7.iso KNOPPIX_V3.7-2004-12-08-DE

It is possible to test the modified version of Knoppix. To do this, you need to link the KNOPPIX directory to the root of the partition. Then the computer can be booted from a knoppix boot floppy. The KNOPPIX directory should be detected automatically. Note that this has not been tested yet.

dd if=/KNOPPIX_V3.7-2004-12-08-DE/KNOPPIX/boot.img of=/dev/fd0
ln -s KNOPPIX_V3.7-2004-12-08-DE/KNOPPIX /

9 Disclaimer

This documentation and the scripts are provided as is. Intevation GmbH is 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.

Copyright (c) 2002-2005 Intevation GmbH
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.