LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Install to USB HDD, boot from CD/DVD (https://www.linuxquestions.org/questions/slackware-14/install-to-usb-hdd-boot-from-cd-dvd-357342/)

4partee 08-26-2005 05:15 PM

Install to USB HDD, boot from CD/DVD
 
Here's a twist on the boot from USB topic. I want to install Slackware to a USB HDD, but boot from CD/ROM.

This is surely a strange problem. My barely out of warranty laptop suffered water damage which killed the internal HDD and the primary IDE controller. I have booted it with a live CD so I know the CD/DVD on hdc works . There is no floppy either. I must boot from CD/DVD.

Since I cannot install a new HDD, I hope I can use a USB HDD as a root device. The bios, however, does not permit booting from a USB HDD. I am/was hoping that I can setup an initrd and them use mkrescue, or whatever, to boot from the CD/DVD.

I have done a full install to the USB HDD, but am stumped on how to create a bootable CD.

mscole 08-27-2005 09:07 AM

I am trying to do the same thing on a desktop. I spent all afternoon googling yesterday, and did not find the solution, but I did find some leads. It looks like there are two choices: recompile the kernel to have built-in support for USB, or make a customized initrd that loads USB support at boot time. I would prefer the second method, but as yet have not found a step-by-step that actually works for Slackware. See: http://www.linuxquestions.org/questi...5&pagenumber=1

Anyone done this successfully? It seems to me it shouldn't be too difficult.
Mike.

4partee 08-29-2005 11:01 AM

mscole, thanks for the link.

The insmod command used by initrd is from busybox and apparently does not handle gzipped modules. A make ;make install wil clear the 'not an ELF file" error message.

Another thing that helps in the long run is to address the sleep issue where linuxrc needs to wait until the usb/firewire root device in ready. My solution is to modify initrd-tree.tar.gz file used by the -c option of mkinitrd. In its bin folder I added ln -s busybox sleep and in linuxrc I added sleep 9 right after the section that loads the modules.

aikempshall 08-30-2005 06:54 AM

I've successfully installed slackware 10.0 and 10.1 to a USB harddrive. Also created a CD that will boot the USB harddrive. See the thread quoted above or search here for aikempshall for more information.

I hope to get a bit more script driven when I upgrade to 10.2 -

a script to compile the kernel with the necessary USB/SCSI support and other personalised kernel settings;
a script to create the bootable CD;
a script to create the initrd on the USB HDD.


Regards

4partee 09-02-2005 08:37 PM

Thanks mscole and aikempshall;

I am now booting a 120GB ide HDD in a USB enclosure on my otherwise broken laptop(no hda). I can boot from USB or a rescue CD.

mscole, are you still needing a solution?

mscole 09-05-2005 09:00 AM

I got it to work by booting the cd I made, and entering the following parameters at the "Boot:" prompt
vmlinuz initrd=initrd.gz root=/dev/sda3 ro hdc=ide-scsi
In my case, sda3 is the / partition, and hdc is my cd writer.
Mike.

baoiso 09-06-2005 09:44 AM

Hi All,

I am booting Slackware 10.1 on an external USB drive thanks to you all.

mscole, do this if you want to boot directly from your USB:

- Boot CD1 Slackware 10.1
- Mount /dev/sda3 and chroot
- Modified your lilo.conf and executed lilo.

You 'll get a warning messages saying that it's not the first drive.

You now have a portable linux distribution :)

Hope this help.

Baoiso

mscole 09-06-2005 10:42 AM

I can't boot from my external drive because the bios does not support it, so I will have to live with the boot cd (which isn't so bad).
Mike.

mscole 09-07-2005 06:40 PM

I have another problem with this boot cd. It works on the computer I made it on, but it does not work on my computer at the office, where I really need it. It hangs trying to mount the root partition of the usb drive, that is, /dev/sda3, telling me it does not exist. I managed to install lilo on the MBR of the usb drive, and I copied my initrd.gz and the initrd-tree to the /boot partition. Lilo loads, but again, it hangs when trying to mount the root partition of the usb drive. I have a "sleep 10" in the linuxrc file after it loads the usb modules. The usb modules seem to be loading, so I am stumpped. Any ideas?
Mike.

