USB slots stop working suddenly from time to time

52,824

Solution 1

kernel vs hardware issues

If you have ruled out possible hardware issues such as voltage/current problems, failing USB ports/hubs then this is probably a kernel problem.

If you feel comfortable with possible non-booting issues/black screen issues on boot, you could try installing the quantal kernel available in the 12.04 repositories.

Remember - most blackscreen issues are due to installation of proprietary graphics drivers. You will have most luck removing these first before upgrading your kernel.

To install the quantal kernel:

sudo apt-get install linux-generic-lts-quantal

Remember to do a full system backup to allow you to recover if the new kernel breaks more than it fixes.

Solution 2

Something similar to this was happening to me. This blog post provided a partial solution.

This is what worked for me:

sudo -s
cd /sys/bus/pci/drivers/xhci_hcd/
for file in ????:??:??.? ; do
 echo -n "$file" > unbind
 echo -n "$file" > bind
done

As noted at that block post, different systems get hung up in different places, so if the above doesn't work, you might want to try replacing /sys/bus/pci/drivers/xhci_hcd/ with /sys/bus/pci/drivers/ehci_hcd/, or /sys/bus/pci/drivers/uhci_hcd/, if one of those exists.

Solution 3

Power issues for USB 2.0

USB 2.0 has a maximum current draw available of 500mA, however it should be noted that the +5V on several ports may actually be on the same bus. For example on a desktop case the USB ports on the front of the machine may all be on the same bus, while the ports on the back of the machine will normally be a a different bus, or have completely separate +5V supplies for each group of USB 2.0 sockets.

A low current device as defined by the USB 2.0 standards can draw up to 100mA (1 unit) while high current devices can draw up to 5 units (500mA). Hard drives with no external source of supply are typically high current devices.

Devices should stop working if the +5V line drops below 4.75V and this is why many high power devices can cause problems on some computers.

In addition to this the circuit that supplies +5V to each bus may refuse to re-negotiate high power capability if the device is drawing enough current to pull the +5V line too low. This is why high power devices will need to be removed and re-attached before they will work if they have failed due to a power problem, and also why a reboot does not allow them to re-attach while a full power down/up cycle may do so.

Note that if one or more low power devices are already plugged into a USB bus, there may not be enough capacity available to also run a high power device such as an external hard drive.

Using high power devices therefore needs to be planned for, and if problems exist the device needs to be used on it's own on any one bus or given a separate +5V supply.

While the USB 2.0 standards document might be a little difficult to read, there is some very good information and explanations in the wikipedia page on the subject of USB 2.0

Also note that plugging in many low power devices such as through an external USB hub device can also cause a voltage drop on the bus supply line, causing some or all of the devices to be disabled.

The types of cables used may also affect the reliability of high power devices. For example an external hard drive plugged in via a regular long USB cable may see enough of a voltage drop at 500mA to disable itself to prevent damage to its circuitry or drive motors. These devices are typically supplied with a special short cable, or a 'Y' cable that plugs into two USB ports to help with the power problem. Note that this only a partial solution to the problem relating specifically to the cabling issue, it's doesn't actually allow more than 500mA to be supplied since adjacent USB ports are likely to be on the same 5V 500mA supply internally in the computer. Even where a separate bus is used for the second plug on the 'Y' cable it won't be able to get a high current supply since it has no data connection to request it from the USB bus. Only one of the ports will be enabled as a high current supply.

Since the very common use of USB keyboards and mice, problems can sometimes occur when these are both plugged into the same bus. Peak load currents at power-on can exceed the design specification of the USB bus and cause one or both of the devices to be disabled or to malfunction.

Solutions to these problems usually involve using only a minimum of low power devices, using only well designed and made low power devices, making sure they are plugged into different buses with separate +5V lines, and where high power devices are involved using a powered hub to help with the supply problems seen on many USB 2.0 bus supplies. If it's not possible to use a powered hub, then the high power device should only be plugged in after the computer is powered up and the current drain from low power devices has stabilised.

