Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a USB device (a modem) that is really finicky. Sometimes it works fine, but other times it refuses to connect. The only solution I have found to fix it once it gets into a bad state is to physically unplug the device and plug it back in. However, I don't always have physical access to the machine it is plugged in on, so I'm looking for a way to do this through the command line.

This post suggests running:

sudo modprobe -w -r usb_storage; sudo modprobe usb_storage

However I get an "unknown option -w" output. This slightly modified command:

sudo modprobe -r usb_storage

Fails with the message FATAL: Module usb_storage is in use. If I try to kill -9 the processes marked [usb-storage] before running they refuse to die (I think because they are deeply tied to the kernel).

Anyone know of a way to do this?

NOTE: I cross-posted this on superuser.com as I didn't know which was more appropriate. I will delete and/or link whichever one is answered first.

share|improve this question
    
This question seems abandoned, there is no visible activity or information added to it for several months. I have flagged a moderator and am voting for it to be closed. If you feel that the question is not abandoned and that you still suffer from this issue please flag a moderator so that it can be re-opened. –  Bruno Pereira Feb 1 '12 at 18:50
add comment

migrated from serverfault.com Jan 26 '11 at 7:28

This question came from our site for professional system and network administrators.

closed as too localized by Bruno Pereira, Takkat, Marco Ceppi Feb 1 '12 at 19:45

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

Your modem driver might still be loaded. check with "sudo lsmod" which modules are using usb_storage or any other usb modules. You have to "sudo modprobe -r the other modules" first.

share|improve this answer
    
The entry for usb_storage reads: usb_storage 39425 1 Doesn't seem to indicate any dependencies? –  Cory Aug 16 '10 at 12:30
    
the 1 means one module is using it. go through the lsmod list and check next to which module usb_storage appears. –  Fortinator Aug 16 '10 at 12:47
    
f.e scsi_mod might use it: scsi_mod 101301 6 usb_storage,firewire_sbp2,sg,sd_mod,sr_mod,libata –  Fortinator Aug 16 '10 at 12:48
add comment

Try to close any relevant service and afterwards try to remove the dependencies first.

There is always the cruel way of rmmod but i don't suggest because it could crash your system

You could also make a script that disable usb power on such cases

share|improve this answer
    
How would I disable USB power? –  Cory Aug 16 '10 at 13:22
1  
Either by writing a udev rule or by modifying /sys/bus/usb/devices/USBNUM/power/level With a little googling you can find it {i 'm sorry but i can't have a look at it this moment :<} –  Nikolaidis Fotis Aug 16 '10 at 14:13
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.