[ FloobyDust ][ Previous | Next ]

Knoppix Linux and Grub Bootloader on USB Flash

Updated 2007.11.30

Introduction

Why Bother

Make Drive Bootable

Installing grub and Knoppix

  1. Format if necessary and set partition active.  Since I had reformatted the fob many times during the experimental phase of this effort It needed to be restored to "maximum bootability" by running the HP format tool.  This partitioned and formatted the fob, and also set its partiton active.  If the fob hadn't been screwed up by my fiddling, I could have used Linux Fdisk (above) after booting Knoppix from CD.

  2. Boot Knoppix from CD and plug in the flash drive.  CD copying will probably run faster if DMA is enabled.  It seems to be enabled by default for 5.0 and later.  For pre-5.0 Knoppix, type "knoppix dma" at the isolinux prompt to enable DMA on all drives at boot time, or wait until Knoppix is running and a root shell is open and use:

    Or from the KDE menu:

  3. Mount/remount the flash drive read-write.  From the desktop cause the drive to be automounted by left clicking on it.  (This doesn't always work with Knoppix 5.1.1 and maybe other versions.  See "Automount" below.)  Then right click and select

    Alternatively create a mount point and mount it (or remount it) manually.  It shows up as sda1 in my example.

  4. Copy the CD contents to the fob.  This took about 12 minutes (without enabling DMA - so turn on DMA!).  With lots of RAM the command prompt will return fairly quickly but the copy is not complete until the fob LED stops flashing.

  5. Copy the grub files from the running Knoppix CD to the fob.  (Or from the fob to the fob...)

  6. Put a distinct marker on the fob so the grub files can be readily located when running the grub install.  Without this convenience running "find /boot/grub" as often suggested finds all Linux installations including Knoppix.

    NOTE: steps 4 & 5 (and maybe 6) are the simplest way to copy and create the boot files, but may limit bootability with some BIOS implementations.  See "Grub Error 18" below.

  7. Install grub to the fob's MBR.  The setup command uses "(hdX)" to put the 1st stage in the MBR.  "(hdX,Y)" would put it in the boot sector of partition "Y".  For most BIOSen, installing to the MBR is sufficient.  Also installing to the partition's bootsector also allows booting on some confused BIOS versions.

  8. Create /boot/grub/menu.lst on the fob.  I used one derived from the fob's /boot/isolinux/isolinux.cfg.  Isolinux is used when booting the CD version.  It would be convenient to boot from grub to isolinux and pick up the boot options directly but I haven't figured out how to do that - or if it is even possible.  Failing that the boot options can be used in grub's menu.

    This menu has options to boot to a full-graphics system with DMA forced on (BEEZIX 5.1.1B0.1 X DMA), with DMA forded off (BEEZIX 5.1.1B0.1 X NODMA), a command line only option (BEEZIX 5.1.1B0.1 CMD LINE), a full-GUI boot that doesn't try to bring up the network in DHCP mode - since a bug in 4.0.2 may hang the boot on some configurations 5.0+ should be OK with DHCP - (BEEZIX 5.1.1B0.1 X NO DHCP), a "failsafe" mode (BEEZIX5.1.1B0.1 FAILSAFE, a guess at a Windows boot (WINDOWS MAYBE), a boot direct to a memory test (MEMTEST), a free DOS implementation, and some drive diagnosis and paritioning tools.

    The drive tools and DOS are floppy images and may not/will not boot from USB fob on most machines.  There are here on the off chance that they will boot, and for consistency with the isolinux menu in the CD version, where they _do_ boot and run.

    NOTE:  with the exception of the first entry, these menu entries do not explicitly enable hard drive and optical drive DMA.   DMA off seems to default to OFF for pre 5.0 Knoppix and ON for 5.0 and later.  For pre 5.0, add "dma" (without the quotes) to the "kernel" lines to enable dma for all drives at boot time or use one of the options described below ("Bugs and Features") to enable DMA once Knoppix is running.

    For Knoppix 4.0.2, I noticed what seems to be a bug in passing boot options when done this way.  The "lang=us" doesn't always work unless it is the last option on the line.

    Further, the "failsafe" choice may be  more likely to cause booting to fail!  It is here because it was in isolinux.cfg.  I don't know how useful it is.  The "memtest" option is slick.  It lets you boot to a memory test ASAP.  This menu also attempts to make a Windows boot available.  It assumes that if you have Winxx it is installed on the first partition of the first drive.  The makeactive command may not be appropriate for all installations.  If your system boots via a partition other than the first one on the first drive this may set your system to boot directly to windows.  The "map" commands are necessary since at boot the USB fob is drive (hd0).

    Here's my menu.  This is actually the one I used for the final BEEZIX version, not the simple remasterd Knoppix.  (the browser's line wrapping will probably foul this up.  The lines that start with "kernel" continue on one line through the "lang=us" boot option.  The next line starts with "initrd".  Here's a full-page version that may be easier to read:  Knoppix/grub menu.lst or raw text file for download if that's convenient:  menu.lst 

     

    # menu.lst for BEEZIX 5.1.1B0.1 installation on USB thumb drive

    default=0
    timeout=10
    splashimage=(hd0,0)/boot/grub/bootsplash.xpm.gz

    title BEEZIX 5.1.1B0.1 X DMA
            root (hd0,0)
            kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init apm=power-off vga=791 nomce dma lang=us
            initrd /boot/isolinux/minirt.gz

    title BEEZIX 5.1.1B0.1 X NO DMA
            root (hd0,0)
            kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init apm=power-off vga=791 nomce nodma lang=us
            initrd /boot/isolinux/minirt.gz

    title BEEZIX 5.1.1B0.1 CMD LINE
            root (hd0,0)
            kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init apm=power-off vga=791 nomce 2 lang=us
            initrd /boot/isolinux/minirt.gz

    title BEEZIX 5.1.1B0.1 X NO DHCP
            root (hd0,0)
            kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init apm=power-off vga=791 nomce nodhcp lang=us
            initrd /boot/isolinux/minirt.gz

    title BEEZIX 5.1.1B0.1 FAILSAFE
            root (hd0,0)
            kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init vga=normal atapicd nosound noapic noacpi pnpbios=off acpi=off nofstab noscsi nodma noapm nousb nopcmcia nofirewire noagp nomce nodhcp xmodule=vesa lang=us
            initrd /boot/isolinux/minirt.gz

    title WINDOWS MAYBE!!!!!
            map (hd0) (hd1)
            map (hd1) (hd0)
            rootnoverify (hd1,0)
            makeactive
            chainloader +1

    title DOS
            root (hd0,0)
            kernel /boot/isolinux/memdisk
            initrd /boot/isolinux/balder.img

    title MEMTEST
            root (hd0,0)
            kernel /boot/isolinux/memtest

    title SPINTOOL generic disk tools
            root (hd0,0)
            kernel /boot/isolinux/memdisk
            initrd /boot/isolinux/spintool.img

    title DISKTOOL Hitachi & generic disk tools
            root (hd0,0)
            kernel /boot/isolinux/memdisk
            initrd /boot/isolinux/disktool.img

    title SC TOOLS 1
            root (hd0,0)
            kernel /boot/isolinux/memdisk
            initrd /boot/isolinux/scfloppy1.img

    title SC TOOLS 2
            root (hd0,0)
            kernel /boot/isolinux/memdisk
            initrd /boot/isolinux/scfloppy2.img

     

How to boot

 

Knoppix Bugs and "Features"  - Vary with version

  1. lang=us

    The "lang=us" boot option has to go at the end of the kernel line

  2. DHCP boot hang.

    Booting with DHCP enabled will hang the boot on some systems.  Seems to be fixed in 5.0.1.

  3. DMA not enabled in pre-5.0.1.

    DMA isn't enabled by default (apparently).  Some docs indicate that DMA should be enabled by default on all hard drives and optical drives.  This doesn't seem to be the case on any of my machines so maybe that isn't true.  Disabling DMA by default is probably the conservative choice since some chipsets can cause read errors or file system corruption under Linux with DMA enabled.

    Drive reads and writes will run faster (!) if DMA is enabled.  Type "knoppix dma" at the isolinux prompt (or add dma to the kernel options in the grub menu) to enable DMA on all drives at boot time, or wait until Knoppix is running and a root shell is open and use:

    Or from the KDE menu:

  4. USB 2.0 driver not loaded.

    As mentioned in the 4.0.2 bug list, there is a typo in linuxrc in the compressed miniroot used to boot Knoppix 4.0.2.  Which causes the USB 2.0 driver not to load.  This causes slow USB operation (and booting) in most cases, and in some cases the "Can't find Knoppix filesystem" boot failure in others.  My P4 wouldn't boot my fob after a BIOS upgrade, and some boxen just don't boot the fob at all.

    In the "boots but no USB 2.0 driver" situation, just issue

    and that will load the missing module.  The failure to boot case requires repairing and replacing the miniroot.  See "Bugs & Fixes" on my Remaster Knoppix page for a description of the fix for 4.0.2.  Knoppix 5.0.1 seems to have fixed the problem.

  5. Grub Error 18.

    Some BIOSen that can boot from USB can't access disk addresses beyond 8MB.  If grub stage 1_5 or the "kernel" that grub tries to boot (minirt.gz in the case of Knoppix) is beyond that address grub will halt with "Error 18".  (It's OK if the main kernel is above 8MB, but the initially booted "kernel" can't be in the case of a limited BIOS capability).

    To avoid this problem and maximize "bootability", keep /boot/ at the beginning (lowest addresses) of the USB fob.  Starting with an empty formatted fob, copy the /boot directory from the cdrom to the fob, then create /boot/grub and copy the grub files and create the fob_flag file, then copy the rest of the cdrom - excluding /boot/.

    /boot and its sub directories take up about 7MB currently and fit within the limit.

  6. Free DOS won't boot.  (5.1.1)

    A missing "memsdisk" entry prevents Free Dos from booting.  See the  Remaster Knoppix page.

  7. No CDROM icon on desktop.  (5.1.1)

    The CDROM icon doesn't appear until some other drive icon is clicked.

  8. USB fob doesn't always automount.  (5.1.1)

    This varies.  A FAT32 will sometimes not automount when plugged in.  The error is "can't determine file system type".  It can still be manually mounted:  mount -t vfat /dev/something /mnt/something

     

XP issues

 

Fill In The Blanks

 

[ FloobyDust ][ Previous | Next ]