Knoppix in your pocket

USB keys have become a really cheap method of stor­age, and have reached sizes up to 2GB. In this month's column, I'll show you how to install Knoppix - a distribution of Linux that runs entirely from CD - on a USB Key drive, making it even more portable.

These instructions will work for any Knoppix-based Linux distribution (www.knoppix.net). There are many variants on Knoppix, including Damn Small Linux (www.damnsmalllinux.org), a tiny 51MB version of Knoppix intended for use on a CD business card. As luck would have it, Damn Small Linux is perfect for use on smaller 128/256MB USB keys, and I've included a copy of the latest Damn Small Linux CD Image on this month's cover CD.

Before proceeding with the Knoppix installation, back up and erase all of the data from your USB Key. The chances are that the Knoppix installation will take up most of the space on the key, and the process is much easier to perform on an empty drive.

Installation from CD

I have carried out the entire installation for this article while running Knoppix directly from a CD. This article assumes you will do the same. First, attach the USB key to your computer and wait a few seconds for it to be detected. Many keys have a light that will flash when the key is initialised by the operating system. To confirm the key is detected, type the following command in a shell and look for a message similar to the one below:

$ dmesg Attached scsi removable disk sda at scsi2, channel 0, id 0, lun 0

This message tells me that my USB key has been detected and its name will either be /dev/sda or /dev/sda1 depending on the model of the key. In my case the key is /dev/sda, but it may be /dev/sda1 in your case.

To carry out the Knoppix installation, you will need to be root to execute most commands. To become root, type the following command and the prompt will change to a # character, as indicated for the rest of this article.

$ su

The first step is to copy the Knoppix CD to the USB key. First mount the key by typing:

# mount /dev/sda /mnt/sda # cd /mnt/sda

If the mount command fails, try a different device name such as /dev/sda1.

Next, copy the Knoppix CD to the USB key with the following commands. This will probably take some time as you will be copying around 700MB of data.

# cp /cdrom/boot/isolinux/* /mnt/sda # cp -r /cdrom/KNOPPIX/ /mnt/sda

The following step is the hardest part of the installation process. We need to modify Knoppix to detect and boot from the USB key instead of a CDROM, which it has been designed for. To perform the modification, first make a copy of the 2.4 kernel root environment with the following commands:

# mkdir /mnt/miniroot # cp minirt24.gz /tmp

This environment is compressed in the GZip format, the file must first be decompressed before it can be accessed. Type the following to decompress the environment:

# gunzip /tmp/minirt24.gz

Now we can mount the environment as if it is another disk on the computer. Use the following command to mount the file as a live file system.

# mount -o loop /tmp/minirt24 /mnt/miniroot

To perform the modification, open the file /mnt/miniroot/linuxrc in a text editor (for example type # vi /mnt/miniroot/linuxrc). Under Knoppix version 3.7 (released 08/12/2004) the line we need to go to is #326 and contains the following text. To skip to this line in vi, type :326

line 326 test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES=" $DEVICES /dev/sd?[1-9] /dev/ sd?[1-9][0-9]"

Immediately after this line, add the following text. To do this in vi press A once you have highlighted the end of this line using the arrow keys, next hit and type the line below. When you are done in vi hit and type :wq to save the changes to disk.

test -n "$FOUND_USB" -a -z "$NOUSB" && DEVICES=" $DEVICES /dev/sd?[1-9] /dev/ sd?[1-9][0-9]"

Now that the modification has been completed, we need to recompress the root environment and copy it back to the USB key. Use the following commands:

# cd /tmp # umount /mnt/miniroot # gzip minirt24 # cp minirt24.gz /mnt/sda

You can perform the same operation on the minirt26.gz file contained in /mnt/sda if you want, this environment is for the 2.6 kernel included with Knoppix 3.7. We're almost there! The last step is to make the USB Key bootable. First, some housekeeping with the following commands:

# cd /mnt/sda # mv isolinux.cfg syslinux.cfg # rm isolinux.bin boot.cat

Finally, enter the following commands to make the USB key bootable:

# cd / # umount /mnt/sda # syslinux /dev/sda

To try the USB key, shut down your computer and enter the BIOS menu (you can access this by pressing or on most computers during the first screen that appears immediately after turning your computer on). In the BIOS menu go to the boot menu and adjust the boot order to feature any item with USB in it toward the top. Most commonly, a USB key will boot from the device named USB-Zip or similar.

A WATCHED POT...

In researching for this article I came across distrowatch.com. A freshmeat.net style Web site devoted entirely to new Linux distribution news. Distrowatch.com is the ultimate directory for Linux distributions and contains excellent information on the major software and features of every distribution you can imagine. This Web site is a great resource for uncovering weird and esoteric versions of Linux devoted to tasks such as firewalls and business card CD demonstrations.

DAMN, THAT'S SMALL

Damn Small Linux is a tiny Knoppix derived distribution intended for use on 3in business card CDs. The distribution includes a basic set of desktop applications, the names of which may not be familiar as size rather than features has been the main reason for the choice of each, designed to cover most day-to-day uses of a computer.

A word processor is included, but the feature set is more akin to Microsoft Write than Word. Media players and IM clients are well supported, as are many standard network tools such as a Web browser (Firefox) and FTP clients.

The GUI for DSL is Fluxbox, a unique window manager based on Blackbox, an old window manager known for its amazing speed and futuristic looks. While attractive. Blackbox wasn't the easiest system to use, especially for new users migrating from Windows or Mac. Fluxbox improves the user experience of Blackbox somewhat, but it's still a work in progress and will take some getting used to.

After starting Damn Small Linux you'll see the Fluxbox desktop. At the bottom is the virtual desktop navigator and a bar indicating the currently focused application. Right-clicking on the desktop will bring up a menu of available applications and tools. Icons have also been setup for many common tools.

Fluxbox has an excellent documentation section, especially for advanced users, available at: http://fluxbox.sourceforge.net/docbook.php.

Join the newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

David Coyle

Brother PocketJet PJ-773 A4 Portable Thermal Printer

I rate the printer as a 5 out of 5 stars as it has been able to fit seamlessly into my busy and mobile lifestyle.

Kurt Hegetschweiler

Brother PocketJet PJ-773 A4 Portable Thermal Printer

It’s perfect for mobile workers. Just take it out — it’s small enough to sit anywhere — turn it on, load a sheet of paper, and start printing.

Matthew Stivala

HP OfficeJet 250 Mobile Printer

The HP OfficeJet 250 Mobile Printer is a great device that fits perfectly into my fast paced and mobile lifestyle. My first impression of the printer itself was how incredibly compact and sleek the device was.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?