mscole 09-07-2005 07:25 PM

Here are the kernel messages on the screen when it stops:

PCI: Found IRQ 10 for device 00:1d.3
PCI: Sharing IRQ 10 with 00:1e.2
uhci.c: USB UHCI at I/O 0xff20, IRQ 10
usb.c: new USB bus registered, assigned bus number 4
hub.c: USB hub found
hub.c: 2 ports detected
Using /lib/modules/2.4.29/usb-storage.o
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 00:1d.1-2, assigned address 2
usb.c: USB device 2 (vend/prod 0x413c/0x2005) is not claimed by any active driver
hub.c: new USB device 00:1d.3-1, assigned address 2
usb.c: USB device 2 (vend/prod 0x46d;0xc016) is not claimed by any active driver.
kmod: failed to exec /sbin/modprobe -s -k block-major-8, errno = 2
mount: Mounting /dev/sda3 on /mnt failed: No such device or address
ERROR: mount returned error code 1. Trouble ahead.
mount: Mounting /dev/sda3 on /mnt failed: Invalid argument
mount: Mounting /dev/sda3 on /mnt failed: Invalid argument
/boot/initrd.gz: exiting
pivot_root: pivot_root: Device or resource busy
Freeing unused kernel memory: 120k freed
#

That's it. I had to type it all out (I am logged on to a Windows machine right now).
Mike.

4partee 09-08-2005 06:04 PM

I have seen this(mount: Mounting /dev/sda3 on /mnt failed: No such device or address) happen also.

Look in your /boot/initrd-tree/dev folder that was source for mkinitrd and make sure sda3 is listed.

mscole 09-09-2005 06:23 AM

It is listed in a file named rootdev, and the boot cd does the job on my home computer. Unfortunately I need it primarily for my work computer.
Mike.

mscole 09-09-2005 06:32 AM

It looks like one of my modules is not loading, but since usb-storage did load, and it is the last on my list in my load_kernel_modules file (see below), I don't see how this could be the case. Does anybody know which module the last line in these messages refers to?

usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 00:1d.1-2, assigned address 2
usb.c: USB device 2 (vend/prod 0x413c/0x2005) is not claimed by any active driver
hub.c: new USB device 00:1d.3-1, assigned address 2
usb.c: USB device 2 (vend/prod 0x46d;0xc016) is not claimed by any active driver.
kmod: failed to exec /sbin/modprobe -s -k block-major-8, errno = 2

My load_kernel_modules file, which forces the modules to load in the order listed:

Code:

# This is a script used to load the kernel modules.
# To use it, chmod it 755, and then add the insmod
# lines needed to load your modules, like this:

insmod /lib/modules/$(uname -r)/reiserfs.o
insmod /lib/modules/$(uname -r)/usbcore.o
insmod /lib/modules/$(uname -r)/ehci_hcd.o
insmod /lib/modules/$(uname -r)/uhci.o
insmod /lib/modules/$(uname -r)/usb-storage.o

Mike.

mscole 09-09-2005 06:58 AM

Here is part of my linuxrc file, note where I added "sleep 10" after the modules are loaded. The last lines here show where I am getting an error during boot.

Code:

# Mount /proc:
mount -n proc /proc -t proc

# Load kernel modules:
if [ ! -d /lib/modules/`uname -r` ]; then
  echo "No kernel modules found for Linux `uname -r`."
elif [ -x ./load_kernel_modules ]; then # use load_kernel_modules script:
  echo "/boot/initrd.gz:  Loading kernel modules from initrd image:"
  . ./load_kernel_modules
