Welcome! Log In Create A New Profile

Advanced

USB "device not ready" on cold boot

Posted by lorenzo 
lorenzo
USB "device not ready" on cold boot
October 29, 2010 01:08AM
Hi there,

I was wondering if anybody has seen this before: all work fine after a software reboot, but when I shutdown the device (halt or shutdown -h) unplug the power an the plug it back, the device/uboot fails on usb "device not ready" and, after a while, it defaults to the stock image on the internal flash.

My uboot log is below. The device is a dockstar STDSA10G-RK, the usb flash is plugged in the side socket.

cheers,
Lorenzo


U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
Marvell-Dockstar/Pogoplug by Jeff Doozan
Hit any key to stop autoboot:  0 
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 3 USB Device(s) found
       scanning bus for storage devices... Device NOT ready
   Request Sense returned 00 00 00
1 Storage Device(s) found
** Bad partition 1 **
Device NOT ready
   Request Sense returned 00 00 00
** Can't read from device 0 **

** Unable to use usb 0:1 for fatload **
Creating 1 MTD partitions on "nand0":
0x000002500000-0x000020000000 : "mtd=3"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=3"
UBI: MTD device size:            475 MiB
UBI: number of good PEBs:        3791
UBI: number of bad PEBs:         9
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     0
UBI: available PEBs:             3750
UBI: total number of reserved PEBs: 41
UBI: number of PEBs reserved for bad PEB handling: 37
UBI: max/mean erase counter: 1/1
UBIFS error (pid 0): ubifs_get_sb: cannot open "ubi:rootfs", error -19
Error reading superblock on volume 'ubi:rootfs'!
** Bad partition 1 **
** Block device usb 1 not supported
** Block device usb 2 not supported
** Block device usb 3 not supported
** Bad partition 1 **
** Bad partition 1 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!
stopping USB..
### JFFS2 loading 'uboot-original-mtd0.kwb' to 0x800000
Scanning JFFS2 FS: ........ done.
### JFFS2 load complete: 524288 bytes loaded to 0x800000
## Starting application at 0x00800200 ...
Re: USB "device not ready" on cold boot
November 01, 2010 08:31AM
Interrupt uboot. Initialise usb with this command:
usb start

When you see the error message run the above command again. Is usb initialised after this command is run for the second time? If it is, you probably need to add the command to bootcmd to ensure reliable booting.
Mike
Re: USB "device not ready" on cold boot
November 04, 2010 03:47PM
Hello Lorenzo,
did you ever get this to work?
I am having the exact same problem. On cold-boot the dockstar goes into the Pogoplug image, on sbin/reboot it boots properly.
Thanks,
Mike
Mike
Re: USB "device not ready" on cold boot
November 04, 2010 06:49PM
Update:
It seems that this depends on which USB stick you use. I have a Kingston DataTraveler 101 G2 and it would not cold-boot.
Here is what worked for me:

Once it cold-boots into the PogoPlug environment, you can use /usr/sbin/fw_setenv to change boot parameters. I changed the "bootcmd" parameter (DANGER!) to add a "usb stop" and then another "usb start", which now lets my USB stick cold-boot.

Original code:
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset

Modified code:
bootcmd=usb start; usb stop; usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset

The cold boot will take quite a while since the first "usb start" fails, but then the "usb stop" and the next "usb start" seem to work. It adds only 2-3 seconds to the warm-boot (/sbin/reboot), so for me that was acceptable since now my Dockstar will boot properly into Plugbox-Linux after a power outage.

Hope that helps,
Mike
Re: USB "device not ready" on cold boot
November 04, 2010 07:04PM
You can also try tweaking the usb_rootdelay variable; I think that's the one that says how long to wait before timing out (I could be wrong and it could be bootdelay; I couldn't find it after searching through the forums). Booting from cold, some USB devices take longer to become ready. When doing a warm reboot, they're already ready, so it works. Try "fw_setenv usb_rootdelay 20" and see if that helps. Default value is 10.

Jeff, you need a Wiki we can modify with common problems and possible solutions. :-)
Mike
Re: USB "device not ready" on cold boot
November 05, 2010 09:18AM
I had tried setting "usb_rootdelay" to 15 and that didn't help. Also, I was using netconsole as described in this post for troubleshooting, and that already adds a bootdelay of 10 seconds. That delay didn't help resolve the issue either in my case. So there was already at least a 10 second delay until "usb start" was called, you can see it counting down when using netconsole.
I suspect it's something internally in the "usb start" command, some timing issue between turning on the usb functionality for the first time and enumerating the devices.
Re: USB "device not ready" on cold boot
November 06, 2010 08:12PM
I so glad other people are experiencing the same problem I am with usb stick/hard drive not starting up.

I didn't have this problem in the past, so I guess some conflict somewhere on bootloader.
Re: USB "device not ready" on cold boot
November 09, 2010 12:08AM
I too have seen "Device not ready" errors, both warm and cold boots, with my $20 1.8" 20GB Toshiba
drives. I have not seen this error with any of my other disks or flash drives.

U-boot's "usb start/reset" always finds the Toshiba, but the subsequent "fatload/ext2load" fails
randomly with "Device not ready". I have also observed that once a kernel (either Linux or FreeBSD)
is loaded and executed, my Toshiba drives run normally with no "Device not ready" errors.

My conjecture is that there is a subtle incompatibility between U-boot and my Toshiba that is not
present in Linux/FreeBSD kernels. My workaround is to have U-boot load the kernel from a working
usb device, then let the (more robust?) Linux/FreeBSD kernel deal with my Toshiba's. E.g.,

1. Plug the problematic Toshiba into one of the two rear usb ports--the Toshiba is usb 0.

2. Plug a known working flash drive with the kernel into the Dockstar's side port--the
flash drive is usb 1.

3. Start the usb, i.e, usb start

4. Load the kernel from the flash drive, i.e., fatload/ext2load usb 1 ...

5. Run the normal "usb_set_bootargs" and "go 0x..." to execute the loaded kernel, which uses
usb 0 (my problematic Toshiba) as the root file system.

I don't know if this workaround also applies to other non-booting "Device not ready" drives.
But, it's a simple experiment if you have a serial Dockstar connection and a known working drive.
And, it's a great use for the tiny/worthless (16MB, 32MB, 64MB) flash drives in your junk box!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: