35

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).

6
  • Please post output of lsusb. I did a Google search on host controller process error, something bad happened and the earliest one show up as early as 2002. Then continue to pop up time to time all these years. Issue seems to be driver vs some USB chipset.
    – John Siu
    Dec 28, 2012 at 2:02
  • @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?
    – user47206
    Dec 28, 2012 at 15:31
  • 1
    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.
    – John Siu
    Dec 28, 2012 at 16:23
  • 1
    if it NEVER happen with XP, then it should not be hardware(keyboard) related.
    – John Siu
    Dec 28, 2012 at 17:11
  • 2
    As a note - just because it doesn't happen in Windows, doesn't mean it's not a hardware issue. It's entirely possible that Windows (or even the hardware drivers) is less sensitive, or reacts more gracefully, to a hardware error or failure. (For example, the Logitech software on Windows might detect the disconnection and take the necessary steps to reconnect without user intervention).
    – Shauna
    Jan 9, 2013 at 20:43

7 Answers 7

14

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 blog 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.

3
  • 1
    debian 9.5: /sys/bus/pci/drivers/ehci-pci (note the dash "-" not a "_")
    – MacMartin
    Jul 26, 2018 at 14:15
  • Shouldn't this be "$file" instead of "$i"? Oct 11, 2018 at 14:18
  • I guess so. fixed.
    – naught101
    Oct 11, 2018 at 22:18
12
+50

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.

7
  • 1
    Excellent explanation-some very useful information here.
    – user76204
    Nov 10, 2012 at 1:33
  • 2
    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. Nov 12, 2012 at 9:23
  • 1
    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. Nov 22, 2012 at 19:15
  • i'll update question accordingly as soon as it happens again... please follow
    – user47206
    Nov 23, 2012 at 10:23
  • it did: pastebin.com/0qR8bhhX.
    – user47206
    Nov 24, 2012 at 13:10
11

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).

5
  • 1
    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. Nov 28, 2016 at 17:30
  • 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?)
    – Amir Uval
    Nov 28, 2016 at 20:38
  • 1
    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 Dec 1, 2016 at 16:13
  • @KarimSonbol isn't it /sys/bus/pci/drivers/... ?
    – Amir Uval
    Dec 1, 2016 at 16:51
  • yeah, sorry my mistake Dec 12, 2016 at 16:23
6
+50

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.

7
  • 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?
    – Magpie
    Nov 29, 2012 at 17:33
  • @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
    – user47206
    Dec 26, 2012 at 10:41
  • 1
    @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.
    – fossfreedom
    Dec 26, 2012 at 11:02
  • @ 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?
    – user47206
    Dec 26, 2012 at 11:05
  • 1
    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 :)
    – fossfreedom
    Dec 26, 2012 at 11:07
3
+200

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).

5
  • 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
    – user47206
    Dec 31, 2012 at 12:20
  • 1
    (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
    Dec 31, 2012 at 14:34
  • 1
    @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
    Dec 31, 2012 at 16:28
  • 1
    @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
    Dec 31, 2012 at 16:33
  • 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!!
    – John Siu
    Dec 31, 2012 at 19:16
2

FWIW - If you're having USB problems on ubuntu due to conflicts or power issues, save yourself some trouble and get a powered USB expander - these are cheap devices that plug into your USB port and turn it into 5 or 10 or whatever you need to buy and have a separate power supply and go for about 30$ USD on amazon.

I had tons of issues with my keyboard and/or mouse when I added a USB device and this made all of my problems go away.

Cheers

0

A fast solution that works at least in my case (Linux Mint KDE, on a Lenovo Yoga 3 Pro laptop):

With the laptop on, just press the power button for about 30 seconds, that is shutting down and still pressing for a while after this. I did it with the charger unplugged. After turning on the laptop, the USB ports work again.

You must log in to answer this question.