It should also be noted here that computers such as laptops and netbooks may have low power USB devices incorporated internally. Hardware such as internal card readers, wireless 3G adapters, and webcams are often connected internally to a USB bus. This may be a dedicated bus with it's own +5V power, or it may be shared with one or more external USB ports.

Solution 4

Old post, and replies are not relevant to USB 3.0. So here's how to reset a 3.0 Bus that stopped serving data:

su -

and as root:

echo -n "0000:06:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo -n "0000:06:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/bind

After this, USB should start to work correctly again, just like after a restart.


Explanation

In case you're using a different driver, this is how I found what to do, use it as a reference:

A lsusb -t will output this - take a note of the xhci_hcd driver for the fast bus, it's the 3.0 driver name:

$ lsusb -t
        /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
        /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
            |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=dvb_usb_it913x, 480M
        /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
            |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
            ...etc

The directory to look for is /sys/bus/pci/drivers/xhci_hcd

        drwxr-xr-x  2 root root    0   5 21:48 ./
        drwxr-xr-x 28 root root    0   1 00:21 ../
        lrwxrwxrwx  1 root root    0   6 00:29 0000:06:00.0 -> ../../../../devices/pci0000:00/0000:00:1c.3/0000:06:00.0/
        --w-------  1 root root 4096   5 22:33 bind
        lrwxrwxrwx  1 root root    0   5 22:32 module -> ../../../../module/xhci_hcd/
        --w-------  1 root root 4096   5 22:32 new_id
        --w-------  1 root root 4096   5 22:32 remove_id
        --w-------  1 root root 4096   5 22:32 uevent
        --w-------  1 root root 4096   5 22:33 unbind

In my case I needed to unbind "0000:06:00.0".

ps. If you need to rebind the USB 2.0 driver, follow the above instructions but with ehci-pci, or look here (deserves a credit).

Solution 5

Base on lsusb

#lsusb
Bus 002 Device 002: ID 04f3:0230 Elan Microelectronics Corp. 3D Optical Mouse
Bus 003 Device 002: ID 04f3:0103 Elan Microelectronics Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Do lsusb -t, output will be in following format

$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
        |__ Port 6: Dev 3, If 0, Class=HID, Driver=usbhid, 1.5M

Pay attention to the Bus 00X number and the 1.1/2.0 USB version in both output. If mouse and keyboard is on 1.1 now, try moving them to the 2.0 port, or the other way round.

This does not fix the driver issue, but a work around (if it works).

Share:
52,824

Related videos on Youtube

Community
Author by

Community

Updated on September 18, 2022

