# memory stick problem

## mijenix

Hi

I have a problem with my memory Stick. When I plug in my stick in the usb slot. In the directory (/proc/scsi/usb-storage/) appears the following:

 *Quote:*   

> 
> 
>    Host scsi3: usb-storage
> 
>        Vendor: M-Sys
> ...

 

a device called /dev/sda1 appears in the /dev/ directory. But when I try to mount the device, this appears:

 *Quote:*   

> 
> 
> mount: special device /dev/sda1 does not exist
> 
> 

 

The strange thing is, when I mount the /dev/sda device appears the following:

 *Quote:*   

> 
> 
> mount -t vfat /dev/sda /mnt/usbstick/
> 
> mount: wrong fs type, bad option, bad superblock on /dev/sda,
> ...

 

and then I can mount the usb-stick without any problems.

By the way: I use Kernel 2.6.6 and all the require things are all compiled in the Kernel. What are the Problem?

Mathias

----------

## dsd

when you say:

 *Quote:*   

> and then I can mount the usb-stick without any problems. 

 

which node are you mounting? (sda or sda1..)?

----------

## mijenix

Hi

You mean finally? I can mount /dev/sda1. 

Only once I must try mount the /dev/sda device but it fails either way but after that /dev/sda1 works without any problems!

I hope it will help u to find an answer?!

Mathias

----------

## dsd

ok, your problem is basically that your "sda1" node doesnt appear until you do _something_ (even touch) on the sda node. this is the second time i've seen the problem reported so i'll go and investigate.

----------

## ugly_orc

Cool, I thought I was alone with this problem, but it appears at least two other persons have it  :Smile:  I have the same stick, and the same problem.

Basically when I plug the stick, /dev/sda appears, but not /dev/sda1. I can get /dev/sda1 to appear by trying to mount /dev/sda, or by doing "fdisk /dev/sda".

Apparently, dsd, you already knew that. But what you might not know, is that if the stick is plugged in *before* booting into linux, then /dev/sda1 is there and useable without needing to do anything (until I unplug the stick, of course).

Other random info: my motherboard is an Abit KR7A-raid (Via chipset), with USB-1.1 hubs. The MSys DiskOnKey is an USB-2.0 device. I'm using kernel 2.6.6, and compiled in verbose USB messages, hopping it would help me find the problem.

----------

## mijenix

 *dsd wrote:*   

>  this is the second time i've seen the problem reported so i'll go and investigate.

 

ohh thats very nice thx. Post a Message or send me a pm when u need any informations.

 *Quote:*   

> 
> 
> Mainboard Asus P4B533 Intel 845E chipset
> 
> 0000:00:1d.0 USB Controller: Intel Corp. 82801DB (ICH4) USB UHCI #1 (rev 01)
> ...

 

--Mathias

----------

## mijenix

Hi

The same problem at my Gentoo Server:

Asus P2B-F Motherboard i440BX chipset and kernel 2.6.6 from kernel.org

--Mathias

----------

## coax

Do you have hotplug installed?

Also, what is your syslog output when you plug in your stick?

(ctrl-alt-F1 + alt-leftarrow on my box; alt-F7 to return to X)

----------

## aardvark

I can add to this that I also have this problem. I however have kernel 2.4.22-ck1 and use a Pen Drive 256 Mb

In my situation the pendrive work when plugged in while booted. Wehn unplugged and replugged it does not reappear as /dev/sda1

When I try to mount /dev/sda (which fails) it reappeard in the dev dir.

This problem has started happeing after a recent system update with portage. Also hotplug was reinstalled. I now decided to downgrade hotplug but that did not help...

I hope someone can find out what this is, as I use my pendrive a LOT during the day.....

----------

## aardvark

After downloading hotplug all th way back to version 20030805-r3 it is now working properly again.... I guess the later versions should me moved into ~x86 for the time being....

----------

## dsd

i still think this is a kernel issue. reverting to older hotplug might avoid the problem because it may effectively do "touch /dev/sda" on plugin. this isnt going to help users who dont use hotplug.

