From Knoppix Documentation Wiki
Jump to: navigation, search


Knoppix is a GNU/Linux distribution that boots and runs completely from cd it can also boot and run completely from a USB drive.

You can create your own copy of Knoppix on USB using the tutorial below (and here: Bootable USB Key), or you can buy a USB stick with Knoppix here for $14.95 including shipping to anywhere in the world.

To boot an unmodified Knoppix from a USB stick or USB hard drive is quite easy although it requires a few steps. This tutorial assumes that you are already running GNU/Linux (and has been tested on Debian).

Attach your USB device to your computer and create a partition (using e.g. cfdisk) large enough to hold the contents of the ISO image plus about 5%. The rest of this discussion assumes that you can address this partition using /dev/sda1.

Create a file system on the partition. You can use an existing VFAT filesystem (to keep compatibility with Windows/DOS). Regardless, make sure the partition type (set when you partition the drive) matches the filesystem you install. (If they differ, grub-install will fail with a confusing message "file ...boot/grub/stage1 not read correctly".) Assuming you settle on an ext3 filesystem:

# mke2fs -j /dev/sda1

Warning: Newer versions of mke2fs now create filesystems with inode sizes of 256 by default (instead of 128), which is causing compatibility issues with a lot of ext2/ext3 tools out there. If you want to be able to access your files from windows (using explore2fs for instance) make sure you do this instead:

# mke2fs -j -I 128 /dev/sda1

To prevent fsck from being run on it:

# tune2fs -c 0 -i 0 /dev/sda1

Mount the partition and copy the contents of the KNOPPIX ISO image (named KNOPPIX.iso below) to it:

# mount /dev/sda1 /mnt
# mkdir knoppix
# mount -o loop ./KNOPPIX.iso knoppix
# cp -r knoppix/* /mnt
# sync
# umount knoppix
# rmdir knoppix

To set up Grub to boot from the USB drive, copy Grub's working files, namely, stage1, stage2 and the appropriate stage1_5 file, to the partition. It is easiest to simply copy all of Grub's files. Assuming your distribution has Grub's loader in /boot/grub:

# mkdir -p /mnt/boot/grub
# cp -r /boot/grub/* /mnt/boot/grub

(Note - You may want to try the grub-install command below before bothering to find those stage* files, since a recent version will do the copy itself.) To install the stage1 boot loader to the drive's master boot record (MBR), edit the file to tell grub-install that /dev/sda1 is a bios drive:

# echo '(hd0) /dev/sda' > /mnt/boot/grub/

and then install Grub to /dev/sda:

# grub-install --root-directory=/mnt --no-floppy '(hd0)'

Finally, create a menu.lst file. (Note: On Redhat/Fedora based systems, the grub configuration file is called grub.conf, not menu.lst as on Debian systems, so replace menu.lst with grub.conf below.) Look at /mnt/boot/isolinux/isolinux.cfg. These are the different default Knoppix configurations. The default configuration on 4.0.2 is:

APPEND ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix

Converting this to a Grub boot is relatively straight forward. On booting, the root is set to the boot device. This is the Knoppix partition which is exactly what we want. The line starting with DEFAULT tells isolinux which kernel in /boot/isolinux to use. APPEND tells isolinux the arguments to pass to the kernel. Grub needs to load the initrd on its own and the arguments go on the kernel line. With a bit of rearranging, we get the following:

title           Knoppix
kernel          /boot/isolinux/linux ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=minirt.gz nomce quiet BOOT_IMAGE=knoppix
initrd          /boot/isolinux/minirt.gz

Add the above to /mnt/boot/grub/menu.lst. Add the following lines to the beginning of the file to have Knoppix boot automatically:

default         0
timeout         2

Finally, unmount the partition.

# umount /mnt

You should now be booting Knoppix from your USB drive.

Booting to an Image on an Alternative Device

Poor Man's USB Based Boot (Boot from USB flash memory stick and then continue boot with Knoppix image stored on a harddisk or a CD or an external USB harddisk ) How To:

What you will need:

  • Computer with BIOS capable of booting from USB keydrive (select USB-HDD). (Unfortunately, some buggy BIOS just wont boot from my USB stick, such as all versions up to F9 for the Gigabyte GA-8IEXP motherboard).
  • USB keydrive that can boot as USB-HDD device. Make sure you read the product specification, only some USB flash sticks support this feature. (or see this 4/05 review on Ars Technica . Only 3 of 10 reviewed sticks are bootable.)
  • Linux with GRUB grub boot loader already installed. I just use Knoppix.
  • Read Win Partition Poor Man Installation for the more versatile boot mechanism we gonna utilize here.

Steps: (Cautions: Unmount usb stick before you remove it from USB slot to avoid data loss. Backup the MBR of harddisk and USB stick, see the link above)

  1. Insert the USB stick, use cfdisk to create a partition with boot flag on this device ( cfdisk /dev/sda ). Create a file system on the newly created partition.(eg. mke2fs -m0 /dev/sda1)
  2. Mount the partition and install grub boot loader on this device ( mount /dev/sda1 /mnt/usb && grub-install --root-directory=/mnt/usb /dev/sda ). Now the USB stick is already bootable, you will enter the interactive GRUB shell enviroment if you boot with it.
  3. Copy kernel and initrd to USB stick. To continue boot from an knoppix 3.6 ISO image stored on a NTFS/FAT harddisk partition, you will need the kernel and miniroot.gz files from Ruymbeke's files.
  4. Create a file menu.lst under dir /mnt/usb/boot/grub, I just copied the one from Ruymbeke's files pasted in Win Partition PMI. Specify the location of the newly copied kernel and minirt files in this file, note (hd0,0) is the first partition on USB stick when you boot from it, and the first harddisk likes to be hd1. To find out how GRUB map devices, press key c when you see GRUB boot menu at boot time, then type root ( and press TAB key, see the GRUB texinfo for detail.


I have created a 32M boot partition on a 128M USB flash stick, and use it to boot Knoppix ISO image stored in a FAT32 partition shared by Windows, or to boot ubuntu live CD (basemodule is Morphix) already copied to another partition. The purpose is to reduce the time to burn these Linux Live CDs and less CDs to carry with.