https://www.tecmint.com/reset-usb-device-linux
How to Reset USB Device Using Command Line in Linux
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.
No comments:
Post a Comment