When you plug a mouse, keyboard, or external hard drive into a USB port on an Ubuntu Linux machine, the kernel registers the device and assigns it a power state. However, if a device draws too much power, or if a USB hub crashes, the Linux kernel will defensively disable that specific USB port to protect the motherboard. When this happens, unplugging the device and plugging it back in does nothing; the port acts as if it is completely dead.
Restarting your entire computer will reset the USB controller and fix the issue, but if you are running a critical server or a massive rendering job, a reboot is not an option. Instead, you can use the terminal to manually force the Linux kernel to cut power to the specific USB hub and reinitialize it on the fly.
How to Manually Force an Ubuntu USB Port Reset
You must find the specific USB bus number and write a command to its unbind/bind file path.
- Open your Terminal application (Ctrl + Alt + T).
- First, you must identify which USB bus has crashed. Type the following command and press Enter:
lsusb - The terminal will output a list of your connected devices. You will see lines like
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver. - Note the Bus number (e.g., Bus 001 or Bus 002) corresponding to the port that is acting dead.
- Next, we will force the kernel to unbind (disconnect) that entire USB bus. If you want to reset Bus 1, type this command (replace
usb1withusb2if you need to reset Bus 2) and press Enter:echo 'usb1' | sudo tee /sys/bus/usb/drivers/usb/unbind - Type your administrator password when prompted. The terminal will execute the command. Any devices currently plugged into that bus will instantly lose power.
- Finally, you must force the kernel to rebind (reconnect) the bus and restore power. Type this command and press Enter:
echo 'usb1' | sudo tee /sys/bus/usb/drivers/usb/bind
The USB port will instantly power back on. The Linux kernel will re-scan the port, detect your previously “dead” mouse or hard drive, and mount it normally, entirely bypassing the need for a system reboot.