Return to Tips and HOWTOs

Creating a KNOPPIX or FreeDOS USB Stick in Linux

Using a variety of tools.

Big head start given by http://www.marlow.dk/site.php/tech/usbkeys

Requirements:

The software I used to successfully install onto my PQI I-Stick 2.0 and onto my Lexar JumpDrive Lightning is, as of this writing, of very recent vintage. You may have success with older versions, but, of course, they may or may not work. In some cases, I could see where different versions work better for booting on different BIOSes and USB hosts.

Software and minimum versions needed:

Software Version
install-mbr >=1.1.8
syslinux >= 3.0.8
dosfstools >= 2.11
dd any version
dd_rescue (optional) any version
KNOPPIX >=3.9
FreeDOS Lite >=0.9 Final

Prerequisites:

For FreeDOS:
Download the FreeDOS Lite file set.

For KNOPPIX:
Download KNOPPIX (via BitTorrent). KNOPPIX 3.9 pretty much Works For Me(tm) out of the box, though the home= persistent storage component appears to be broken in this version. See the 3.9 bug list (number 17), and see this KNOPPIX forum post from user “uw2005” for an interim solution. NOTE: Currently testing KNOPPIX 4.0.2 for issues (12/6/2005). Will update guide to reflect applicable bug fixes.

Steps:

1. Backup orginial MBR from USB device, or backup entire device.

MBR backup:

dd if=/dev/<usb device> of=originial-mbr-usb.dd bs=512k count=1

MBR+entire device:

dd if=/dev/<usb device> of=usb-backup.dd

NOTE: Some guides recommend writing the filesystem directly to the device without partitioning. I prefer to create a partition map. Each works, take your pick. This guide assumes at least one primary partition on the USB key.

2. Create Partitions.

cfdisk /dev/<usb device>

I made a bootable Win95 FAT16 partition (type 0E), but many prefer the safest route and choose DOS FAT16 (06). Size to fit your needs.

3. Install simple boot manager to Master Boot Record.

install-mbr -v -p [boot partition #] /dev/<usb device> # Note: no partition, root device only

4. Create filesystem on first partition.

mkdosfs -F 16 -vc /dev/<usbdev>[partition #]

NOTE: dostools >= 2.11 defaults to FAT32 for partitions > 512MB, FAT16 for less. Specifying “-F 16” forces FAT16.

5. Install SYSLINUX to first partition.

syslinux -s /dev/<usbdev>[partition #]

(the -s installs the “simple, slow and stupid” syslinux boot code. Use this to ensure the ability to boot on a wider scope of BIOSes.)

6. Mount the first partition.

mount -v /dev/<usbdev>[partition #] /mnt/usb # or the mountpoint of your choosing

7. Mount the ISO image of the OS to install.

Unless you are a SuperLinuxGuru who has created their installation setup already on your local filesystem, you’ll probably need to mount the filesystem contained within an ISO or DOS IMG file. Do this:

modprobe loop # unless statically built into your kernel
mount -o loop knoppix.iso /mnt/iso # or the mountpoint of your choosing

or, for something like FreeDOS…

modprobe loop # unless statically built into your kernel
mount -o loop fd1440.img /mnt/floppy # or the mountpoint of your choosing

8. Copy the files over to your partition

cp -pr /mnt/[iso,floppy]/* /mnt/usb/

9. Post-Install/First Boot

OK, you should be done with the installation. You can feel free to tweak the files on the usb key, though.

Once the installation has been tailored to your liking, reboot. Go into your BIOS, and add the proper USB-* device to the beginning of your boot device list.

I’ve had some BIOSes require USB-HDD, but most, apparently, work with USB-ZIP. The easist is to make both of those USB-* boot device types the 1st and 2nd boot devices selected in the list.

Troubleshooting (random tips, really):

install-mbr installs a very simple boot manager. If it has a problem booting to a partition, MBR presents a simple interface allowing booting from the physical floppy, or partitions 1, 2, 3, or 4 on the boot device. You can narrow down the locus of the problem, as well. Here’s a simple guide to locate the problem:

  • If you see something like “Boot failed” or the boot falls through to your 3rd boot device, you either have a BIOS that cannot boot USB devices, or you need to run install-mbr again, as shown above.
  • If you see “MBR”, then the boot process made it to the MBR installed by install-mbr.
  • If you see “boot:” and the SYSLINUX header, you made it past the MBR and onto SYSLINUX

2 comments

2 pings

    • Rob H on January 18, 2008 at 2:35 pm

    Hi,

    Thanks for the very straightforward guide.

    This is working so far but syslinux starts to boot and I get “Could not find kernel image: linux”

    Have you seen this? Any ideas?

    Thanks!

    • Jesse on January 21, 2008 at 1:58 am
      Author

    Hi Rob. I’m not sure – is this for a KNOPPIX install? Did you create a FAT 16 partition? Was the partition type 0E or 06?

  1. […] because I had no idea what to do, I decided I’d try the SYSLINUX route. Attempting to follow this guide, I managed to get SYSLINUX running on my flash drive. I copied a ‘boot sector image’ […]

  2. […] now. I have another thumb drive with a better setup and will try that one instead. Also, I made it bootable with a version of FreeDOS and the FlashSPI.exe file from the upgrade package offered by […]

Leave a Reply

Your email address will not be published.