How to reconfigure the minirt image

Forum: USB booting
Topic: How to reconfigure the minirt image
started by: PaulFXH

Posted by PaulFXH on Aug. 10 2007,08:44
I want to boot DSL 3.4 from one of my external (usb) HDDs. However, the BIOS in my Dell Dimension 4550 doesn't allow booting from an external drive.
Nevertheless, it is fairly easy to overcome this by letting the vmlinuz (linux24) and initrd (minirt24) images load from somewhere accessible (e.g. a bootCD or an internal drive), loading the initial RAM disk (which must have modules to allow access to the external drive) and then changing the root (within /boot/grub/menu.lst) to wherever DSL is mounted (on the external drive) so that booting can proceed.
I've already done this with quite a number of other Linux distros but DSL is causing me a problem.
I hope somebody with more experience can help me resolve this.
From what I can see, DSL 3.4 initial RAM disk already has the ability to access an external usb drive so no other modules need to be included.
The problem, for me at least, seems to be that insufficient delay is allowed to give the external drive time to "get up to speed" before it's asked to allow booting to the "real" root.
I believe I need to open
Code Sample

and then change this line
Code Sample

to allow a delay of 20 seconds.
After this the minirt24 image must be reconfigured.
My problem is that I cannot find how to do the reconfiguring.

Can somebody please
1) tell me if my reasoning is correct
2) show me how to build/create a reconfigured initrd image (minitr24)


Posted by curaga on Aug. 10 2007,09:15
Sorry, but that's completely wrong.. DSL doesn't use Debian's mkinitrd, the DSL image (actually Knoppix's) was handcrafted.

But to edit it just gunzip and loop mount it, and add a sleep statement in linuxrc just after loading usb modules..

BTW did you try the "waitusb" bootcode? it is exactly for waiting for slow usb devices...

Posted by PaulFXH on Aug. 10 2007,10:29
did you try the "waitusb" bootcode? it is exactly for waiting for slow usb devices...

Thanks for your reply. No, I have not come across the "waitusb" command before but I gave it a try.
The entry for DSL that I used is as follows:

Code Sample

title     DSL 3.4
root     (hd0,5)
kernel   /boot/linux24    root=/dev/sdb1
initrd    /boot/minirt24.gz   waitusb=20

Unfortunately, this did not allow me to boot into DSL as no "delay" seems to have resulted.
Interestingly, I find that once DSL drops me to the (very limited) shel (when it can't locate the "real" root), I can continue the booting just by typing "exit" whereupon, it finds the external derive and proceeds to boot. Indeed, I'm sending this from DSL now.

I would be grateful if you, or anybody else, can take a look at my /boot/grub/menu.lst entry for DSL and comment on where I placed the "waitusb" option.


Posted by curaga on Aug. 10 2007,11:49
it does not take arguments, and linux options are placed in the "kernel" line.. Here's a fixed ver:
title  ---DSL 3.4---
root (hd0,5)
kernel /boot/linux24 root=/dev/sdb1 waitusb
initrd /boot/minirt24.gz

Posted by tinker on Aug. 10 2007,14:07
I understand how PaulFXH didn't find this. Waitusb is not on the wiki page about startup commands. One can find it easily  if they do a forum search for waitusb as keyword but one would have to already know it existed. Winnowing through the chaff of all posts about usb to find that as an available boot option would be a larger task. I learned something from this to add to my notebook too, thanks curaga.
Posted by curaga on Aug. 10 2007,15:18
You're welcome :) I'll go add waitusb to the wiki..
Posted by PaulFXH on Aug. 10 2007,19:08
I'm afraid the "waitusb" command just didn't work for me and gave exactly the same "error" as before.
So, then I tried to insert a "sleep" command into the linuxrc part of minirt. My procedure was:
1) copy minirt.gz to a /tmp folder on my Desktop (actually on another partition where I run Ubuntu -- only because I'm more comfortable in Ubuntu right now)
2) gunzip this file to minirt
3) mount this (using -o loop) to another folder on the Desktop
4) edit linuxrc to include "sleep 30" at line 247 which is just after the usb_storage module has been loaded
5) unmount the folder where minirt was mounted
6) gzip the "new" minirt
7) copy the .gz image to the /boot folder on the DSL partition

However, this also did not make any difference and I get the same error.

Now, I'm beginning to think that my primary problem is not the lack of time needed for the usb drive to swing into action. This is because in every case the "error" is: (Note that this is transcribed rather than copy/pasted):

Scanning for USB devices.....done
Looking for CDROM on /dev/hda2
Can't find Knoppix filesystem
Dropping you to a (very limited) shell)

