Skip to main content

Device is busy then unmounting truecrypt container

Couple of days ago I faced a problem with unmounting truecrypt container. After issuing

$ truecrypt -t -d MyContainer.tc

I got an error saying this:
Enter your user password or administrator password: 
Error: umount: /path/to/mountpoint: device is busy.
 (In some cases useful info about processes that use
 the device is found by lsof(8) or fuser(1))

I checked who has access to the mountpoint, and got several pids. Next step is I closed all the running programs that accessed it, but after issuing unmount command again I got the same error. Found out who is still accessing the mount point and got one pid. Tried to kill it, and it killed my shell, i.e. tcsh running in konsole.
Here I should note that the mount point for my container was located in my home and running shell starts inside my $HOME. What actually happens is that if you are in the directory that contains a mountoint then it is considered to be an access to this mount point. For example, my username is lyuts, and I have a container called Data.tc which has been mounted to /home/lyuts/Data. Being in /home/lyuts means Data directory is accessed. This is what actually fuser reports, when you run:
$ fuser /home/lyuts/Data

It gives:
/home/lyuts/Data: 2339c

The 'c' suffix denotes the type of an access, which is 'current directory'. I forced the unmounting and thought on how avoid this issue in future.
To solve this problem I removed the Data directory and created a symbolic link:
$ rmdir Data
$ ln -s /media/truecrypt1 Data

and from now on I mount my container to the default mount point.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
_r_sentation: