Not enough host controller resources for new device state
I too hit this bug (after trying to connect a dozen USB network interface devices). I'm pretty sure it's not an electrical current problem with the devices: they are all on powered hubs and well within the current limitations. I think it's an issue of allocating interrupts or some other resource.
I tried the workaround of disabling USB 3.0 in the BIOS but I suspect the motherboard uses USB 3.0 internally (for Bluetooth and some other stuff), it didn't work (lsusb -t showed that xhci_hcd was being used). I had to rebuild the kernel (I'm using Ubuntu 14.04) to remove the xhci support and then it worked.
Note: Ubuntu by default compiles ehci and xhci into the kernel - it doesn't load them as modules. I tried rebuilding them as modules so that I could play around with them using modprobe but that failed because:
If ehci is a module, it must be loaded before ohci and ahci modules (see warning in dmesg), and every way I tried to do that failed (in any case, I thought kernel modules were required to be load-order independent?).
The xchi module always ended up loaded, even if blacklisted, presumably to handle internal hardware. Didn't investigate this much, however.
Only by setting up a kernel config where ehci was compiled in and xhci was compiled out did it work. I haven't tested re-enabling USB 3.0 in the BIOS with the new xhci-free kernel.
Not enough host controller resources for new device state.
can't set config #1, error -12
Faced with the same errors. XHCI (usb 3.0) in linux kernel is limited to 32 devices. It looks like a bug. But maybe this is a Bill Gates way "640 kilobytes enough for everyone". In any case, it's a pain.
1) The easiest way to fix it: disable XHCI (usb 3.0) support in motherboard BIOS if possible.
2) The hard way to fix it: disable XHCI linux module. modprobe -r xhci-hcd
But in most cases it does not work. You must recompile the kernel to disable XHCI and enable OHCI (usb 1.1) and EHXI (usb 2.0).
This issue comes from the underlying USB hardware controller which cannot handle that much devices. Linux source code shows the xHC returned a "resource error" code when trying to configure the interface. Chapter 4.4.6 of the xHCI standard explains this case:
The Resources Required variable is compared to the Resources Available variable, if the result indicates an oversubscription of resources by the command (i.e. Resources Available - Resources Required is less than 0), then the command shall be unsuccessful and a Resource Error Completion Code shall be returned in the Command Completion Event. Refer to section 4.14.1.1 for more information on xHC resources.
My workaround is to release xHCI resources by removing every USB device I don't need, such as internal USB devices (e.g. bluetooth, wifi, etc.) and USB 3.0 hubs with only USB 2.0 devices attached to them.
Here are the steps:
- Run
lsusb
to see if there is anything unused. - Remove your unused devices using sysfs
echo 1 > /sys/<path to device>/remove
. Have a look atdmesg
and see how it removes the device and every sub-device. Which means that you can remove an entire USB tree by using this command on the root device. - You should now be able to correctly plug more devices (cf.
dmesg
logs).
To make this persistent when rebooting, add udev rules to remove the devices:
SUBSYSTEM=="usb" <your conditions to match unused devices> RUN="sh -c 'echo 1 > /sys$DEVPATH/remove'"