As part of an automated VM creation system a block device is mounted to a temporary folder ( /tmp/whatever ) . Various scripts install and configure the VM prior to it's first run.

Recently something changed, the temporary mount is busy and refuses to umount. In trying to determine what might still be keeping a file open I've checked:

Tests run as root

  • mount
  • lsof | grep /tmp/
  • fuser -m /tmp/...
  • exportfs -rv
  • Restarting the daemon which runs the creation scripts anyway...
  • ps axf
  • dmsetup table
  • losetup -a
  • fuser -vm /tmp/tmp.random-chars/ (yields two lines)
    • /tmp/tmp.random-chars: root kernel mount /tmp/tmp.random-chars

None of the above tests have results that point to filesystem use, however umount -f still complains "Device or resource busy" / "device is busy".

What other tests should I try so that I can get to the true root cause and thus hopefully fix the stuck mount without reboot on a system I can't presently restart for a while as well as prevent this from reoccurring?

It is also /doubtful/ (but I don't know how to check) that kernel modules from the temporary mount are loaded, as the temporary mount has a different version of Linux installed than the host is running.


  • From various search results it appears that /modules/ are simply read in to memory. I am unaware of if the kernel could have open files and of how to access any such list.
  • Added the dmsetup / losetup to the lists of "tests that don't show issues"
  • fuser -vm as suggested in freenode ##linux
  • not enough information to try to help you – c4f4t0r Apr 25 '14 at 18:37
  • The type of backing device should be un-important. The host system has not been restarted since the last time it worked successfully. It is likely a wild goose chase to focus on that instead of locating what could be holding lock on an otherwise apparently clean filesystem. – Michael J. Evans Apr 25 '14 at 19:14
  • See if losetup shows any devices attached to files in that directory. – Matthew Ife Apr 25 '14 at 19:29
  • losetup -a == no loopbacks in use; dmsetup table was also tried previously, I'll add both. – Michael J. Evans Apr 25 '14 at 20:43
  • Try strace and ltrace, sysrq sequences – Alec Istomin Apr 26 '14 at 6:14

If it's part of a build process, I'm assuming you'll need to reboot at some point anyway. Try inserting a "lazy" unmount into the process. Use umount -l /tmp and see if that helps you get past this barrier in the process.

  • umount -fl was tried the last time this occurred, it does not solve the issue, it only hides it from view. – Michael J. Evans Apr 25 '14 at 18:58
  • 1
    can you show what you are doing in your build vm process? – c4f4t0r Apr 25 '14 at 19:04
  • Several customizations to the default ganeti deployment process, including installing new debian packages within the chroot. I did a thing that (at least previously) prevents the daemon start/stop events from occurring while in this state. However this should be approached from a more general 'something is holding open the resource, locate the thing' approach and that approach would also be more useful for anyone else who runs across this page in the future. – Michael J. Evans Apr 25 '14 at 19:21

We got the very same problem but it appears it only happens if the root filesystem of the virtual machine is ext4. ext3 works correctly. I know it sounds strange but it might be a kernel bug described in http://www.phoronix.com/scan.php?page=news_item&px=MTIxNDQ

If this is so, we must simply wait for kernel patch OR avoid installing new vm in main machine. Installing it from a temporary linux run as virtual machine works correctly because the machine is rebooted without rebooting the main machine.

Did you try ext3? If not, try installing at ext3, you can convert it to ext4 later if using ext4 is crucial (and it's described in http://www.debian-administration.org/article/643/Migrating_a_live_system_from_ext3_to_ext4_filesystem)


One reason umount can fail is if the underlying IP address of the remote device has changed.

I have seen this happen when I remote-mount a laptop from my desktop server. The first mount takes place with IP address A. Although rebooting the laptop gives it address B, my desktop continues to record address A as the address of the laptop. I can see this when I examine the IP address returned by the mount command and comparing it with the current address of the laptop.

  • I was able to unmount using umount -l
  • The solution to this problem was -- for me -- to use a fixed IP address for the laptop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.