How to use the Knoppix live CD
for iCanProgram courses

One of the first and still one best live Linux CDs is  called Knoppix  (named after Klaus Knopper the lead developer on the project).

Knoppix is CD based version of Linux that, when booted, will allow the Linux system to run, will auto-detect a large range of hardware and install drivers for hardware seamlessly.

Knoppix will provide a very large range of programs in addition to the basic operating system including games, multimedia functionality, CD and DVD burning, Office suites, mail programs, programming utilities and compilers etc. etc.

All of this is accomplished without disturbing the underlying system configuration of the computer being used as a base.

Knoppix live CDs are freely available for  download and burning an iso image (ie. a CD image).

After the Knoppix system is shutdown and the live CD removed, the underlying Windows system (for example) will be exactly as it was before the Knoppix session was begun (unless the user had purposely copied some files to the hard drive).

The operation of Knoppix does not, of itself, need to copy any file to or modify the existing system in any way.

Why use Knoppix?

Knoppix is an excellent live Linux CD.     It is very popular and as a result is actively and continuously being improved.

Knoppix is very good at detecting all the hardware on a computer (eg. network cards,  video cards) and automatically running the correct drivers.

Knoppix has a excellent "on the fly" compression algorithm which allows it to contain a wide array of utilities and programs on a single CD.

Knoppix is open source and hence freely and widely available for download.

Knoppix is based on Debian Linux,  which is itself a widely deployed Linux distribution.

For those wishing to preserve an existing system configuration (eg. a Windows partition) Knoppix can be used from the CD, leaving the underlying system pristine.

Alternatively, Knoppix can be installed to the hard drive, if required.

Who would use Knoppix?

This How-To is about using Knoppix with an iCanProgram course.

In relation to those courses there would seem to be a few prime target user groups:

The Knoppix live CD does support a large range of hardware and also provides an excellent range of software including several programming languages, the C/C++ compiler and various utilities.      This makes it an excellent live CD for an iCanProgram student.

The range of software is too extensive to canvas in this context but most new users will be surprised at the scope and extent of the inclusions - almost every conceivable program grouping is covered.

Many of you will have experienced a situation where you want to use some Linux functionality, as a first choice, but find that the only box available is some different system (probably Windows). A common example is a work computer or a friend's computer over which you have no authority or desire to alter the configuration. In such an instance (love that C++ programmer talk) you can boot up the Knoppix live CD, accomplish whatever tasks are required, remove the CD and reboot to a Windows box exactly as it was before your arrival.

Thus, you can complete your iCanProgram tasks on an existing Windows box - in your lunch break, coffee break, before or after work with no adverse effects or abuse from the SysAdmin!
 
 

How to get a Knoppix CD?

If possible the easiest way to obtain the Knoppix Live CD is to download the iso file and burn the CD as indicated below.

The Knoppix Live CD is all contained on just one CD.

For those of us in countries with widespread broadband access we are lucky,  because this image is quite large at 700Mb.

If you do not have access to a broadband internet connection you can:

What is an ISO file?

An iso file is an image of a complete filesystem.

It contains all the files from the source system in the correct locations on the drive to enable the system to operate successfully.

As an example, if a Windows system was installed to a clean hard drive and all the files that were needed for complete operation were loaded (eg Office, Photoshop etc), it would be possible to create what is known as an image of the hard drive.

This image is generally created as an iso file that contains every file from the hard drive. If such an image was obtained it would be possible to format the drive back to clean and unpack the image file to it and the resulting system would be identical to the original system.

Although the iso file is one single file with a .iso extension it contains many individual files and directories in a complete package.

VERY IMPORTANT POINT... When the iso file is obtained, it should be burned to a CD using appropriate iso burning methodology. DO NOT simply copy this file to a CD as it will not be unpacked properly and it will not boot!
 
 

Downloading the ISO file

There are many locations across the Internet that house the Knoppix iso file.

For example, many ISP's have free download areas where Knoppix iso files can be found. If you know of such a site and prefer to use it, that is fine.

However, if you do not know where Knoppix files might be located then point your browser to:- http://www.knoppix.org then click on one of the flag icons to be directed to the page for your language.

