oreilly.comSafari Books Online.Conferences.


Using and Customizing Knoppix
Pages: 1, 2, 3

Part 3. Making a New Bootable CD

After much work, you now have a working image of the Knoppix distribution on the hard drive, the file system has been copied, and you have the scripts and the requisite RAM. Creating a successful, bootable CD is the process of removing and adding packages, followed by fine-tuning services and the user's account configuration files. Let's make it happen!

Step 1: Upgrading and installing packages

The very first thing to do is to make sure that your distribution has the most recent libraries and security patches. You can do this with the network applications available from the live-CD distribution. My own preference is to use my original, native distribution. GNU/Linux, as Debian calls itself, is remarkable in its ease of applying updates and patches. Knoppix is just as easy, by virtue of its lineage. You just need to use the Debian package management utilities to update the OS.

Assuming you are connected to the Internet, on your normal installation version of Linux, open a console as root and navigate to the KNOPPIX_remastered directory. Run chroot to get a new root directory:

bash-2.05# /usr/sbin/chroot ./

You may see a race condition consisting of /dev/null permission denied messages. If that happens, remount the drive with the nodev option set. Here's a sample configuration that I put in my own fstab file:

/dev/hdc1 /mnt/linux ext2 (rw,nosuid,nodev) 0 0

You will also need to mount the /proc file system within the console to allow Internet access and the use of such utilities as screen:

bash-2.05# mount -t proc /proc proc

At this point, I always invoke the screen application, since I always move from activity to another and end up running several jobs at the same time (such as reading documentation while doing an upgrade). Before going onto the Internet, assuming that you put your primary OS online before chrooting, make sure the chrooted resolv.conf file has the correct DNS entries for successful name resolution.

Updating the distribution will resynchronize the package index files from their sources. Use the apt-get update command. Upgrading will install the newest versions of all packages currently installed. You are now ready to install a package and all of its dependencies (though you may need to go to the Debian site to figure out the package name). Use the apt-get install <package name> command.

Step 2: Removing what you don't want

The process of removing packages correctly is critical. Removing too little means you can't install what you want, due to space restrictions on the CD. Removing too much runs the risk of removing those packages that make the live-CD functional. The Knoppix site has a lot of information on the subject of remastering on the Knoppix site. The technique presented here is to remove packages via a kick list.

The kick list is an ordered list of my personal list of unwanted packages. It is by no means the final word, so be prepared for a bit of experimentation as you figure out what you do and don't want. Copy the list and place it inside the chrooted root directory. The order of packages listed has been carefully researched. Editing the text file is straightforward; packages near the top do not have any packages dependent upon them. However, they themselves may be depend on packages listed further down. When you're satisfied with the list of packages to remove, use the command:

bash-2.05# apt-get remove `cat ./mykicklist.txt`

An alternate command uses the purge switch to remove configuration files specific to that package:

bash-2.05# apt-get purge `cat ./mykicklist.txt`

It is recommended to begin by removing only a small subset of packages; start with a small kick list. Don't worry if you make a mistake — you can use the same list to replace those removed packages:

bash-2.05# apt-get install `cat ./mykicklist`

If you would like to remove packages based on their size, then try this to see where you should start:

bash-2.05# dpkg-query -W --showformat='${Installed-Size} ${Package}\n' |
	sort -nr | less

Running apt-get clean will free up disk space after you've finished removing packages. You can run the scripts to make your compressed file system once you're satisfied with your changes. The remastering FAQ has more tips on removing and cleaning your installation. Remember to unmount /proc when you've completed editing your packages.

Step 3: Altering the desktop configuration

To tell you the truth, I love the Knoppix desktop and user interface setups, so I didn't change mine very much. But there will be times when you will want to change those defaulted user account settings. You can change user configurations in one of two ways:

  • Use the command-line options at boot time to tell the OS to read configuration instructions from a device such as a diskette.

  • Alter the following distribution configuration files that are invoked at boot time:

    /etc/init.d/xsession /etc/init.d/knoppix-autoconfig

Step 4: Running the scripts

You've fine-tuned the packages and configuration scripts. Now it's time to see your creation work. If you haven't already done so, now is the time to invoke (if you need the swap) and to run the free command to make sure you have 1GB of RAM. You will now cycle through the following steps until you're satisfied with your creation:

  • Create the hard drive mounted version of the distribution by invoking

  • Reboot the PC and test the prototyped distribution.

  • Make changes by rebooting back into your development environment.

    I don't recommend making configuration adjustments while in the prototype distribution environment, because it's too easy to get confused between the files you want to change and those that are temporary and in RAM.

  • Once you are satisfied with your creation, invoke to create the self-booting isoimage, knoppix.iso, which can then be burned to a CD-R.

Permanently Installing the Live CD Operating System onto the Hard Drive

Do you like what you've created? Would you like to put this on your machine permanently as a real installation? Guess what? You can! There is a utility on the Knoppix live-CD that will create and format a file system and a swap partition, and will mirror the CD's file system to the hard drive. What is especially cool about this process is that it will install a true home directory with the standard session logins that you'd find in any standard installation of Linux.

Running the knoppix-hdinstall command will invoke a script that asks several questions, including where you want to install the distribution, the swap partition, and the type of the filesystem (ext2, ext3, reiser, or xfs). It will ask for user accounts that you may want to install, along with a password. The script finally copies the entire compressed file system from the CD onto the hard drive. Take note: there are no questions about configuring graphics or selecting applications to installed. After all, that's the whole point to this CD!


This article has just scratched the surface of what the Knoppix live-CD can do. Unfortunately the only published books on this distribution are in German. Although I've referenced Linux as the primary development platform, it is quite reasonable to extend this development environment onto other UNIX and Unix-like environments, such as Solaris and FreeBSD.


Knoppix home site

man Pages

  • fdisk, the partition table manipulator for Linux
  • resize2fs, the ext2 file system resizer
  • mke2fs, to create a Linux second extended file system
  • losetup, to set up and control loop devices
  • lilo, to install the bootloader
  • lilo.conf, the lilo configuration file
  • mkswap, to set up a Linux swap area
  • dd, to convert and copy a file
  • free, to display the amount of free and used memory in the system
  • swapon, to enable devices and files for paging and swapping
  • swapoff, to disable devices and files for paging and swapping
  • mkisofs, to create a hybrid ISO9660 filesystem
  • chroot, to run a command or interactive shell with special root directory
  • screen, a screen manager with VT100/ANSI terminal emulation
  • apt-get, the APT package-handling utility

Robert Bernier is the PostgreSQL business intelligence analyst for SRA America, a subsidiary of Software Research America (SRA).

Return to the Linux DevCenter.

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: