I built a debootstrap chroot and bound /proc to it, i.e. sudo mount -o bind /proc <chroot>/proc

When I found I no longer needed it, I quite stupidly rm -r <chroot>'d it. Of course, rm refused to remove /proc.

Now umount says that /proc is in use and cannot be unmounted. How do I unmount it, now?



Linux refuses to remove a directory that is a mount point, so <chroot>/proc should still exist. And Linux refuses to remove a directory that is not empty, so <chroot> should still exist.

Taking what you wrote at face value, you tried to unmount /proc, not <chroot>/proc. So the kernel tried to unmount the none filesystem mounted on /proc. You should unmount the none filesystem mounted at <chroot>/proc with umount <chroot>/proc then rmdir <chroot>/proc <chroot>.

Note that if you moved <chroot>, you must pass the new name to umount. You can check what the kernel thinks is mounted by looking in /proc/mounts.

In case umount complains because your /etc/mtab has somehow gone out of sync, use umount -n.

If even umount -n <chroot>/proc doesn't work, it's probably because some process is still running inside the chroot to access it. Use lsof to locate the process and kill it.

  • Thanks. Yes, <chroot>/proc and, by extension, <chroot> still exist. And actually, I did try to unmount <chroot>/proc. For instance: _@_:~$ sudo umount -n <chroot>/proc/ [sudo] password for _: umount: <chroot>/proc: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) And then, the only process that lsof comes up with is lsof itself: _@_:~$ lsof <chroot>/proc/ COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME lsof 7046 _ 3r DIR 0,3 0 1 <chroot>/proc/ Thanks again. – Brian Aug 24 '10 at 13:22
  • Sorry for the cruddy formatting; I'm new to markdown and have made too many edits to fix it. – Brian Aug 24 '10 at 13:28
  • @brian4work: lsof <chroot>/proc/ only shows processes that are using the <chroot>/proc directory. lsof +f -- <chroot>/proc shows all processes using the proc filesystem (i.e. it's equivalent to lsof +f -- /proc), whether through the chroot or outside (mount --bind is peculiar sometimes). At least lsof +f -- /proc would narrow the search. – Gilles 'SO- stop being evil' Aug 24 '10 at 17:52
  • Thanks so much; that did the trick. It turned out to be daemonized dd holding on to the chroot's kmsg file. – Brian Sep 1 '10 at 20:46

Try recreating the directory then umount it?

  • Thanks. The directory <chroot>/proc still exists, though. – Brian Aug 24 '10 at 13:15

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.