There are some questions on U&L that ask about how to correctly remove an USB device from Linux box, implicitly meaning a block device, having been in used via a mounted filesystem on top of it.

Well, there are other USB devices also, and I wanted to ask about the more general case. Let's say I wanted to remove an USB webcam gadget from my Linux box. Is the correct/safe way to simply write to issue a finale:

$ echo "1" | sudo tee /sys/bus/usb/devices/<device-addr>/remove

NOTE: I have noticed that with usb-mass-storage devices, I can "remove" the power via the command above, even though they have not been unmounted. The mount point remains and access to it results in Input/output errors which seems to indicate that also for other type of USB devices (e.g. the webcam gadget) I might need to first remove loaded kernel (i.e. via rmmod) or otherwise deactivate the device to be removed?

  • 3
    What makes you think a non-storage device needs manual removal of the driver/module and/or manual "deactivation" ? There is no risk of data loss or corruption so where is the problem ? What exactly is "unsafe" if you just unplug the device ? – don_crissti Jul 21 '18 at 13:09
  • 1
    @don_crissti your hint that USB unplugging (least for data loss in storage devices) is always safe to the hardware/os is based on your knowledge about the RFC/standards/norms of USB? If so I would be glad to accept an answer that hints that mere unplugging is safe, citing ideally the USB standard that says so, if you can find it more swiftly than I can. – humanityANDpeace Jul 21 '18 at 13:20
  • 2
    It's common sense, there's no need to read the standards to understand that no one in their right mind would design an OS / peripherals that need a "safely remove" feature before unplugging stuff like a USB mouse, keyboard, camera, whatever... There is nothing unsafe as there's no data that would be lost or corrupted. – don_crissti Jul 21 '18 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.