LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Strange behavior, while booting from an external Hard Drive (USB) (http://www.linuxquestions.org/questions/linux-newbie-8/strange-behavior-while-booting-from-an-external-hard-drive-usb-723081/)

vasmakk 05-02-2009 01:42 AM

Strange behavior, while booting from an external Hard Drive (USB)
 
Hi everybody!

recently I installed Debian/Lenny in my external USB hard drive (a Western Digital Passport Elite - 250 MB, which is USB powered ...) The steps I followed was:

1) I unplugged my Internal SATA Hard Drive and also my USB card reader device (which has 4 card slots). So the only device left plugged in was my SATA DVD-RW.

2) I connected my external Hard Drive to a USB port, and started a normal Installation of Debian/Lenny from the CD. Lenny "saw" my external HD as the only installable media /dev/sda. I made 3 partitions: /root (sda1) , swap (sda5 - logical) , /home (sda6 - logical). Finally I installed GRUB to the MBR of my external HD. And reboot ... (the first time I encounter an error 21, but the second time everything went fine)

3) I turned off my computer, plugged all my devices (internal HD and card reader) plugged my external HD and powered on my computer again... Changed BIOS options of-course, and also my GRUB boot parameters the first time ....

4) when I logged in, I changed the files fstab , menu.lst and uswsusp.conf because now /dev/sda is my Internal SATA Hard Drive, So (logically) /dev/sdb should be my external one ...

Here is the content of each file ...

fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sdb1 / ext3 errors=remount-ro 0 1
/dev/sdb6 /home ext3 defaults 0 3
/dev/sdb5 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0

uswsusp.conf

# /etc/uswsusp.conf(8) -- Configuration file for s2disk/s2both
resume device = /dev/sdb5
splash = y
compress = y
early writeout = y
image size = 1914332938
RSA key file = /etc/uswsusp.key
shutdown method = platform

menu.lst

default 0
...
timeout 5
...

## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.26-2-amd64
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sdb1 ro rootdelay=16 quiet
initrd /boot/initrd.img-2.6.26-2-amd64

title Debian GNU/Linux, kernel 2.6.26-2-amd64 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-amd64 root=/dev/sdb1 ro rootdelay=16 single
initrd /boot/initrd.img-2.6.26-2-amd64

### END DEBIAN AUTOMAGIC KERNELS LIST


Now, The problem Is:
When I want to boot from my external Hard Drive,

a) sometimes everything goes fine (like now) , my external HD is recognized as /dev/sdb and the login procedure proceeds normally ...

b) sometimes the GRUB fails with an error 21 , and not even show me the initial menu. (I suspect It cannot find some file ...)

c) sometimes the GRUB doesn't fail, but the kernel cannot enumerate my USB port, and label my device as /dev/sdf. Then throws me into ramdrive, expecting from me something to do. And the only command I know is reboot ...
I suspect It understands something like that ...
Internal HD sda
Card Reader sdb , sdc , sdd , sde
External HD sdf

Any Ideas ? Is it possible to change something at the boot parameters , or the configuration files ?
Is it because my Hard Drive doesn't have It's own power supply ? (Note this Drive has a very short USB cable - maybe USB power is not enough for booting ... but is adequate if the Drive acts as a storage device only)
Is it because my Hard Drive is "too fast" ? e.g I didn't have any GRUB problems with my USB stick earlier ...


Any help will be appreciated ...
Vas

Pearlseattle 05-02-2009 02:14 PM

Hello vasmakk!
I suggest doing some research in the direction of usb and/or drive not being recognized because of slow usb-scan.
This means that your drive and/or USB-controller might be too slow starting up to be seen when it is needed.
Concerning your problem with the boot process stopping throwing you into ramdrive you could add/change something like...
Code:

rootdelay=30 doslowusb
...which would raise the search of the root fs from your 16 to 30 seconds and the "doslowusb" which would probably do as well something (never found out exactly what it does).

On the other side your grub-21-error is more serious, especially because it happens from time to time. Perhaps there your BIOS is changing behaviour from time to time?

