Resetting a USB device from the Command Line Interface (CLI) can help resolve issues such as unresponsiveness or connection problems. This guide will walk you through the steps to reset a USB device using simple commands.
Step 1: Identify the USB Device in Linux
Before resetting the USB device, you must identify it by using the lsusb command, which lists all USB devices connected to your system.
lsusb
You’ll see a list of connected USB devices, something like this:
Note the bus and device number of the USB device you want to reset (e.g., Bus 001 Device 004).
Step 2: Unmount the USB Device in Linux
If the USB device is mounted, you need to unmount it before resetting it by using the umount
command followed by the device’s mount point.
You can use the df command to see where the USB device is mounted:
df -h
Look for your USB device in the output, which will usually looks like /media/username/device_name.
Now run the command below, replacing /media/username/device_name with the actual mount point:
sudo umount /media/username/device_name
Step 3: Reset the USB Device in Linux
After unmounting the device, you can reset it using the usbreset
utility. If you don’t have usbreset installed, you can install it using the following appropriate command for your specific Linux distribution.
sudo apt install usbutils [On Debian, Ubuntu and Mint] sudo yum install usbutils [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] sudo emerge -a sys-apps/usbutils [On Gentoo Linux] sudo apk add usbutils [On Alpine Linux] sudo pacman -S usbutils [On Arch Linux] sudo zypper install usbutils [On OpenSUSE] sudo pkg install usbutils [On FreeBSD]
Once installed, you can reset the USB device using the following command by replacing Bus 001 Device 004
with your USB device’s bus and device number:
sudo usbreset /dev/bus/usb/001/004
Alternatively, you can use the following command, where <device_id>
is the ID of the USB device (from the lsusb output):
sudo usbreset 090c:1000
Step 4: Remount the USB Device in Linux
After resetting the USB device, you can remount it. If your system does not automatically mount it, you can do it manually by running the following commands.
lsblk sudo mount /dev/sdX1 /media/username/device_name
Replace /dev/sdX1
with your USB device’s identifier, which you can find using the lsblk
command.
Finally, verify that the USB device is functioning properly by running the lsusb
command. If it appears in the list, it is successfully reset and ready to use.
lsusb
Conclusion
Resetting a USB device from the Linux terminal is a straightforward process that can help resolve various issues. By following the steps outlined above, you can identify, unmount, reset, and remount your USB device without much hassle.
Dear Sir,
In Step 2, “Unmount the USB Device in Linux,” the syntax you provide is:
However, how would that apply to your example? I ask because, in your example, the Device Mount Point contains a blank space.
So, which of the following would be correct?
Addendum: I think I found it! Based on Step 4, it seems the correct command might be:
I am still unsure, especially regarding the trailing
/
at the end. Could you please clarify this issue, particularly when there is a blank space in the Device Mount Point?Regards,
Gérard
@Gerard,
Thank you for your message and for pointing out the issue regarding the blank space in the Device Mount Point.
You are correct to be cautious when dealing with spaces in mount points. When there is a blank space in the path, you have two valid options:
Escape the space using a backslash (\):
Enclose the entire path in quotes:
Both options will work correctly.
As for the trailing
/
, it is not strictly necessary, but including or omitting it doesn’t affect the command’s functionality in this case.You can leave it out:
I hope this clarifies your concern! Feel free to reach out if you have any further questions.
Maybe I am a little dense but what do you mean by “reset the USB device”?
“can help resolve various issues”
Such as what?
Examples would have helped.
@dragonmouth,
By ‘resetting the USB device,’ I mean forcing the system to reinitialize the USB device, similar to unplugging it and plugging it back in without physically doing so. This can help resolve issues like the device not being recognized, errors with file transfers, or problems with power management.
For example:
If your USB drive isn’t being detected after plugging it in, resetting the device can make it recognizable again.
It can fix glitches when a USB mouse or keyboard becomes unresponsive.
Hope that helps!
If the USB device is not being detected, how do you know its address to reset it?
@Dragonmouth,
Thank you for your question!
If the USB device is not being detected, you can still try to identify it using the following commands:
Once you identify the device using these commands, you can proceed with resetting it.
Let me know if you need further assistance!