Find the download link (which on the current version of the web page is the second in a row of penguin graphics) and click on it.

You will be directed to a list of Knoppix mirrors in various locations around the world. Pick an appropriate site near you and click on the link to one of the protocols (rsync, ftp, http) ... if you are unsure of what ftp, http or rsync are then just click on the http protocol entry for your chosen mirror.

You will be directed to a page containing the download agreement and asked to read and accept it.

Once you have read and accepted the agreement you will be directed to a page on which there are many file entries. The file you will be looking for may have a circular CD icon (in Internet Explorer) or a question mark icon (in Firefox) and will be about 700Mb in size.

There may be more than one file that looks like this and the naming convention should be intuitive. It is:

KNOPPIX_(version)-(date)-(language).iso
for example Knoppix 3.6 for English language is
KNOPPIX_v3.6-2004-8-16-EN.iso
Download this file and burn it to a CD.

Usually, in Windows, if you find the location of the file in Windows Explorer and double click on it, the appropriate burning methodology will be started.

Otherwise, consult your CD Burner documentation on how to burn an iso image. The most important issue here is that the iso file is burned appropriately and not just copied to a blank CD.

If you have burned the CD correctly it should be bootable (make sure your BIOS has the CD boot option before the HDD boot option though).

The first screen from the CD will take you to the boot: option. It is possible to pass many paramaters to the boot command but if this is just left blank and the ENTER key pressed (or just wait a few seconds) the system will boot into the Knoppix GUI which is KDE Desktop.
 
 

What other bits will you need?

Once the Knoppix CD is obtained and the computer can be booted into the Knoppix system, it will be possible to use the system, just as it is, to begin using and programming - with one limitation. The Knoppix Live CD does not install to any storage device but the system resides in a virtual drive in system memory and, if there is insufficient memory it may refuse to start the X Windows system.

Knoppix documentation indicates that 20 Mb RAM is required to run in console (text) mode and a minimum of 82 Mb is required to run the GUI (although 128 Mb is preferred). Even if there is sufficient memory, running in a ramdisk has limitations. One major limitation is that data can only survive while the system is live and any files that are saved will be lost when the system is powered off.

To permanently save files some persistent storage device (eg hard drive, floppy drive, CD burner, USB memory key) is required. It is then possible to save files such as the lesson files, source files and executable files on these devices for later use. In unix systems hardware elements are known as devices and they usually have entries in the /dev filesystem associated with them. It is necessary to mount devices on mount points before they can be accessed for reading or writing.

As you travel along the unix/Linux path you will learn more about the /dev filesystem and mount points but, for the moment, all that is needed to know is that the current version (and the current version of Knoppix is ver 3.6 or 3.7) of Knoppix will handle device detection and mounting automatically. The following sections will provide a guide to the use of persistent storage devices with the Knoppix GUI for:

A little information on mount points may be helpful at this stage in order to better prepare for what will be seen on the KDE desktop.
The following lists devices and their mount points:- Actually the memory key is mounted as if it was a SCSI hard drive - IDE Hard drives in the Windows DOS area are known as C: , D: etc but in unix type systems they are given the nomenclature as follows:- To this is added a partition number - the first four partition numbers being reserved for primary partitions and from 5 onwards being extended partitions- thus the primary partition on as DOS disk might be called hda1 and the first extended partition might be hda5 on a *nix system. [ FOR REFERENCE : Most storage devices will be mounted in the /mnt filesystem by default but recent versions of Red Hat Linux have begun mounting some devices in /media eg /media/floppy or /media/cdrom ]