could someone please try with Linux 2.6.7 and see if the problem remains

----------

## mijenix

Hi

No with Kernel 2.6.7 is the problem still existent!

PS: I don't use hotplug and I will not use it in the future!

--Mathias

----------

## dsd

ok, here is what i need you to do:

compile your kernel with the following options selected (under USB)

```
[*]   USB verbose debug messages

[*]     USB Mass Storage verbose debug
```

reboot into new kernel, load usb-storage module if appropriate

configure your system logger to save kernel debug messages (i think some by default only save kernel "info" messages, you may need to tweak the configuration so that it captures debug as well). this is important as the logs may overflow the dmesg buffer, but i need them all.

when you plug in your device now, a whole load of debug messages should be produced. to check that your system logger is saving them, you should compare the last bit of output from "dmesg" to the contents of /var/log/messages or equivalent. if your /var/log/ file is missing certain lines of output, then it means that your logger isnt saving the debug messages.

assuming your system logger is saving the debug, then you can now continue to do some log capturing. you now need to:

1. plug in the device

2. run "touch /dev/sda" (and confirm that sda1 appears only after you do this)

3. unplug

it would be best if you left about a minute inbetween each stage, so that you can say: I plugged in the device at 16:32:42, at 16:43:02 i ran the touch command, and at 16:44:22 i unplugged. (its important that i must be able to relate the above stages to the log)

after you've got the logs done like this, you now need to send them to me. don't post them here, they will probably be rather large - instead, post them as a URL, or email them to me: dsd !at! gentoo. org

and then i'll look into it  :Smile: 

thanks.

----------

## dsd

thanks for the logs. i'm not really familiar with bulk-only transport, so i sent off a report to the linux-usb list.

----------

## dsd

mijenix,. we spoke on irc and you said you had sent newer full logs to me, i haven't recieved them yet..

----------

## dsd

ok... i need someone with this problem to try something out.

disable all module autoloading. hotplug, etc. you'll probably have to take CONFIG_HOTPLUG out of the kernel itself.

build usb-storage as a module. also build with module unloading support.

reboot into the new kernel, and plug in your device. load all the usb modules (if appropriate) *except* usb-storage. confirm with lsmod that the usb-storage module has not been loaded.

now wait five minutes.

now load the usb-storage module and see if sda1 appears of its own accord. you should now be able to unplug, "rmmod usb-storage", and repeat the above, perhaps with a shorter wait time, and sda1 should come up automatically again.

let me know what happens

----------

## simex

OK -here's what has happened:

plug in memory stick: no /dev/sdb or sdb1 (i got a scsi harddisk as sda), no usb-storage module loaded, stick LCD signals "USB connecting..."

wait 5 min: nothing changes

after 5 min - modprobe usb-storage: stick is immediately recognized and it signals "USB standby" (that means connected succesful), /dev/sdb and /sdb1 are present

plug out: nothing changes (except that stick display switches off  :Wink: )

rmmod usb-storage: /dev/sdb and sdb1 disappear

re-plug: same as with first plug

again modprobe usb-storage without 5 min delay: same es with first modprobe

-repeatable how often one wish-

just one thing about the text shown on the lc-display of the stick:

when i plug it in the first time after reboot OR after reinserting the storage module, it only briefly tells "connecting", then "Standby"

BUT when i replug it after the first plugin, (that means that the usb-storage-module is still loaded from the last time and the /dev/sdb and sdb1 entries are still there) it tells me: "connecting..." - until i mount the device. then it immediately switches to "Standby"

maybe that gives some help...

----------

## simex

as told before:

when i unplug the stick and do not rmmod usb-storage, the /dev/sdb and /dev/adb1 entries stay at their place and i can re-plug and re-mount the stick nicely (except the strange lcd-messages)

-->and now what happened overnight:

after some 8 hours of leaving the machine alone, with the module loaded, the /dev/sdb1 entry *disappeared*, so no mounting is possible. 

only ways to make that possible again: rmmod and modprobe usb-storage again OR touch /dev/sdb OR mount /dev/sdb /mnt/usb -t msdos

i can send the log if u want.

----------

## dsd

 *simex wrote:*   

> OK -here's what has happened:
> 
> plug in memory stick: no /dev/sdb or sdb1 (i got a scsi harddisk as sda), no usb-storage module loaded, stick LCD signals "USB connecting..."
> 
> wait 5 min: nothing changes
> ...

 

OK - this makes sense. the issue here is if usb-storage scans the device too early, then it doesnt see any partitions (presumably the device isnt ready). however, if we give it some time to warm up then it is fine.

 *Quote:*   

> plug out: nothing changes (except that stick display switches off )
> 
> rmmod usb-storage: /dev/sdb and sdb1 disappear
> 
> re-plug: same as with first plug
> ...

 

presumably the delay between you plugging it in and loading the module was enough to let the device get ready. this whole issue is probably because of buggy usb-drives that report themselves as ready when they really arent...

----------

## dsd

ok, what i need now is full debug logs from syslog as I posted above (Posted: Fri Jun 18, 2004 5:28 pm)

it would also be useful to have logs from multiple people to compare. so please send away  :Smile: 

mijenix, if you could resend i'd be grateful, i never got any complete logs from syslog from you..

----------

## simex

one thing to add:

IMHO most of those usb sticks simply are buggy. 

as i have those mysterious problems with my usb-stick( = i have to reinsert the usb-storage module or touch /dev/sdb to regain connection to the stick), there are absolutely NO problems in attaching and reattaching an usb-harddisk. it works nicely and without complaints.

----------

## Serge Matveev

Solution for udev:

http://www.reactivated.net/udevrules.php#usbstorage-extra

It's works fine for me

----------

## mijenix

the problem still exist with Kernel 2.6.8.1!

--Mathias

----------

## simex

so after some months of testing:

the best workaround (for kde users) seems to be

1. put a 

```
touch /dev/sdX
```

 (the X standing for your usb device; if you do not have any other scsi or zip drives, it should be 'a') for each of your usb devices into your crontab, called every 30 mins.

2. always plug in the usb-stick before you log in to kde

3. log in.

in my setup this works perfectly, i can mount the device without problems.

----------

## Rumil

I've had a similar problem with my usb card-reader. After I switched to udev it seems to work without any problems (well, it only takes couple seconds to create sdc1). I didn't have to do any extra hacks.

So maybe time to move to udev?

----------

## ExecutorElassus

dsd: you asked for logs, yes? i'm having the same problem with 2.6.8-r3 (have to touch sdc to get sdc4 (??) which is the only node that'll mount) and my zip250. dmseg says this when i put a disc in the drive:

```
usb-storage: scsi cmd done, result=0x0

usb-storage: *** thread sleeping.

usb-storage: queuecommand called

usb-storage: *** thread awakened.

usb-storage: Command READ_10 (10 bytes)

usb-storage:  28 00 00 03 fd 0f 00 00 80 00

usb-storage: Bulk Command S 0x43425355 T 0x1b3b0 L 65536 F 128 Trg 0 LUN 0 CL 10

usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

usb-storage: Status code 0; transferred 31/31

usb-storage: -- transfer complete

usb-storage: Bulk command transfer result=0

usb-storage: usb_stor_bulk_transfer_sglist: xfer 65536 bytes, 6 entries

usb-storage: Status code 0; transferred 65536/65536

usb-storage: -- transfer complete

usb-storage: Bulk data transfer result 0x0

usb-storage: Attempting to get CSW...

usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes

usb-storage: Status code 0; transferred 13/13

usb-storage: -- transfer complete

usb-storage: Bulk status result = 0

usb-storage: Bulk Status S 0x53425355 T 0x1b3b0 R 0 Stat 0x0

usb-storage: scsi cmd done, result=0x0

usb-storage: *** thread sleeping.

usb-storage: queuecommand called

usb-storage: *** thread awakened.

usb-storage: Command READ_10 (10 bytes)

usb-storage:  28 00 00 03 fd 8f 00 00 80 00

usb-storage: Bulk Command S 0x43425355 T 0x1b3b1 L 65536 F 128 Trg 0 LUN 0 CL 10

usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

usb-storage: Status code 0; transferred 31/31

usb-storage: -- transfer complete

usb-storage: Bulk command transfer result=0

usb-storage: usb_stor_bulk_transfer_sglist: xfer 65536 bytes, 5 entries

usb-storage: Status code 0; transferred 65536/65536

usb-storage: -- transfer complete

usb-storage: Bulk data transfer result 0x0

usb-storage: Attempting to get CSW...

usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes

usb-storage: Status code 0; transferred 13/13

usb-storage: -- transfer complete

usb-storage: Bulk status result = 0

usb-storage: Bulk Status S 0x53425355 T 0x1b3b1 R 0 Stat 0x0

usb-storage: scsi cmd done, result=0x0

usb-storage: *** thread sleeping.

usb-storage: queuecommand called

usb-storage: *** thread awakened.

```

