Working with LUKS Partition

ioctl: LOOP_CLR_FD: Device or resource busy

When we try to close a LUKS partition using "losetup -d /dev/loopX", we often get this error message "ioctl: LOOP_CLR_FD: Device or resource busy".

Here are a few things to try or check:

  • It is possible that you still have the partition mounted. Try "umount /dev/loopX".
  • It is possible that you have not closed the LUKS association. Try "cryptsetup luksClose <device-name>"
  • Once in a while, the OS seems to enter some sort of race condition or bug and leave a temporary device around. Check in /dev/mapper/ and see if there is something like /dev/mapper/temporary-cryptsetup-XXXXX, If so, close it by doing "cryptsetup luksClose temporary-cryptsetup-XXXXX".