Question

I've a mounted iso image in the path:

/mnt/iso

Inside this iso I've an install script install.sh I run the installation script from the iso and at the end the script ask to the user if he want to umount the iso itself. If the user press "y" the script execute the following code:

cd /
umount /mnt/iso
echo "Installation completed!"

Unfortunately when the script tries to execute the umount there's an error

umount: /mnt/iso: device is busy

I suppose it's due to the fact that the virtual device is busy from the script itself. How can make it work? Tnx

Was it helpful?

Solution

Use the -l or --lazy switch to umount which will do a lazy umount, where it is only fully unmounted once it is no longer in use. The full description in the manual page (this is a linux specific option) is:

Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore. (Requires kernel 2.4.11 or later.)

OTHER TIPS

TomH's solution will resolve the issue if you are using the latest. Otherwise the comment by Simone Palazzo is your best bet. You are unmounting something through a script located in the area you are unmounting. If you run the script from the root directory it will be successful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top