Comments

  • Community
    Community almost 2 years

    After re-installing Lubuntu 12.04 system on my laptop an older problem re-emerged after a few days and installation of different programs: without apparent reason the external mouse and sometimes other usb connected devices (including hdd) stop working. The hdd shows it has tension as it has a light there, and the external mouse flashes for a second when plugged.

    I have posted a different version of this problem before. I keep it for now as example of the two answers there. None of them works here.

    Logging out-in does nothing, restart does.

    The event seems entirely random, after reboot it will reappear after many days or weeks or, rarely, after a few hours.

    What counts is at the end I guess:

    Nov 24 14:06:55 cprq-HP-Compaq-nx8220-PY518EA-ABB kernel: [29953.822962] usb 3-1: USB disconnect, device number 3
    Nov 24 14:06:57 cprq-HP-Compaq-nx8220-PY518EA-ABB kernel: [29955.069427] uhci_hcd 0000:00:1d.0: host controller process error, something bad happened!
    Nov 24 14:06:57 cprq-HP-Compaq-nx8220-PY518EA-ABB kernel: [29955.069439] uhci_hcd 0000:00:1d.0: host controller halted, very bad!
    Nov 24 14:06:57 cprq-HP-Compaq-nx8220-PY518EA-ABB kernel: [29955.069461] uhci_hcd 0000:00:1d.0: HC died; cleaning up
    Nov 24 14:06:57 cprq-HP-Compaq-nx8220-PY518EA-ABB kernel: [29955.069492] usb 2-2: USB disconnect, device number 2
    
    • I have noticed that on most occasions only the external mouse and keyboard are affected, but not the external HDD. Or if it is, replugging it solves the problem.

    • I have a dual boot with WinXP: in Windows this never happens, so it is not a hardware issue

    • I have used Lubuntu Quantal 12.10 and the same problem happened there as well. Upgrading to that would not be a solution

    • On certain occasion only restarting 2 or even 3 times solved it.


    Using the same PC/hardware with Linux Mint 14 (Quantal) Xfce, the problem almost disappeared(it happened once since then). I am not sure whether this 'solution' comes from using Xfce or Mint (I guess Mint 14 Nadia uses the same kernel as Lubuntu Quantal).

    • Admin
      Admin over 11 years
      @John Siu: paste.ubuntu.com/1472989 - this is done with external mouse and external keyboard. it is them that this problem is concerned with. i have used different mice and had the same problem (rarely, as i stated) but i've used exclusively this keyboard: could it be the cause?
    • Admin
      Admin over 11 years
      hmm, I was actually looking for line like this 'Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub'. Because if 'nx8220' is the correct model, the box should be using Intel 915PM chipset. However you only have 'Linux Foundation ....'. I will put in a answer, as the suggestion will be too difficult to put in proper format here.
    • Admin
      Admin over 11 years
      if it NEVER happen with XP, then it should not be hardware(keyboard) related.
    • Admin
      Admin over 11 years
      @Shauna: indeed. As also stated by John Siu in a comment made to his own answer (askubuntu.com/a/233669/47206): "USB port are sensitive to static and can degrade/die over time, especially for older motherboard and chipset. Your 1.1 port maybe degrading and is not functioning very well, and the Linux driver is not able to deal with those special case (like voltage fluctuation), while the XP driver know how to handle( or tolerate) them". After many occurrence of the same problem i am very much inclined to consider this as the real cause.
  • Admin
    Admin over 11 years
    Excellent explanation-some very useful information here.
  • fabricator4
    fabricator4 over 11 years
    It's not the mouse itself but the dongle that you plug into the USB port that receives the movement data from the mouse. It may not be playing well with other devices and causing them problems. It's not clear from what you have told us where the real culprit lies. A hard drive may power up fine, but the resulting voltage drop may cause other devices to malfunction. I've found it is best to power up the computer and then plug high power devices in once the essential low power devices have stabilised.
  • fabricator4
    fabricator4 over 11 years
    After a problem occurs immediately have a look at the last few lines of syslog: "cat /var/logs/syslog | tail" to see if there's anything mentioned there.
  • Admin
    Admin over 11 years
    i'll update question accordingly as soon as it happens again... please follow
  • Admin
    Admin over 11 years
  • Magpie
    Magpie over 11 years
    Just fyi, I have a similar problem with quantal. I had assumed it was because I had dropped the HD a couple of times. It "clicks" and then disappears. Sound familiar?
  • peter
    peter over 11 years
    @Magpie: not at all. Even now I realize that: 1. never have it in WinXP, in dual boot, so i guess that is not a hardware issue, 2. i had it in quantal too, so upgrading would not be a solution
  • Admin
    Admin over 11 years
    now i realize this never happens in Win xp with the dual boot - I hardly use Xp but it never happened when I did
  • nilsonneto
    nilsonneto over 11 years
    @cipricus - the errors in the trace really make it look like a kernel issue. Upstream kernel guys would be interested. However, they would first ask you to try the very latest kernel - which is 3.8rc1 I think. If you go down this route - backup your system with an image clone first. An alternative is to backup your system (or dual boot), install raring (13.04) for a week and see if the issue reappears. you can then return back to your main system afterwards. Raring will be using v3.8 kernel - probably will get this in the next few weeks.
  • peter
    peter over 11 years
    @ fossfreedom: can i create a new boot option of 13.04 in parallel to 12.04?, as a different os? the problem is that it rarely happened lately. maybe i should wait for the stable 13 and upgrade?
  • nilsonneto
    nilsonneto over 11 years
    yes (i've done this in the past 11.10 & 12.04 at the same time) - when booting from USB it will give you the option to dual boot rather than erase... but please - please (!) backup your system first :)
  • pwp
    pwp over 11 years
    could you be more explicit? what should i do? compare the result of lsusb with that of lsusb -t? what should i look for in there? you mean to prefer the 2.0 bus? i usually use that for external hdd. in your comment you say "Because if 'nx8220' is the correct model, the box should be using Intel 915PM chipset. However you only have 'Linux Foundation" - does this mean i lack the correct driver? what is to be done? result of lsusb -t is paste.ubuntu.com/1482285
  • John Siu
    John Siu over 11 years
    (1) Yes, try use the USB 2.0 bus. If you only have one 2.0 port, see if you can find a external usb hub and plug it in. (2) I check some of my other box and they also show only Linux Foundation, so it is not an error. (3) lsusb -t is for easier identifying usb device and the bus they plug in.
  • John Siu
    John Siu over 11 years
    @cipricus There are multiple possibilities and I cannot be sure. I will list the most probable causes to my knowledge: (1) Pure software: Linux driver is not handling the 1.1 port correctly for this chipset. This will be the most possible cause. (2) Partial hardware: USB port are sensitive to static and can degrade/die over time, especially for older motherboard and chipset. Your 1.1 port maybe degrading and is not functioning very well, and the Linux driver is not able to deal with those special case (like voltage fluctuation), while the XP driver know how to handle( or tolerate) them.
  • John Siu
    John Siu over 11 years
    @cipricus USB 1.1 spec is fast enough (and way over) for keyboard and mouse. I really doubt if any human being can max. out that speed with a normal keyboard (with human hand).
  • John Siu
    John Siu over 11 years
    Thank you! I agreed, this type of problem has to be determined on a case by case bases, depending on the symptom. HAPPY NEW YEAR!!
  • peter
    peter about 11 years
    after a while, trying Linux Mint 14 (Quantal) Xfce on the same pc, the problem is solved (see edit). do you think this further indicates a kernel issue? or is the kernel the same (as Mint Nadia is based on Ubuntu Quantal) and therefore the 'solution' is related to the use of Xfce instead of LXDE?
  • peter
    peter about 11 years
    i am not used responding in chat, so until i find my way around i'll reply here: (1) i have not changed ship, just trying to test more linuxes, but i haven't got too far, dont you worry, as mint is ubuntu based. the older pc now has mint/xfce for testing but also still lubuntu/lxde, while i am mostly using xubuntu on a new computer; (2) i guess it is the kernel, therefore i have confirmed your answer as the definitive
  • donquixote
    donquixote about 8 years
    I notice that my external mouse and keyboard work reliably only if the laptop is connected to the power grid. Otherwise they die every so often. I guess this confirms this answer.
  • Karim Sonbol
    Karim Sonbol over 7 years
    I can't thank you enough. This is the only solution that worked for me, even bluetooth is now working! No need to restart anymore. For me it was "0000:00:14.0" using Ubuntu 14.04 and Asus VivoBook.
  • Amir Uval
    Amir Uval over 7 years
    Gladly! It seems I accidentally made my reply a "community wiki", so voting up doesn't credit me. (@ThomasWard can you please help by un-community wiki this?)
  • Karim Sonbol
    Karim Sonbol over 7 years
    There is one problem however, I tried it today and I am getting this error: tee: /sys/bus/pci/dhcd/unbind: No such file or directory tee: /sys/bus/pci/dhcd/bind: No such file or directory
  • Amir Uval
    Amir Uval over 7 years
    @KarimSonbol isn't it /sys/bus/pci/drivers/... ?
  • Karim Sonbol
    Karim Sonbol over 7 years
    yeah, sorry my mistake
  • MacMartin
    MacMartin almost 6 years
    debian 9.5: /sys/bus/pci/drivers/ehci-pci (note the dash "-" not a "_")
  • Nikolai Prokoschenko
    Nikolai Prokoschenko over 5 years
    Shouldn't this be "$file" instead of "$i"?
  • naught101
    naught101 over 5 years
    I guess so. fixed.