Using and Customizing Knoppixby Robert Bernier
Author's note: This following article is no longer completely acurate in that the implementation of the KNOPPIX distribution's boot process has changed since this article was originally written, although the information for the most part is still accurate.
Please email me at firstname.lastname@example.org If you would like to see an updated article on mastering a KNOPPIX distribution.
Before I get into the guts of my article, I want to start out by sharing a couple of horror stories. My ISP's technician introduced me to Linux. (In those days, I paid $400 for a one-year subscription of 30 hours each month on a dialup 14.4 modem.) I'm thankful for that chance encounter, but learning Linux was, for a long time, an adventure in self-inflicted torture. I'm embarrassed to say it now, but I was grateful that I had Win 3.1 as an alternate to my Linux OS.
Years later, one of the local colleges was preparing a Linux course. We had a classroom filled with computers at our disposal, but were not allowed to install Linux onto them -- instead, we were instructed to use diskettes to load the OS into console mode only. In addition, we had to remove all remnants of Linux from the machines after each and every class.
What do these snapshots of my past have in common? They both highlight the need for a Linux implementation that can be adapted to situations that are highly volatile, politically as well as technically. These days, people are making money using Linux. We install Linux on servers, embedded devices, and kiosks. It is a development environment; think Hollywood, folks. Linux is used as a turnkey solution recovering data from compromised systems and, dare I say, it is even moving up the corporate ladder of workstation usage. To accomplish all of this, the Linux practitioner must be adaptable and possess a talent for improvisation (that, in extreme cases, can be characterized as cowboy-like). These days he is expected to do the job fast and do it right the first time. Enter the live-CD!
The Linux Live-CD
A Linux live-CD distribution is a Linux OS that resides on a CD. It boots and autoconfigures itself without user interaction. Hardware-wise, the CD drive must be the primary boot device, and the machine needs lots of RAM. The autoconfiguration process not only correctly identifies the hardware but selects the best configuration options for the hardware it finds. Take a look at the Linux distributions. You'll notice that several are self-booting; most of these distributions are in fact based on one key distribution, the Knoppix live-CD.
Klaus Knopper created Knoppix. Though this distribution is rather young, it stands out for its hardware detection and autoconfiguration abilities. The
packages and OS structure are based on the Debian distribution, but the hardware-discovery process uses
kudzu, Redhat's hardware probing utility.
Knoppix has fairly standard hardware requirements. It needs an Intel-compatible CPU (i486 or later) and 20MB of RAM for text mode, with at least 96MB for graphics mode with KDE. 128MB of RAM is recommended when using applications as resource-hungry as OpenOffice.org. As you'd expect, it requires a bootable CD-ROM drive, or a boot floppy and standard drive CD-ROM (IDE/ATAPI or SCSI). Finally, it also requires a standard SVGA-compatible graphics card and a serial, PS/2 standard, or IMPS/2-compatible USB mouse.
How It Works
The boot process resembles a standard CD distribution, but uses virtual drives in RAM. It can boot into either text or graphics mode, requiring more memory in the latter. The OS file system is a single, compressed, read-only file that uncompresses applications and utilities as required. The rest of the CD contains documentation and the boot kernel. Boot time can be anywhere from 30 seconds to two minutes, depending on your hardware.
The CD's bootloader offers you the opportunity to add kernel commands. These "cheat codes" control everything from device discovery to desktops and local language selection. You can view the options yourself by pressing F2 at boot-up time. The default booting process chooses a KDE GUI desktop environment. As the boot process continues, it creates the RAM disk, which is followed by the "hotplug" autoconfiguration process. Shell scripts automatically put in the correct settings for the services once the hardware has been identified. I was pleasantly surprised to see the ease in which my first attempt acquired an IP address from the DHCP server and had put itself on the LAN, ready to go.
Accessing 2GB of binaries from a 700MB CD is a neat trick. You'll find
everything from desktops including KDE and GNOME; development tools such as
kdevelop, and libraries; office suites such as OpenOffice.org, KOffice, and AbiWord; multimedia applications such as the Gimp; network and system administration tools such as
ethereal; services such as SMTP, POP,
FTP, HTTP, news, DNS, and SSH; and even games such as Frozen Bubble. There are,
of course, utilities permitting you to access the Internet via Ethernet, dialup,
and PPPoE. There is only one user account, called
the root account is automatically available on the console terminals which can
be reached pressing the CTRL-ALT-F3 buttons.
Customizing the Knoppix CD (Making Your own Self-Booting CD!)
Being Linux, the real trick is customizing the Knoppix CD for your own needs.
The following instructions outline a method to setup a Knoppix-based CD development environment. I've used this setup to complete a CD that will be included in an upcoming book on PostgreSQL. Because the book covers a whole gamut of database concepts from SQL basics to normalization and entity relationship diagrams, the reader needs to be able to see real examples with properly indexed references at the click of a mouse. He shouldn't have to delve into server compilation and configuration just to see how a SQL query works.
As the reader explores the business theory of database design — how a business and the services it provides determines the structure of a database — he should have working examples to explore and experiment with. Having a working server on an OS that doesn't require user configuration overcomes one traditional challenge when writing for Microsoft, Apple, and Unix DBAs in the same book.
One Way to Bake a Cake
The basic idea of making a Knoppix CD is to gather what you want on the CD by simulating it on the hard drive. You should be able to edit installed software and test your creation by rebooting the machine from the hard drive, via a bootloader, instead of wasting time burning it to a CD. This development environment mimics the CD, except it's significantly faster. Remember, this is not a standard Linux installation! Even though you are booting from the hard drive, you are in fact emulating an OS that is installed on a CD. When booted, the filesystem cannot be changed; it is read-only.
Your Required Knowledge Base
You will need the following skills to customize the Knoppix Linux Live-CD:
You must be comfortable with the command line.
You must understand how to create partitions on your hard drive.
You must understand basic
You should be familiar with a Linux bootloader.
You must understand how to add swap memory (using the
swaponutilities), unless you have 1GB of RAM.
You should be comfortable installing, updating, and removing software packages using the Debian distribution of Linux.
You will need the following ingredients to bake your CD:
One Knoppix CD.
1GB of RAM: Don't worry if you don't have this much RAM; swap space will work just as well.
One PC with an existing Linux distribution installed and at least two partitions:
Partition 1, where you will develop the Knoppix CD. It must have at least 4GB of free space, although you'll need 5GB if you are short on RAM.
Partition 2, a 710MB empty partition.
The command-line utility
create_compressed_fs, which can be copied from the Knoppix CD.
One kick list. This file lists packages that can be removed from the default distribution without "breaking" dependencies.
Miscellaneous shell scripts: user-defined scripts facilitating development.