PDA

View Full Version : Unmodified Knoppix 6.2.1 on GRUB-booted external Unix USB device, from scratch



Capricorny
06-07-2010, 11:04 AM
You don't need Unetbootin, extlinux or brain-damaged HD installs to run Knoppix on "pure Linux".
I haven't tried several variations of the method yet, and I know too little about what made the first attempts not work, but I got a USB-mounted harddisk up and running with GRUB and 6.2.1 without any great expertise. The same should work with sticks, but hard disks are maybe less variable in their interactons with computer BIOSes???

I did all steps running the Knoppix 6.2.1 from the internal HD install.

1. Partition the drive, one 20+ GB Linux partition plus eventually some more. I used 250 GB for ext3, plus 40 GB for FAT32 (Data exchange+++). I could have added swap, but that's not strictly necessary. As GRUB happily boots multiple systems, you could have multiple partitions to have room for more systems.

2. Setup ext3, possibly with smaller block size, turn off fsck. See instructions on this site.

3. Mount a partition with a plain working GRUB installed. Without this, I seemed to get problems.

4. Mount the ext3 partition, /media/sdb1 works just nice.

5. Run grub-installer


grub-installer --recheck --no-floppy root-directory=/media/sdb1 /dev/sdb


6. If this does NOT work, you'll have to analyze why. Check that there is a boot-directory with subdirectory boot/grub. Check the contents of device.map there. You may have to repair your MBR if things have gone terribly bad - cheer up, it's not too hard to fix.

7. Prepare for booting Knoppix. Make a subdirectory under boot and copy the necessary files there. (See my harddisk install post)

8. Create or edit boot/grub/menu.lst. There may be a lot of confusion as to which drive is which during the early stages of booting. I used the entry for the HD install as template, but added the cheat code fromhd=/dev/sdb1 to make sure the KNOPPIX on the partition would always be used.

9. You can check the booting with qemu

qemu /dev/sdb

10. Copy the entire KNOPPIX 6.2.1 structure to the partition, without any modifications in the first place. I used a backup to copy from, avoiding copying from the live system.

Now you should be able to boot from the USB, and choose the resident Knoppix 6.2.1 to run. At least, I was :)

There are several advantages to this approach compared to syslinux/extlinux. One possible great advantage vs FAT32 installs, is that we can make larger persistent storage. But I haven't tried out that yet.

This method should also be usable for setting up disks outside their target machines for mounting later. Only drive/device names should have to be modified, or are there more complications?

I'm still sure someone can come up with some perverse reasons for still doing "ordinary" HD installs of Knoppix, but to me, those excuses are getting more perverse all the time.

Capricorny
06-29-2010, 02:48 PM
I think setting up a separate booting partition may be even safer, as GRUB and it's loading kernels etc can then live entirely in peace, and all kinds of distro changes can take places outside of the booting realm, the only changes to booting being kernel updates etc. I also wonder if installing GRUB from another distro might be a defensive move. Myself, I'm going to start using CentOS as a second installed OS version, to test out applications for Redhat Enterprise Linux (RHEL) use. So, maybe I will be installing GRUB from there, to a separate partition.

Capricorny
06-10-2011, 02:27 PM
From bad experiences (not mine) with grub not being able to run on corrupted journaling file systems, I have come to the conclusion that whenever possible, I should heed the old advice and create a separate boot partition, also on usb-sticks etc.

If we place that partition at the "end" of the stick, it is not disturbing much, so here's what I do:

1. I typically create a N-0.3 GB first partition, and a 0.3 GB boot-partition on the stick.

2. Format the boot-partition with ext2, the other with anything usable.

3. Mount the boot partition.

4. Next, install grub on the MBR of the stick and the boot-partition

grub-install --root-directory=/media/sdb2 /dev/sdb5. Create a boot subdirectory, and copy over the Knoppix boot files from /mnt-system/boot/syslinux - I assume you are running from a version with correct boot-directory:

mkdir /media/sdb2/boot/knx644
rsync -ax /mnt-system/boot/syslinux/ /media/sdb2/boot/knx6446. Create a suitable menu.lst file with boot entries first for the stick, e.g.



default=1
timeout=10


title Knoppix 6.4.4 all arch
kernel (hd0,1)/boot/knx644/linux ramdisk_size=100000 lang=en keyboard=no fromhd=/dev/sdb1 nosound vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq loglevel=1 tz=localtime
initrd (hd0,1)/boot/knx644/minirt.gz

title Knoppix 6.4.4 64 bits
kernel (hd0,1)/boot/knx644/linux64 ramdisk_size=100000 lang=en keyboard=no fromhd=/dev/sdb1 nosound vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq loglevel=1 tz=localtime
initrd (hd0,1)/boot/knx644/minirt.gz
Note that the correct init parameters may vary with release, I was quite confused when booting 6.4.4 with the seemingly innocent 6.2.1 init line gave different strange errors on booting, leading me to suspect file corruption. Copy the actual APPEND line from syslinux.cfg and edit.

One nice thing with this setup, is that you don't have to reinstall the booting machinery for booting other OS versions, devices etc. Just add subdirectories under /boot with the correct files (when necessary), and edit the menu. Just varying minirt.gz (one per directory) is a simple and safe way of experimenting with different system setups.

AFAIK, this simple editing is not easy with grub2. So I can't regard that version as neither grand nor unified. But bootloader, maybe yes.

Capricorny
06-24-2011, 12:00 PM
1. I typically create a N-0.3 GB first partition, and a 0.3 GB boot-partition on the stick.



Add: "Make the boot partition active". Just forgot to do that when setting up a 1TB WD Passport this way, with at tiny boot partition at the end.

Capricorny
07-08-2011, 04:02 PM
Update for SD and micro SD cards: For larger than 2GB cards, using a small boot directory has been necessary. I have successfully set up micro SD cards with grub this way, booting from a card reader. I have, however, not been able to boot from a smartphone (Android 2.2) using the same card. Running Knoppix off the card in the phone works, though.

I have found legacy grub very handy for such hardware, but haven't tried grub4dos so far. The boot partitions at the end of the sector list does not seem to interfere with ordinary use of the card in cameras, phones etc. One of the really practical things with grub, is that I can add multiple entries to accomodate different boot configurations.

Beware of drive designations when using cards in multiple card readers!