it goes on like that for a while. 

i had a similar problem with a usb-based audio player not syncing, but that was their fault. this, however, seems to persist. 

anything else you need from me?

thanks,

EE

----------

## dsd

sorry, havent had time to look at this lately. hopefully i'll be able to continue now.

it appears that there is more to this situation than meets the eye. can anyone meet either of the following testcases?

1. a device which must be plugged in *before* usb drivers are loaded (sda1 or whatever appears automatically only when this is the case) can be plugged into another computer/USB-controller and will work even when the drivers are already loaded

or

2. your device which must be plugged in *before* usb drivers are loaded for the nodes to automatically appear suffers exactly the same problem on another computer with significantly different hardware

----------

## kwisatz_haderais

Just wanted to let you know that I've got exactly the same problem, only haven't got time now to get you those logs. (if you still need 'em ?)

I'll look into this again when I've got the time and supply you with whatever you'll need.

----------

## mijenix

Hi

Does anybody know new news about that prblem? Is it really a devfs problem?

Thx.

--Mathias

----------

## warthog

 *dsd wrote:*   

> sorry, havent had time to look at this lately. hopefully i'll be able to continue now.
> 
> it appears that there is more to this situation than meets the eye. can anyone meet either of the following testcases?
> 
> 1. a device which must be plugged in *before* usb drivers are loaded (sda1 or whatever appears automatically only when this is the case) can be plugged into another computer/USB-controller and will work even when the drivers are already loaded
> ...

 

dsd, are you still interested in working this issue?  I'm experiencing similar behavior (/dev/sda1 doesn't get created until I reload the usb-storage module) on mutiple platforms.  I can run your test cases if you're stil interested in the data.  OR if someone knows if this has been solved somewhere please point me to the post!  BTW, I'm using pure udev.

Thanks!

----------

## dsd

2.6.10 should fix this whole problem. please let me know if it doesnt

----------

## warthog

 *dsd wrote:*   

> 2.6.10 should fix this whole problem. please let me know if it doesnt

 

OK, I'm currently on a machine running 2.6.7-r11, but I'll have access to another machine in a couple of days (when I return from holiday travel) that I've configured with 2.6.10-r2.  I'll post my results.  Thanks!

----------

## mijenix

Hi

With 2.6.10 it works perfetcly without hotplug and udev!

Thx for all help!

Happy New Year!

--Mathias

----------

## warthog

 *dsd wrote:*   

> 2.6.10 should fix this whole problem. please let me know if it doesnt

 

OK, I'm now on a box running 2.6.10 and pure udev, but it's not totally working for me... I have to rmmod/modprobe usb-storage after a fresh boot, but thereafter when I remove/re-insert the usb-storage card the device node is created & deleted automatically without any further intervention on my behalf.

I am using hotplug/coldplug.  I notice some people saying not to use hotplug, but doesn't udev require hotplug?

Thanks for your help!

----------

