Preparing Knoppix


To access the files in Knoppix, you first must uncompress them. You've already mounted the Knoppix CD at /cdrom, so now create a directory in which you can store the files from the CD. Substitute the directory names with the location of your home directory: mkdir /home/knoppix/knoppixiso. Note that some commands will need to be executed as the root user.

Copy all files from the Knoppix CD except for the KNOPPIX/KNOPPIX file:

 $ cp -r /cdrom/[a-z]* /home/knoppix/knoppixiso $ mkdir /home/knoppix/knoppixiso/KNOPPIX $ cp -r /cdrom/KNOPPIX/*.* /cdrom/KNOPPIX/images /home/image from book    knoppix/knoppixiso/KNOPPIX/ 

The KNOPPIX/KNOPPIX file contains the compressed contents of the Knoppix Live CD and is quite large, which is why you're extracting it separately. There are two different ways to uncompress the KNOPPIX/KNOPPIX file: by mounting it manually or by using the cloop utilities. Both are discussed in the following sections. If you have installed Knoppix or a similar distribution, choose the former because it is quicker.

Mounting the KNOPPIX/KNOPPIX File

To mount the KNOPPIX/KNOPPIX file, your current install needs the cloop kernel module driver. Load this kernel module first just to be sure:

 # modprobe cloop file=/cdrom/KNOPPIX/KNOPPIX 

If this command succeeds, you're in luck: Your system has the cloop kernel module. If this command fails, you can retrieve the cloop package from http://altlinux.com/index.php?module=sisyphus&package=kernel-modules-cloop-std26-up or http://morphix.org/debian/cloop-2.6/ (or search the Web for other sources) and compile the kernel module against your current kernel. Alternatively, you can uncompress the KNOPPIX/KNOPPIX file with the cloop command-line utilities, as discussed in the following section.

 $ mkdir /tmp/mountdir # mount -o ro -t iso9660 /dev/cloop /tmp/mountdir 

If all goes well, the Knoppix files are now available in /tmp/mountdir. However, the files are read-only. Copy the files to a writable directory:

 $ mkdir /home/knoppix/knoppixuncompressed # cp -a /tmp/mountdir/* /home/knoppix/knoppixuncompressed/ 

Then clean up the remaining files:

 # umount /tmp/mountdir # rmdir /tmp/mountdir 

Now you have access to all the Knoppix files and can modify them at will. Skip the following section and head straight to "Installing and Removing Software."

Using the cloop Command-Line Utilities

If you don't have the cloop kernel module, don't worry: There is another way that will just take more time. To extract the KNOPPIX/KNOPPIX file, you must have the extract_ compressed_fs command-line tool. This is always the case when using a Knoppix install. Check whether it exists:

 # whereis extract_compressed_fs 

If nothing comes up, you'll need to install the cloop-utils package. If you are running a Debian or Debian derivative, this is easily done using apt-get:

 # apt-get install cloop-utils 

Otherwise, retrieve the latest cloop tarball package (version cloop_2.01-5.tar.gz at the time of this writing) from http://morphix.org/debian/cloop-2.6/ or a Website of your own choosing. Download the package to /tmp and uncompress it:

 $ cd /tmp $ tar zxvf cloop_2.01-5.tar.gz 

Now compile and install the cloop utilities:

 $ cd cloop-2.01 $ make # cp create_compressed_fs extract_compressed_fs /usr/local/sbin/ 

The key to extracting the KNOPPIX/KNOPPIX file is, you guessed it, extract_ compressed_fs:

 # /usr/local/sbin/extract_compressed_fs /cdrom/KNOPPIX/image from book KNOPPIX > /tmp/knoppix.iso 

This command takes some processing time, so grab some coffee. You'll see feedback as cloop does its job, showing you each block as it is extracted. On a Pentium III 1GHz system, it takes about five minutes to extract 30,728 blocks.

Now the KNOPPIX/KNOPPIX file is extracted as an ordinary iso9660 file. It can be mounted using a loopback device:

 $ mkdir /tmp/mountdir # mount -t iso9660 /tmp/knoppix.iso /tmp/mountdir -o loop 

Finally, copy over all the files over to your writable directory:

 $ mkdir /home/knoppix/knoppixuncompressed # cp -a /tmp/mountdir/* /home/knoppix/knoppixuncompressed/ 

When you've finished, clean up the remaining files:

 # umount /tmp/mountdir # rm /tmp/knoppix.iso # rm /tmp/cloop* 



Hacking Knoppix
Hacking Knoppix (ExtremeTech)
ISBN: 0764597841
EAN: 2147483647
Year: 2007
Pages: 118

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net