On Sun, 21 Aug 2022 at 12:17, James Dutton <james.dutton@xxxxxxxxx> wrote: > > Hi, > > Say I have mounted a usb disk. > I then disconnect the usb device > Linux complains about failed writes etc. > I then plug the usb device back in > Linux still complains about failed writes, and does not recover. > > How do I get Linux to recognise the reinserted usb disk and carry on as normal? > > I know my suggested behaviour might be detrimental for some users, in > case one modifies the usb disk in another computer and then comes > back, but I would like an option that assumes it has not been plugged > into anything else. > > The reason being, I have a system that boots from a USB disk. > Due to interference, the USB device disconnects for a second or two > and then comes back, but Linux does not see it and I have to reboot > Linux to recover. So, in this situation I wish Linux to be able to > recover immediately, without needing a reboot. > > The physical USB device removal then reinserting reproduces the > problem I am seeing, so I thought it would be a good example to get > working, if we could. > > Can anyone give me any pointers as to where to start with fixing this? > > Kind Regards > > James I have done some more tests. With the device plugged in, and me manually send a command to reset the USB device. Using instructions listed here: https://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line The reset fails. It never recovers. So, I think there is some problem relating to USB 3.x reset, and maybe just my specific device which is an NVME storage in a USB dock. I think the problem is more to do with the Linux kernel's USB 3.x reset procedure, rather than any other cause. Is there any quirk or test I can add, that would remove power from the USB port and return it, as part of the reset procedure? Or, is there any extra debug logging I can enable to help diagnose where the reset function is failing?