25

Possible Duplicate:
USB slots stop working suddenly from time to time

The usb ports of my laptop fail for some reason from time to time. This concerns apparently mainly the external mouse and keyboard connected by usb, while connecting an external hard disk to the same ports may activate them. All gets back to normal after restart. How could I get the same effect without restart?

Since the issue reemerges after reinstalling OS and due to random variations I have created a new question asking for a permanent solution.. In case I get an answer I will close this one.

EDIT: /sys/module/usbcore/parameters/autosuspend contais only the line 2. /sys/bus/usb/devices/usb2/power/autosuspend and /sys/bus/usb/devices/usb3/power/autosuspend contain 0 (This was verified after solving the problem by restart, not before..)

I do not see Legacy USB Support in BIOS

I have edited and updated this question because I have some answers and comments here: but for new solutions please try answering my new question.

  • See if there is Legacy USB Support in your BIOS, and enabled it if its disabled. – Mitch Aug 20 '12 at 8:56
  • What's your Laptop brand? – Mitch Aug 20 '12 at 9:27
  • @Mitch - HP Compaq nx8220. I was asking about whether I should go into bios etc now I see that's what you ment – user47206 Aug 20 '12 at 9:39
  • 1
    @cipricus Yeah, questions that are closed as duplicates are usually not deleted (whereas most other questions are deleted eventually). I'm out of close votes until the end of the day, but if you think it's a good idea for this question to be closed as a duplicate, I recommend flagging it for closure. – Eliah Kagan Dec 28 '12 at 21:35
  • 2
    Posting here because I have a similar issue in trusty (hence the newer question that this is marked duplicate of is not relevant, but I can't post an answer, because this one is closed). I got USB restarted with the script at billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux - I just used sudo -s and pasted the main for loop of that script. Spits out some file-not-found errors, but still works. – naught101 Jul 20 '14 at 10:56
17

Make sure that all USB devices are unplugged/safely removed and then try:

sudo modprobe -r usbhid && sleep 5 && sudo modprobe usbhid

and

sudo modprobe -r usb-storage
sudo modprobe usb-storage

This will reload the kernel modules for USB keyboards/mice and usb hdd's, and might emulate whatever it is about restarting that is fixing your problem. Good luck.

| improve this answer | |
  • 2
    sorry, nothing happens – user47206 Nov 6 '12 at 7:28
  • 2
    You are the best! :D – IcyFlame Mar 25 '17 at 19:17
  • Just give it a time, in my case, I needed to wait extra 15 seconds until all my USB devices re-connected. You always can see the /var/log/syslog – Kostanos Oct 8 '17 at 0:14
  • I upvoted the answer but then I realised it doesn't work correctly. After the modprobe -r commands I can mount my external hard disk but it works painfully slowly, I still have to restart my computer. Maybe I'd have to also remove usbcore but that's built into the ubuntu kernel. – soger Oct 27 '18 at 12:44
  • Getting "modprobe: FATAL: Module usb_storage is in use." for "sudo modprobe -r usb-storage", how to deal with it? – Genom Jun 2 '19 at 10:23
0

Another thing worth trying: restart the udev subsystem:

sudo restart udev

Tell us whether that one worked.

As for finding out what happens, I would start by going through the system logs. For example, when something like that happens, try

dmesg | tail

Otherwise, record the exact time, and later see in

/var/log/syslog

for example by

gksudo gedit /var/log/syslog
| improve this answer | |
  • no, nothing happens – user47206 Nov 6 '12 at 7:29
  • happened again. reboot did not solve it, restart will. but before that (after reboot) i ran dmesg | tail and got this : pastebin.com/4GKkTZRt – user47206 Nov 22 '12 at 15:24
  • 1
    Doesn't work now that Ubuntu use systemd: restart: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused. – Pablo Bianchi Sep 18 '17 at 11:59
0

a while ago I had the same problem with my openbox in Archlinux. This was due to laptop tools (or laptop mode tools) disabled the usb's after a few minutes of inactive.

The solution was to uninstall the package.

| improve this answer | |
  • laptop-mode-tools is not installed here – user47206 Nov 6 '12 at 8:13