else # load modules (if any) in order:
  if ls /lib/modules/`uname -r`/*.*o 1> /dev/null 2> /dev/null ; then
    echo "/boot/initrd.gz:  Loading kernel modules from initrd image:"
    for module in /lib/modules/`uname -r`/*.*o ; do
      insmod $module
    done
    unset module
  fi
fi

sleep 10

# Initialize LVM:
if [ -x /sbin/vgscan ]; then
  /sbin/vgscan --mknodes
  sleep 10
  /sbin/vgchange -ay
fi

# If /rootdev isn't set, we'll have to trust exiting to work here.
# It's harder to clean up the initrd without a pivot_root,
# so it's a good idea to set rootdev (and rootfs) properly.
if [ -r /rootdev ]; then
  if [ "`cat /rootdev`" = "" ]; then
    exit 0
  fi
else
  exit 0
fi

# Switch to real root partition:
ROOTDEV=`cat /rootdev`
ROOTFS=`cat /rootfs`
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o ro -t $ROOTFS $ROOTDEV /mnt
ERR=$?
if [ ! "$ERR" = "0" ]; then
  echo "ERROR:  mount returned error code $ERR.  Trouble ahead."

Mike.

mscole 09-09-2005 07:01 AM

One other detail. The machine at home (where the cd works) is USB 1.something, and the machine at the office, where the cd does not work, is USB 2.0; I don't know whether or not that matters.
Mike.

stephenw 09-09-2005 09:55 AM

Hi Mike,

I've been having almost the exact same problem you're describing I think. I solved it (made it go away) by putting the "sleep 9" command immediately before the insmod for usb-storage. So in the load_kernel_modules file you'd have something like:

insmod /lib/modules/$(uname -r)/reiserfs.o
insmod /lib/modules/$(uname -r)/usbcore.o
insmod /lib/modules/$(uname -r)/ehci_hcd.o
insmod /lib/modules/$(uname -r)/uhci.o
sleep 9
insmod /lib/modules/$(uname -r)/usb-storage.o

and then run the mkinitrd again.

It appears you have to wait for the USB framework modules to find the device before loading the usb-storage driver for it.

Stephen

mscole 09-09-2005 10:54 AM

Stephen, I see this is your first post - welcome to LinuxQuestions. I made a new boot cd including the sleep command that you mentioned. It works on my home computer. Monday I will try it at the office, if it works there, I will post a step-by-step of how I did it.
Mike.

4partee 09-09-2005 11:03 AM

Hi mscole;

Try booting your work PC with install disk 1 and then look at lsmod. I am guessing that there is a difference in the usb modules due to different hardware at home. Try adding any module differences to your mkinitrd -m[list].


I have read that you could experience lockups due to loading modules when the hardware is not present. You might need to mkinitrd a separate home.gz and work.gz with corresponding lilo entries. I have not tried this though.

stephenw 09-11-2005 10:49 AM

Thanks for the welcome Mike! I've just been trying to get the same thing working with a 2.6.12 kernel (rather than the default 2.4 that comes with Slackware 10.0) and what I said above doesn't work for it. Instead the "sleep 9" needs to come after loading the usb-storage module, it seems. What kernel are you using? Maybe having a pause both sides is the safest bet.

I also tried the other option you mentioned before - that of compiling the usb stuff into the kernel. But this also fails due to this problem of having to wait for the drive to "appear". The kernel panic message about being unable to mount the root fs appears, then a few seconds later the messages from the usb-storage driver appear stating that sda is available. So you have to use an initrd just for the pause (or I suppose you could modify the kernel to have a "sleep 9" equivalent, but that seems a bit over the top:).

Also, for one bootup the 9 second pause wasn't long enough! So I've upped it to 12. There must be a better way of doing this...

4partee 09-11-2005 02:37 PM

Hi Stephen;

I am now using my broken laptop(no hda) as a router with the stock 2.6.12.3 kernel and modules from /testing. The laptop boots from an ide drive in an external usb enclosure.

If you would like, I could post the contents of my config files.

John

stephenw 09-11-2005 05:13 PM

Hi John

Thanks for the offer - but I think I now have my system working, but only with this "sleep" command in the initrd. Do you also have a sleep command in the initrd? It just doesn't seem a very "solid" solution. Maybe I'm being too fussy!

Stephen.

4partee 09-11-2005 07:10 PM

Hi Stephen;

Yes, I have sleep 9 in linuxrc after the modules have loaded..

There are kernel patches that will make the kernel wait until the root device is ready.

I have seen a linuxrc solution that runs a loop until the usb/firewire device is ready.

The sleep solution is a simpler solution.

John

stephenw 09-13-2005 03:49 AM

Rightio, I'll leave mine as it is now. Thanks for the info!

mscole 09-13-2005 10:01 AM

Well, my latest boot cd still does not work at the office. It has a sleep in the load_kernel_modules file just before the usb-storage module loads, and another sleep in linuxrc just after all the usb modules have supposedly loaded. The kernel is 2.4.29 (the bare.i install kernel from the slackware 10.1 cd). I plan to try a few more things that were suggested in this thread, and I will post the results, but I probably won't be able to do so for a day or two.
Mike.

mscole 09-13-2005 10:16 AM

Booted the slackware install cd at work, lsmod shows the following:

usb-storage
keybdev
mousedev
hid
usbkbd
input [used by keybdev mousedev hid usbkbd]
uhci
ehci-hcd
usbcore [used by usbstorage hid usbkbd uhci ehci-hcd]

Here is what is in my install cd load_kernel_modules file:

insmod /lib/modules/$(uname -r)/reiserfs.o
insmod /lib/modules/$(uname -r)/usbcore.o
insmod /lib/modules/$(uname -r)/ehci_hcd.o
insmod /lib/modules/$(uname -r)/uhci.o
sleep 9
insmod /lib/modules/$(uname -r)/usb-storage.o

What does hid do?
Mike.

4partee 09-13-2005 11:13 AM

Mike;

-m usbcore:ehci-hcd:uhci:input:usbkbd:hid:mousedev:keybdev:usb-storage:reiserfs

worked for my Averatec laptop(no hda).

I am using the stock 2.6.12.3 kernel and modules from /testing.

My Compaq PC used usb-ohci instead of uhci.

I was also able to make two mkinitrd gz's named averatec.gz and compaq.gz with corresponding lilo entries.

John

aikempshall 09-14-2005 05:14 AM

My boot CD will boot slackware of an external usb drive on my IBM T30 laptop with USB 1.1 and on two other desktops with USB 2.0.

I'd put sleeps in intially but I think I've since taken them out. When I get an opportunity I have another look at what I did. Some of the details are contained in an other thread on this site.

Regards

aikempshall 09-15-2005 01:11 AM

My load_kernel_modules contains -

# This is a script used to load the kernel modules.
# To use it, chmod it 755, and then add the insmod
# lines needed to load your modules, like this:

insmod /lib/modules/$(uname -r)/jbd.o
insmod /lib/modules/$(uname -r)/ext3.o
insmod /lib/modules/$(uname -r)/scsi_mod.o
insmod /lib/modules/$(uname -r)/sd_mod.o
insmod /lib/modules/$(uname -r)/usbcore.o
insmod /lib/modules/$(uname -r)/uhci.o
insmod /lib/modules/$(uname -r)/usb-storage.o

I do have ehci-hcd.o in my initrd-tree. It's the only issue I had the last time I made initrd.gz, can't remember if it's in or out. I suspect it's out. Will find for sure when slackware 10.2 is released.

Alex

10.2 released

using my old 10.1 .config ran it through make oldconfig;
compiled kernel (it automatically did the lilo stuff) ( I have a script called aik_kernel_compile that does all this)
installed the kernel ( Ihave a script called aik_kernel_install - I suspect this is a surperfluous step as this is a lilo boot machine)
removed the old 2.4.29 directory from my initrd-tree and created a new 2.4.31 initrd-tree directory, populated the new 2.4.31 initrd-tree directory with the 2.4.31 modules listed above - ehci-hcd.o is in, ran mkinitrd ( I have a script called aik_make_archos_initrd)
reran lilo;
rebooted.

Machine booted into 2.4.31 on the USB harddrive.


All times are GMT -5. The time now is 02:03 PM.