Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to boot a Knoppix ISO from Grub like so:

loopback loop /boot/iso/knoppix.iso
linux (loop)/boot/isolinux/linux lang=en bootfrom=/mnt-iso//boot/iso/knoppix.iso
initrd (loop)/boot/isolinux/minirt.gz

My question is the bootfrom parameter. If I don't include the double slash the system will never boot. It will complain that it couldn't find the KNOPPIX folder on the drive (Because it's inside the ISO).

It will search the drives in an attempt to locate this folder - by the end of which drives have appeared in /dev/ from sda1 to sdz15.

  • If I include the double-slash in the bootfrom parameter it will search the drives a few times, then (presumably after mounting /mnt-iso) it will triumphantly state "Yay! I found it in /dev/sdd5/boot/iso/knoppix.iso"
    Of course by this time sda1 through sdh15 have been generated in /dev/ so this can't be a good thing.

  • If I use bootfrom=/dev/sdd5/boot/iso/knoppix.iso it works straight away, but I can't guarantee it will be this device on all systems. Can I use UUID?
    I read that in fedora 15 you could use root=live:UUID={uuid}:{isofile} but this doesn't seem to be the case any more

  • Why does it behave differently if I have only one slash?

This is very confusing.

Edit: Progress!

With the following menuentry I've managed to get knoppix to claim to open and check an ISO file, only to claim it can't find the KNOPPIX folder therein.

Cannot find KNOPPIX dir in iso image:

loopback loop /boot/iso/knoppix.iso
linux (loop)/boot/isolinux/linux lang=en bootfrom=UUID=<uuid>/boot/iso/knoppix.iso
initrd (loop)/boot/isolinux/minirt.gz

It's hard to tell what's going on because the TTY is small and the text doesn't wrap.

Edit: Yet more progress. After going through half the the knoppix repo with a fine tooth grep I decided to see if the problem was in the kernel since obviously the rest of the system wasn't being loaded anyway.

strings linux | grep "Cannot find" - No results

Well what about initrd.gz? (Note that I have no idea what's in here, I heard somewhere that it was an actual chunk of memory)

Ooh there's another archive in there... Ooh there's a filesystem! What's in this big file named init?...

   if [ ! -r "$BOOTSYS/$knoppix_dir/KNOPPIX" ]; then
    message  "${CRE}${RED}Cannot find $knoppix_dir dir in ISO image ${MAGENTA}${BOOTDEV}${YELLOW}/${BOOTFILE}${NORMAL} "

REALLY? Who on earth makes the error message use a clearly separate variable from the condition?

All right, at least I know the exact line of the problem (591) but the only way I see out of this is an extremely hackish attempt to mess with this bash and hardcode it to let me through... Or to set my partition in question to sda. And of course I don't know how to do either yet. Yay! So. How do I go about editing init?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Turns out the init script in knoppix's initramfs is spaghetti code.

In particular it was hardcoded to only really accept devices in the format /dev/sdxy causing problems with longer pathnames and UUID alike.

I just made a new initrd, cut out that whole section and hardcoded my UUID into it. Of course it's not that easy. The knoppix initrd is so small it doesn't have things like blkid or the ability to mount by UUID=.

I ended up finding the device file with fdisk and grep:

message  "${CRE}${RED}This minitrt has been hacked by Jonathan Vollebregt due to the horrific state of the knoppix init. You are about to see a very dirty hack.${NORMAL} "

  echo "Hardcoded identifier awaits: Using fdisk and partition details to match device"
  echo "grepping '/dev/sd.5.+4096.+57935871.+28965888.+83.+Linux'"
  BOOTDEV=`fdisk -lu`
  BOOTDEV=`echo "$BOOTDEV" | grep -E "^/dev/sd.5.+4096.+57935871.+28965888.+83.+Linux$"`
  BOOTDEV=`echo "$BOOTDEV" | grep -o "^/dev/sd.5"`

  if [ -z "$BOOTDEV" ]; then
   echo "Well shit..."
   sleep 1m
  fi

  echo "Device file: $BOOTDEV"
  echo "mkdir -p /mnt-hack"
  mkdir -p "/mnt-hack"
  echo "mount -t ext4 -o ro $BOOTDEV /mnt-hack"
  mount -t ext4 -o ro "$BOOTDEV" "/mnt-hack"

  BOOTFILE="/${BOOTFROM#*/}"
  echo "Stripping also reveals: /$BOOTFILE"
  echo "mount -t iso9660 -o ro /mnt-hack/$BOOTFILE $BOOTSYS"
  mount -t iso9660 -o ro "/mnt-hack/$BOOTFILE" "$BOOTSYS"

  echo "knoppix_dir=$knoppix_dir"
  echo "BOOTSYS=$BOOTSYS"

The partition in question is fairly unique in size, so I doubt I'll have a collision any time soon.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.