• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Access USB key earlier ???  (Read 3337 times)
rexyboy
Newbie
*

Karma: 0
Posts: 4


View Profile
« on: December 13, 2010, 04:16:17 AM »

Can someone help me out.  I am trying to run a mySQL database on a usb key but am having some problems accessing the mount on the usb early enough in the boot process.

On boot the first problem is the mount command cannot occur successfully:

Code:
mount: special device LABEL=usbkey does not exist
failed.

Then mySQL cannot access the location:

Code:
df: `/mnt/usbkey/energy/.': No such file or directory
df: no file systems processed
/etc/rc2.d/S19mysql: ERROR: The partition with /mnt/usbkey/energy is too full! failed!

But if I check when fully booted the mount has finally worked and I can now startup mySQL successfully.  At the moment I have done a 'quick and dirty' by just adding:
Code:
/etc/init.d/mysql start
to the end of /etc/rc.local but I would like to get things happening in the correct sequence.

I have tried mounting with UUID hoping this might work before the device name is allocated but no luck.

Any suggestions for getting the usb mount to happen earlier?

Thanks........
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #1 on: December 13, 2010, 12:21:23 PM »

The USB stack might not yet have detected the device -- it takes a few seconds to do so and the "mount -a" command might be called before the USB stick is there. One way to deal with this is to add the kernel parameter "rootdelay=10" to wait 10 seconds before mounting the root drive. This also slows down any other mount operation, giving the USB stack time to discover the stick.

BTW, if you don't have a serial port and you change the boot configuration (kernel parameters, fstab, ...) on a plug that boots from the internal NAND, you can easily brick the plug because there's no way how you could fix boot problems without serial port or the JTAG interface. If you already have external USB devices, it might be better to get everything installed on those external USB devices and leave the internal NAND as is...

Thanks,
--Christian
Logged

rexyboy
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #2 on: December 15, 2010, 03:25:35 AM »

Thanks cjm, unfortunately no luck.  When I finally figured out how to add the rootdelay variable to uboot I didn't see any improvement.  I assume it doesn't matter where the rootdelay message gets added and saved to?  When I ran a printenv it appeared on the 3rd last line.

BTW:  It appear that the USB is detected prior to mounting (see below) but still get the result that I displayed in my first post.

right after boot ..........
Code:
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 5 USB Device(s) found
       scanning bus for storage devices... Device NOT ready
   Request Sense returned 02 3A 00
2 Storage Device(s) found

and then prior to mount command... sdc1 (Sandisk Cruzer is the disk in question)

Code:
scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer Blade     8.02 PQ: 0 ANSI: 0 CCS
sd 2:0:0:0: Attached scsi generic sg2 type 0
sd 2:0:0:0: [sdc] 7856127 512-byte logical blocks: (4.02 GB/3.74 GiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Assuming drive cache: write through
 sdc: sdc1
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Attached SCSI removable disk

This is really getting to me now. Any other ideas?

Thanks .......
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #3 on: December 15, 2010, 01:25:53 PM »

I'm missing the part where it reports the partitions on the USB device. Is this stick formatted as a "super floppy" or should there be partitions?
Logged

rexyboy
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #4 on: December 18, 2010, 11:49:40 PM »

The usb key is partitioned with one ext3 partition that fills the entire disk.  So I dont leave anything out I have attached my entire boot session below to help.

I can't help think this is just a timing/ order thing as the mount (and subsequent events will work if I repeat again at the end of the boot sequence.

Sorry for the belated delay.  I have been travelling for a few days.




* boot_log.txt (23.66 KB - downloaded 256 times.)
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #5 on: December 19, 2010, 03:15:30 AM »

Sorry, just realized the partitions were reported (well, the one partition you have). Either way, you may also be able to insert a delay in the boot sequence right before the non-root partitions are mounted and checked. This could be done by creating a little delay script in /etc/init.d and the corresponding link in /etc/rcS.d which would need to be named such that it comes before the one that mounts and checks the non-root partitions.

Thanks,
--Christian
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #6 on: December 19, 2010, 06:53:49 PM »

When I finally figured out how to add the rootdelay variable to uboot I didn't see any improvement.  I assume it doesn't matter where the rootdelay message gets added and saved to?  When I ran a printenv it appeared on the 3rd last line.
It matters where this gets added - but not the order that printenv displays things in.  The simplest way to determine whether it is setup is to cat /proc/cmdline and see whether it is there:
Code:
plug:/var/log# cat /proc/cmdline
console=ttyS0,115200 mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) usb start; root=/dev/sda1 rootdelay=10
Quote
right after boot ..........
Code:
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 5 USB Device(s) found
       scanning bus for storage devices... Device NOT ready
   Request Sense returned 02 3A 00
2 Storage Device(s) found
That's u-Boot scanning - not the kernel booting (it does it again).
Quote
Code:
and then prior to mount command.
...
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Attached SCSI removable disk

This is really getting to me now. Any other ideas?
Similar to what I see for my (working) hard disk - except for the word "removable" present in yours.
What line do you have in /etc/fstab to mount this?  You seem to be using LABEL=usbkey.  Try referring to it as /dev/sdc1 and see what happens.
Logged

rexyboy
Newbie
*

Karma: 0
Posts: 4


View Profile
« Reply #7 on: December 21, 2010, 12:14:25 AM »

SUCCESS ................ Grin

Turns out the problem I had was that I hadn't correctly added the rootdelay argument.

What I had incorrectly done was just add 'setenv rootdelay 10' to the environment variables.  When I checked with the command that Birdman gave I could see that it hadn't been added correctly.

Just for completeness of the thread what I should have done is:

1. On boot up press a key to break into the u-boot Marvell prompt

2. Run the printenv command and take note of x_bootargs_root line.

3. Edit the root arguments:
Code:
editenv x_bootargs_root
then enter what was on the line from point 2 (after =) and add rootdelay=10 to the end of the line.

4. Run printenv again and confirm the only change is the 'rootdelay=10'.

5. Save the changes
Code:
saveenv

6. Reboot
Code:
reset

Thanks for your help cjm and Birdman.
Logged

Pages: [1]
Print
Jump to: