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.


All times are GMT -5. The time now is 02:57 AM.