I have an external USB disk that is luks encrypted. Inside that (3 folders deep) that disk has an encryptfs folder.
Sometimes the USB connection to some of my external disks breaks - Looks like I’m disconnecting and reconnecting the cable, which I don’t. But maybe it’s because I unintentionally moved the cable / connector or maybe the combination of USB-controllers in the disk and in my laptop don’t like each other.
Of course that problem onto itself is bad enough, especially if it happens while I’m writing to that disk - but it gets even more annoying when it happens while I have mounted that encryptfs folder unto itself.
Then the parent mount get’s yanked and removed from my system, but the encryptfs mount somehow blocks cryptsetup from cleaning up the disconnected luks partition, which also prevents it from reopening it when reconnecting because the old entry is still there.
can’t unmount the encryptfs folder, because “/run/media/user/UUID_inside/” doesn’t exist any longer:
$ umount /run/media/user/UUID_inside/1/2/3/
umount: /run/media/user/UUID_inside/1/2/3/: no mount point specified.
And I can’t cleanup the luks mapping, because the encryptfs mount still lingers somewhere somehow:
$ cryptsetup close luks-UUID_outside
Device luks-UUID_outside is still in use.
The only way I found to get back into that disk after such an event is to reboot my system, which I very much don’t like to do.
Help please. Is there some way to cleanup that encryptfs mount + luks mapping after the disk got yanked without rebooting?