Nevertheless, to get the boot going again is extremely easy and just requires typing "exit" or Ctrl-d
It therefore seems that linuxrc is looking for the filesystem on a CDROM (whereas it's on the HD) and gives up when it doesn't find it.
On this basis, perhaps some more drastic surgery is needed on the linuxrc.

I'd welcome more experienced comments before applying my newbie scalpel.


Posted by curaga on Aug. 11 2007,06:46
Maybe you put the sleep in the wrong place..

I think it is the fact your drive is slow, since boot works after exiting the limited shell.. Linuxrc is set to look on any hd???/sd???/sr???/scd?? it can find in the system..

Posted by PaulFXH on Aug. 11 2007,14:10
Badly need some help here with this "sleep" command.
I have already tried it in FOUR (4) different locations in the linuxrc file (with times actually up to 300 seonds which is 5 minutes). But, there does not seem to be any delay/wait/sleep whatsoever no matter where I put the command and no matter how long it is..
Here is the part of the file showing where I put the sleep command (sleep 20). It's around about line 340. I realize I put it in a loop which means the total delay/sleep should have been about a minute -- but as far as I could see there was no delay at all.
Could you please cast an eye over it and see if anything looks strange.
Code Sample
# New: also check HD partitions for a KNOPPIX/KNOPPIX image
test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd?[1-9] /dev/sd?[1-9][0-9]"
DEVICES="$DEVICES /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd";;; esac
for i in $DEVICES
echo -n "${CRE}${BLUE}Looking for CDROM in: ${MAGENTA}$i${NORMAL}   "
sleep 20
if mountit $i /cdrom "-o ro" >/dev/null 2>&1
if test -f /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME
echo -n "${CRE} ${GREEN}Accessing DSL image at ${MAGENTA}$i${GREEN}...${NORMAL}"
umount /cdrom

Posted by curaga on Aug. 11 2007,17:22
D'oh! There isn't a sleep command included in ash, I guess..

The sleep command is fine in your quote though..
Solution: compile busybox with only sleep statically, name it "sleep", copy it to /sbin in the initrd, and modify that command to say /sbin/sleep 20

Posted by PaulFXH on Aug. 11 2007,23:41
This really is turning into a never-ending saga.
I was puzzled why with all of the multitudinous changes I had made to the linuxrc in the unzipped minirt24.gz, not one single change seemed to have been made to the performance of the boot  -- always the same error, always the same time.
So, I commented out this line in linuxrc
Code Sample
echo -n "${CRE}${BLUE}Looking for CDROM in: ${MAGENTA}$i${NORMAL}   "

but it still showed up when I rebooted.
Now this is intruiguing. So, where is the boot getting its instructions from?
Please help -- I'm really very lost here.

Posted by curaga on Aug. 12 2007,09:29
Whoa. You sure you overwrited the previous image?
Posted by PaulFXH on Aug. 12 2007,10:50
Yes, I am sure.
Certainly the changes I make in linuxrc are there when I open up linuxrc the next time to make the next change.
I might just try a test where I substitute linuxrc with a totally empty file (of the same name) and zip up the minirt24 and see how it works on bootup.
My belief is that it will not make any difference.
I'm going to try this and I'll post back.
When I made these sort of changes to intrd.img on other distros I always had to re-configure the initrd.img (dpkg-reconfigure or mkinitrd) but I'm not doing anything here other than zipping things up and trying again.
Am I missing anything?

Posted by curaga on Aug. 12 2007,11:05
No.. But some text is shown twice, first in linuxrc and then during knoppix-autoconfig..
Posted by PaulFXH on Aug. 12 2007,11:07
OK, I renamed linuxrc to something else and substituted it with a totally empty text file, unmounted the "new" minirt24, zipped it and copied it to the boot directory of my DSL partition.
Sure enough, the boot just went exactly as it has done for the last two days -- absolutely no difference.
Hmmm.... what to do next?

Posted by PaulFXH on Aug. 12 2007,11:13
some text is shown twice, first in linuxrc and then during knoppix-autoconfig

I have not come across knoppix-autoconfig before.
Given that the test I did with an empty linuxrc seems to show that this file is (at least partially) ineffectual, should I be looking to make some changes in the knoppix-autoconfig?

Posted by curaga on Aug. 12 2007,15:54
You sure you edited the right file? Maybe your bootloader points to another initrd, because that file does count..
Posted by curaga on Aug. 12 2007,15:55
knoppix-autoconfig is inside the DSL core, so it's harder to edit..
Posted by PaulFXH on Aug. 12 2007,19:21
Well, I have good news and bad news.
I was making a monumental error with the minirt24 file I was editing (I was editing the minirt24.gz from the /boot in the DSL partition on the external HDD whereas -- because I can't boot directly from the external drive -- the kernel and initrd.img equivalent are called from the internal HDD). Anyway that explains a lot -- particularly why the sleep command wasn't working and why booting went ahead even when linuxrc was an empty file.
OK, so having made this prodigious breakthrough I inserted a 10 second sleep into linuxrc and rebooted to DSL. Yes, the delay certainly occurred this time and the external drive was totally ready to go -- but then the very same error message re-appeared about not finding the KNOPPIX image.
But then I saw this comment in the linuxrc

# Harddisk-installed script part version has been removed
# (KNOPPIX can be booted directly from HD now).

Does this indicate that only a CDROM image is being looked for and not anything on a hard disk?
Certainly, it looks at a whole list of devices (I think it's 45) but if it's only looking for something on a CDROM, this could be why it can't find anything on my external drive.
Perhaps I need to use a different minirt24 or hack the one I have to make it look for a HD image.
Given how easy it is to boot from the external drive, this might not be too difficult.
Any thoughts?

Posted by PaulFXH on Aug. 12 2007,23:17
OK, I managed to apply the appropriate hacks to the linuxrc file so that it boots without stopping.
This essentially involved inserting the command "exit" immediately after the TTY1 call (shell) as well as a few cosmetic changes to take out unnecessary stuff.
BTW, although the sleep command certinly works, I did not after all have to use it.
Thanks for all your help

Posted by curaga on Aug. 13 2007,15:20
You're welcome

It does look for HD's though, but glad you sorted that out :)

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.