I have a startup script which executes the following commands:
sudo cryptsetup open /dev/sda3 dm_crypt && sudo mount -t btrfs /dev/mapper/dm_crypt /mnt && cd /mnt && ls -la && sudo -s
This basically opens my LUKS device and mounts the BTRFS root partition and starts a root shell for further work.
Its all great but when I try to do:
umount -f /mnt
in the root shell I get:
umount: /mnt: target is busy.
Can someone tell me why this is happening ?
Am I right, if all the commands in my startup script are executed as mutual processes ? Then what is keeping /mnt
busy ?
This is the output of lsof | grep /mnt
:
bash 1890 liveuser cwd DIR 0,45 42 256 /mnt
sudo 2168 root cwd DIR 0,45 42 256 /mnt
Is it because the root shell is child process of the script or something ?
This does not make any sense to me.
Constraints: I will calling cryptsetup close
from within the child root shell.