Strange behavior, while booting from an external Hard Drive (USB)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ...
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 ...
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?
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 ...
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.
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 ?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.