0

I'm trying to use luks on my phone (android 4.2.2). I can create luks volume, mount and unmount it without problem, but when i'm trying to luksClose it here the problem start ..(in fact i can close it but only if i did't write anything on it .. so no utility) here is the function i used for open it:

mountDisk (){
  mknod /dev/loop0 b 7 0
  losetup /dev/loop0 /mnt/sdcard/disk/dk0
  echo "password" | cryptsetup --key-file=- -c aes-plain luksOpen /dev/loop0 disk
  mke2fs -O uninit_bg,resize_inode,extent,dir_index -L disk /dev/mapper/disk
  mkdir /sdcard/extdk
  mount -o rw -t ext2 /dev/mapper/disk /sdcard/extdk
}

And here what i'm using for trying to close it:

umount /mnt/sdcard/extdk
cryptsetup luksClose disk

But i got an error Device disk is busy. Here is the output of cryptsetup status disk:

/dev/mapper/disk is active and is in use.
  type:    LUKS1
  cipher:  aes-cbc-plain
  keysize: 256 bits
  device:  /dev/loop0
  loop:    /mnt/shell/emulated/0/disk/dk0
  offset:  4096 sectors
  size:    93560 sectors
  mode:    read/write

I tried to stop /dev/loop0 with losetup -d /dev/loop0, but i still have "device or ressource busy". People talk about "fuser" but busybox one is not the same as linux.. I tried to kill $(fuser -m /dev/mspper/disk) but not work.. i see some solutions with dmsetup and vgchange but i don't have and cant fund them.

So what should i do for closed my luks volume?

  • Is the Device disk is busy error coming from cryptsetup or from umount? Usually it's the later. I ask because if you can eliminate cryptsetup as the culprit, then that's a step in the right direction. – Emmanuel Rosa Nov 24 '17 at 23:17
  • @Emmanuel Rosa The error message come from cryptsetup .. But it's possible due to bad umount ..I mean i can umount /sdcard/extdk and it's do the job /sdcard/extdk is unmount,and if i use df i cant see it any more. But in ubuntu i use umount -l /path unfortunately busybox's umount doesn't have option. – znv.75 Nov 25 '17 at 10:13

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.