1

I'm running Linux Mint 18/2 with 4.10.0-38-lowlatency kernel and KDE5 desktop.

I'm testing lots of USB flash memory with a custom bash script and f3 and I had a strange situation today. One drive didn't disappear from /dev/ when it was physically disconnected from the machine.

I also noticed that any sync command will completely hung up and even sudo pkill -9 sync doesn't help there.

I finally did sudo rm /dev/sdd, but sync still will hung forever.

All sync processes that were run since the error started remain in the system. Htop says they all do I/O all the time:

enter image description here

Anybody had something like this? Can I fix this without rebooting the machine?

2

You shouldn't delete the /dev/sdX file, instead you can do this:

echo "1" > /sys/block/sdX/device/delete

By doing this your process may disappear.

1

The entry in /dev is just a device file, i.e. a gateway through which applications talk to the driver. Creating or removing entries in /dev has no impact on the operation of the driver, let alone on the operation of the device. The driver isn't even aware of those entries.

Processes should not remain stuck in state D. If they do, it indicates a kernel bug. The kernel bug may be triggered by malfunctioning hardware: most drivers don't cope well when hardware misbehaves in nontrivial ways. pkill -9 will kill the process as soon as the driver decides that it's doing something interruptible, but if the driver is stuck in uninterruptible code, that could last forever.

The place to look for clues is your system logs. There will probably be clues there, either from the driver that's misbehaving or from a generic driver (e.g. the USB bus driver) that detected something strange such as a device disconnecting abruptly or sending malformed messages. Try dmesg or journalctl -k or less /var/log/kern.log (I think that's the name on Mint, if not look at whichever file contains kernel logs).

Trying to forcibly disconnect the device via /sys entries may work (it depends what the problem is).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.