PDA

View Full Version : Plugging and unplugging USB drives



Keithj
07-03-2005, 10:01 PM
I'm having a USB device problem on my machine - Knoppix 3.8.2 installed on HD of a Pentium 600.

After the helpful advice of folks on here, the Linux box will now happily recognise my pen drive and my digital camera (which it sees as another USB drive, but that's OK). They become /mnt/uba1 and /mnt/ubb1- first to arrive is uba1, the second is ubb1.

I can plug them in when the machine's already running, and it will mount them and open them. No problem so far.

However, if I unplug them again, things start to go wrong. First, I cannot replug and reconnect to them - konqueror crashes if I try to do so. Second, the whole /mnt/ directory becomes inaccessible once I've unplugged one.

I'm sure the answer lies in how they are defined in /etc/fstab. Googling has come up with many different "fixes"; I've not yet found one that works.

I've tried the following in /etc/fstab:

/dev/uba1 /mnt/uba1 vfat loop,noauto 0 0
/dev/ubb1 /mnt/ubb1 vfat loop,noauto 0 0
directly under the hard drive definitions. That would not work unless they were connected at boot-up.

usbdevfs /proc/bus/usb usbdevfs defaults 0 0
/dev/uba1 /mnt/uba1 vfat noauto,users,exec,umask=022 0 0
directly under the hard drive definitions. That didn't work at all.

devfs /devfs devfs defaults 0 0
/devfs/ub/a/part1 /mnt/uba1 auto rw,user,noauto 0 0
Didn't work at all.

And then, towards the top of fstab, directly below the floppy drive set:
usbfs /proc/bus/usb usbfs devmode=0666 0 0
/dev/uba1 /mnt/uba1 vfat defaults,user,noauto,showexec,umask=022 0 0
/dev/ubb1 /mnt/ubb1 vfat defaults,user,noauto,showexec,umask=022 0 0

and then instead of the second and third lines above,
/dev/uba1 /mnt/uba1 vfat loop,noauto 0 0
/dev/ubb1 /mnt/ubb1 vfat loop,noauto 0 0

I'm presently using the last one above, and I get one go at plugging in and accessing the device. Thereafter, it has to stay plugged in till shutdown, or the machine gets very stroppy.

Where am I going wrong?

Keithj
07-03-2005, 10:25 PM
Some more experimentation: DMESG is my friend...

If I unplug uba1 after I've opened it in konqueror (and closed konqueror), then plug it back in, its going and coming are seen, and it is renamed ubc1 (ubb1 still being present).

So the problem seems to be that the resources aren't being released when a USB device is removed.

I tried to "unmount" before unplugging, both via Konqueror and a root terminal; the answer both times was "device is busy".