FreeBSD/FreeNAS USB_ERR_TIMEOUT fix

As I prepare my migration to my new Debian ZFS system I wanted to backup my zpool onto an external 8TB hard drive. I came across this issue where after plugging in the external USB 3.0 hard drive it would loop and not work:


Jun 11 12:15:54 gserver xhci_do_command: Command timeout!
Jun 11 12:15:54 gserver xhci_do_command: Controller reset!
Jun 11 12:15:54 gserver xhci0: Resetting controller
Jun 11 12:15:54 gserver usb_alloc_device: device init 2 failed (USB_ERR_TIMEOUT, ignored)
Jun 11 12:15:54 gserver xhci_device_state_change:
Jun 11 12:15:54 gserver ugen0.2: <Unknown> at usbus0 (disconnected)
Jun 11 12:15:54 gserver uhub_reattach_port: could not allocate new device
Jun 11 12:15:54 gserver xhci_root_intr: port 2 changed
Jun 11 12:15:55 gserver xhci_root_intr: port 2 changed
Jun 11 12:15:55 gserver xhci_root_intr: port 4 changed
Jun 11 12:15:55 gserver xhci_ep_clear_stall:
Jun 11 12:15:55 gserver xhci_cmd_enable_slot:
Jun 11 12:15:55 gserver xhci_do_command: Command timeout!
Jun 11 12:15:55 gserver xhci_reset_command_queue_locked:
Jun 11 12:15:55 gserver xhci_reset_command_queue_locked: Command ring running
Jun 11 12:15:55 gserver xhci_reset_command_queue_locked: CRCR=0x00000000057cfd80
Jun 11 12:15:55 gserver xhci_do_command: Command timeout!
Jun 11 12:15:55 gserver xhci_do_command: Controller reset!
Jun 11 12:15:55 gserver usb_alloc_device: device init 2 failed (USB_ERR_TIMEOUT, ignored)
Jun 11 12:15:55 gserver xhci_device_state_change:
Jun 11 12:15:55 gserver ugen0.2: <Unknown> at usbus0 (disconnected)
Jun 11 12:15:55 gserver uhub_reattach_port: could not allocate new device
Jun 11 12:15:55 gserver uhub0: at usbus0, port 1, addr 1 (disconnected)
Jun 11 12:15:55 gserver xhci_set_hw_power:
Jun 11 12:15:55 gserver xhci_set_hw_power_sleep: Stopping the XHCI
Jun 11 12:15:55 gserver xhci_halt_controller:
Jun 11 12:15:55 gserver xhci_set_hw_power_sleep: Starting the XHCI
Jun 11 12:15:55 gserver xhci_start_controller:
Jun 11 12:15:56 gserver xhci_start_controller: CONFIG=0x00000000 -> 0x00000020
Jun 11 12:15:56 gserver xhci_start_controller: ERSTSZ=0x00000000 -> 0x00000001
Jun 11 12:15:56 gserver xhci_start_controller: ERDP(0)=0x00000000057cf080
Jun 11 12:15:56 gserver xhci_start_controller: ERSTBA(0)=0x00000000057cf000
Jun 11 12:15:56 gserver xhci_start_controller: CRCR=0x00000000057cfd80
Jun 11 12:15:56 gserver xhci_set_hw_power:
Jun 11 12:15:56 gserver uhub0: <0x1912 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
Jun 11 12:15:56 gserver uhub0: 4 ports with 4 removable, self powered
Jun 11 12:15:56 gserver xhci_set_hw_power:
Jun 11 12:15:56 gserver xhci_root_intr: port 2 changed
Jun 11 12:15:56 gserver xhci_root_intr: port 4 changed
Jun 11 12:15:56 gserver xhci_ep_clear_stall:
Jun 11 12:15:56 gserver xhci_cmd_enable_slot:
Jun 11 12:15:57 gserver xhci_do_command: Command timeout!

Trying the following without rebooting did not work

[root@gserver] ~# sysctl hw.usb.xhci.xhci_port_route=-1

I enabled debugging to get the logs:

[root@gserver] ~# sysctl hw.usb.xhci.debug=1

Apparently we need to add this to: /boot/loader.conf and reboot then try again.

# Workaround desantolo.com USB3 loop
sysctl hw.usb.xhci.xhci_port_route=-1

Leave a Reply

Your email address will not be published. Required fields are marked *