When the Knoppix CD boots into GUI mode several icons can be seen, depending on the system configuration of the computer. There will be several storage icons present (on Windows systems there will be at least one hard drive icon (Hard Drive Partition hda1) and possibly other partitions (eg Hard Drive Partition hda5 etc). There will also be CDROM and Floppy icons. Now, although the hard drive partitions have been detected and mounted (by clicking on the icons the content of the hard partition can be seen) they will only be mounted in read-only mode - the only devices accessible for writing are the floppy drive and the CDROM.

Now! At last we get the the point!
 

Using floppy drives for persistent storage

Floppy drives are the simplest storage device to use. Files can be saved to the drive by inserting a formated floppy and saving or copying files to the drive because the device is already mounted in the read-write mode, but remember the correct address of the drive is not A: but /mnt/floppy.

Using a terminal, it is possible to copy a file somefile.txt in the current directory to the floppy with the following command:

cp ./somefile.txt  /mnt/floppy/somefile.txt
or if it was desired to copy a file lesson1.tar to the floppy the following command would be appropriate:
cp lesson1.tar  /mnt/floppy
Another alternative might be to declare /mnt/floppy as the home directory using a boot parameter (this will be covered later) and the default directory will then be the floppy drive. Two issues with floppy drives is that saving too them is slow and their capacity is small. Further, if there is no formatted disk in the drive the system may object.
 

Using CD burners for persistent storage

CD burners can also be used for storage (this will mean that both a CDROM and CD Burner will need to be available as the Knoppix CD will need to be running in the CDROM). In this case files are saved to the default home directory - which is actually located in memory via the ramdisk. At the end of the session the saved files can be burned to a CD. Knoppix has an easy-to-use CD burner included (K3b) that can be used to do the burn (it is very similar to Nero). In some cases CD burning may be limited to the root user and, if this is the case, simply open a terminal, su to the root user by entering
su root
and then enter
k3b
to start the burning software. The default home directory for the Knoppix disk is /ramdisk/home/knoppix - that is where saved files will be found for burning. It is not advisable to declare /mnt/CDROM (or /mnt/CDROM1) as a home directory as saving files to it is not just a simple write operation. Using the CD burner for storage is probably the least flexible of all the methods described in this document and may not be the most favoured solution.
 

Using hard drives or memory keys for persistent storage

There are some similarities in using either the systems hard drive or a memory key for file storage.

NOTE: If the system hard drive or some network enabled partition is to be used for storage, please ensure that such a use of resources does not operate counter to any IT policy in place ... make sure you are authorised to use the system in this way. Remember the old saying "Hell hath no fury like a sysadmin scorned".

The reason that the use of hard drives and memory keys is very similar is because the system actually "sees" a memory key as a SCSI hard drive and it is mounted on the /dev/sda1 mount point (or something very similar). When a USB memory key is plugged into a USB socket a new icon will appear on the screen indicating that the device has been detected and mounted on the sda1 mount point. The major difference between setting up a floppy, using a CD burner and using hard drives/memory keys is that the two former are write enabled but the two latter are not write enabled.

This means that a new method has to be used to write to the chosen device. Fortunately, Knoppix has a built in script for accomplishing this task. The script can be found in the program menu in the KNOPPIX group. Clicking Knoppix and then Configure brings up a sub-menu which includes an entry

Create a Persistent Knoppix Home Directory
Click on that entry and follow the prompts (read the message boxes because there is good information in there that will allow you to reboot to a system using the newly created directory as the home directory). The first message box asks if you want to establish persistent storage, the second message box asks where and the third box asks whether to use the full partition or establish an image file. If you are using a home directory on removable media, such as a memory key, the memory key must be plugged in, otherwise errors will occur. When you reboot the system or start it again anytime after establishing a persistent storage device, a parameter must be passed at boot time indicating where the home directory can be found.

The very first screen when Knoppix boots shows the boot: prompt and waits a period of time to see if boot parameters are provided. There are two options - the first is to pass an boot parameter indicating where the home directory can be found:- eg

boot: home=\dev\sda1 (for a memory key)
or
boot: home=\dev\hda1 (for a hard drive)
or
boot: home=scan
The scan parameter will cause the system to search for the new home directory. After this, when files are saved to the default home directory they will be saved to the new location and , since the new location will persist even if the system powered down, the save will be permanent.
 
 


References:
1) site containing links about Knoppix CDs

2) site where inexpensive copies of Knoppix CD's can be purchased

3) book on Knoppix CD.     Knoppix Hacks by O'Reilly   ISBN 0-596-00787-6


Special thanks to Frank B.  for his many contributions to this HowTo page.