Sorry I couldn't help more.
:(

hurry_hui 05-02-2009 02:32 PM

You might want to (re)configure your kernel so all supports for USB block devices are built-in.

You can also modify stanza so any 'root=/dev/your-hdd' refers to label or UUID. By doing so, boot sequence is no longer an issue.

vasmakk 05-02-2009 04:54 PM

Hi !

Pearlseattle, your solution seems to work. Thank you! In my previous attempts, I consider changing only the rootdelay value. Now with doslowusb things are O.k. Still I'm having problems with error 21, especially after reboot. When I turn on my Pc (from scratch) having already plugged in my HD, this error occurs rarely ...


Vas

vasmakk 05-02-2009 04:58 PM

hurry_hui, your solution seems somewhat advanced for a newbie like me ...
I'll try it when I learn some more stuff about the kernel.
Thanks anyway...

Still If somebody else have an opinion about the error 21 matter, I'll be glad to hear it ...

Vas

Pearlseattle 05-02-2009 05:22 PM

Happy to hear that :)
hurry_hui is right too:
when you download the kernel sources and configure it ("make menuconfig"), you can choose the USB-thingies to be compiled inside the kernel ("Y") instead as of modules ("M"). That jumps over the need to load the USB-modules separately once the kernel is being started.
Unluckily this doesn't solve the problem of your error 21.

If you would have an external case with a separate power connector you could try to start the external case before the PC - that way the HDD would for sure be ready by the time the PC boots from USB.
But I have to admit that grub's error 21 in your case is a little bit misterious - in the end if your PC is able to read grub's executable it should be able to read as well the rest (excluding root fs), or? And I don't think that "the rest" is affected by config files, as the boot medium, if alone, is (I think) always the first HDD (I am referring to "<your_boot_partition>/grub/device.map").
Greetings.

vasmakk 05-02-2009 05:46 PM

Quote:

Originally Posted by Pearlseattle (Post 3527998)
Happy to hear that :)
...But I have to admit that grub's error 21 in your case is a little bit misterious - in the end if your PC is able to read grub's executable it should be able to read as well the rest (excluding root fs), or? And I don't think that "the rest" is affected by config files, as the boot medium, if alone, is (I think) always the first HDD (I am referring to "<your_boot_partition>/grub/device.map").
Greetings.

I never had an error 21 isue, with my USB Kingston stick ... Same Installation procedure as here. Anyway I shall try install debian/lenny in a seperate powered ext. USD drive next week, and see what happens.

By the way i found somewhere the scandelay=x boot parameter, which is also for slow devices... (x in secs) Could I use it in place of doslowusb ?

Vas

vasmakk 05-02-2009 06:51 PM

Same problems, again!

Quote:

Originally Posted by vasmakk (Post 3528015)
I never had an error 21 isue, with my USB Kingston stick ... Same Installation procedure as here...
Vas


And what a pitty! I found this in ubuntu forums, and explains a lot...

" USB hard drives are not particularly good for using as bootable devices because they can fail to spin up in time for the BIOS to find them. Sometimes it can take a few attempts to get them to boot each time you want to use them.
Flash drives do not suffer from this problem and are far better for use as external bootable devices "

The problem is, I don't want a USB stick device and I don't want a dual boot system either... I prefere a portable linux system on a regular HD.


Vas

vasmakk 05-03-2009 02:19 AM

Hi everyone!

I think the problem solved ... (I mean, so far so good ...)
Along with the doslowuci option I had to add doscsi. The rootdelay=30 doesn't seem to have an effect since it is executed after the USB devices have being enumerated ... This is what I found:

doslowusb This adds some extra pauses into the boot process for the slow USB CDROM of the IBM BladeCenter.

doscsi This loads support for most SCSI controllers. This is also a requirement for booting most USB devices, as they use the SCSI subsystem of the kernel.

I also changed the timeout parameter (menu.lst) from 5 to 15... Not sure If this matters but anyway ...

As for the grub error 21 ... I connect my HD on a motherboard USB port directly, (not a USB hub in the front side) and then turn on my PC.

Regards
Vas


All times are GMT -5. The time now is 11:31 AM.