Kernel Bug Tracker – Bug 5253
usb storage disappears after hotplug
Last modified: 2006-02-14 17:42:23 UTC
Most recent kernel where this bug did not occur: 184.108.40.206
Distribution: hotplug event script mounts usb storage but is gone when script ends
Hardware Environment: MITAC laptop, P4 1.6 GHz
Software Environment: Debian 3.1
Problem Description: Hotplug strips mount the USB device but as soon as the
script ends the divice is no longer mounted. Nothing tries to unmount it, the
device is just gone. No messages about the device removal in the dmesg or the
If I manually mount it as root from the command line it stays. I added delays to
the hotplug script and found that the device remands as long as the hotplug
script is running. I increased the delay to 20 seconds and now the device stays.
Steps to reproduce: My Debian has been hacked a lot. I can test with a generic
system if I need to.
Mistake in my original posting.
Most recent kernel where this bug did not occur: 2.6.11
This may also provide a clue to the problem. While the device is mounted and I
run the df program it reports my 128MB USB storage as having -16Z of used space
and 101% full. It is almost empty but this is what I see.
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 4.8G 3.8G 1.1G 79% /
/dev/hda1 20M 11M 8.8M 55% /boot
/dev/hda6 31G 20G 11G 65% /home
/dev/ubb 120M -16Z 123M 101% /mnt/usbstorage
/dev/ubb 121971 -18446744073709541702 125588 101% /mnt/usbstorage
Also my 20 second delay to keep the device mounted does not work all the time.
This all looks to me as if the kernel module for the usb storage device is
crashing. How can I test that? Is there a debug mode for modules?
My USB storage device is ext2 format. I tried another that is the more common
vfat and it also disappears after the hotplug script is done running, but the
size is correctly shown by the df program. The vfat stick is only a 64MB.
I looks like df cannot properly show the size of either ext2 or the 128MB size
or maybe it has more to do with the fact that my USB is a Kingston and the vfat
stick is a Verbatim.
Does it work any better if you use the usb-storage driver instead of the ub driver?
I have tested this now in four different systems I have. All running the same
The size bug is a totally different bug. The size is properly reported on vfat
USB memory sticks but not if the format is ext2. This happens with both 2.6.11
Alan, I don't know how to change that. The ub module is not loaded until about
the same time hotplug runs. I have looked but could not find where the choice is
made to use ub over usb-storage. I was under the impression that the kernel
chose the module to load and the action of loading the module was what triggerd
hotplug to run. If that is wrong please let me know.
It may take me a long time to figure out how to force the usb-storage module to
be used over the ub module. If you know a simple way to do this let me know and
I will test it.
In one of my systems I have a Win4Lin kernel 2.6.8-1 and when I plug the USB
memory stick in to that system it loads the usb-storage module not ub. But all
of the hotplug configurations and scripts are all 100% identical on all of my
systems so I have no idea how the choice is made to use one module over the other.
The choice of driver depends partly on how the kernel was configured when it was
built. You could build your own kernel, but for now it will be easier if you
just do (as root):
That will unload the ub driver and load usb-storage. If this isn't enough, it
will be necessary to turn on the debugging facility -- which does require you to
build a new kernel.
Alan's post gave me an idea to watch the modules as I insert the USB memory
stick. I am sure Alan knows about how this stuff all works but I am writting
this post to help other people that come here looking to solve this problem.
The ub module is automatically loaded first and then some time later the
usb-storage module gets loaded. I read the help and some comment code for the ub
module in drivers/block/ub.c. This module is documented as a driver for low
performance USB storage devices.
The help message in "make menuconfig" -> Device Drivers -> Block devices -> Low
Performance USB Block driver. It say that it could crash the usb-storage module.
When I read the help for usb-storage "make menuconfig" -> Device Drivers -> USB
support -> USB Mass Storage support it does not say anything about use-storage
crashing ub. But that is what is happening.
When usb-storage loads it crashes the ub module and the device disappears.
My Win4Lin 2.6.8-1 kernel uses usb-storage, my 2.6.11 kernel uses ub and the
vinailla kernel 220.127.116.11 I compiled has both.
So this is my fault because I did not read the help information for the modules
I selected. I think most people would not, there are just to many. My work
around to this was to delete the ub.ko modules and rebuild my modules.dep file.
Now only the usb-storage driver loads. As a side note, the size bug is not a
problem now. The usb-storage modules is reporting the size of the device
correctly with vfat and ext2 formated devices.
This does leave me with a few questions.
Why would the kernel try to load both modules?
Why is there two modules trying to do the same job?
What the heck is a low performance USB storage device?
If I have the usb-storage module, do I need the ub module?
Shouldn't the usb-storage module be able to handle low performance USB storage
Why can't one module do both jobs?
The "make menuconfig" is able to warn people when dependent modules are needed.
Shouldn't it also warn about a conflict between these two modules?
usb-storage is not supposed to crash ub. Could you rebuild your vanilla 2.6.13
kernel, with USB verbose debugging (CONFIG_USB_DEBUG) turned on? The dmesg log
would then show what is going wrong.
> Why would the kernel try to load both modules?
There's nothing illegal about loading both modules. What's strange is that they
both try to control the same device.
> Why is there two modules trying to do the same job?
ub was originally written as an alternative to usb-storage. It has different
design tradeoffs and different characteristics.
> What the heck is a low performance USB storage device?
You misread the help message. ub isn't meant for "low performance storage
devices". Rather, ub is the low-performance driver for USB storage devices --
it can drive most storage devices, but not as fast as usb-storage.
> If I have the usb-storage module, do I need the ub module?
> Shouldn't the usb-storage module be able to handle low performance USB storage
This is the same misunderstanding. There is no special category of low
performance USB storage devices, and usb-storage can handle almost all devices.
> Why can't one module do both jobs?
It's only one job, not two. Each module can handle it.
> The "make menuconfig" is able to warn people when dependent modules are needed.
> Shouldn't it also warn about a conflict between these two modules?
There isn't supposed to be any conflict between them.
I recompiled with debug enabled and now it works perfectly.
I will post again I find any way to make the problem happen again.
Is everything still working okay? If it is, you may as well close out this bug.
Ok, closing due to last status.
If this is still a problem on the latest kernel release, please reopen this and
let us know.