Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a cowdancer/debootstrap setup to generate a chroot.

Of course, as I iterate, I generate some chroot configurations that are bad.

I have found myself in an awkward situation where I have a slew of files under /proc that are refusing to be deleted.

When I sudo rm -rf z_needs_to_be_deleted, I get a ton of messages that look analogous to this:

rm: cannot remove 'z_needs_to_be_deleted/var/cache/pbuilder/build/cow.13620/
proc/6352/task/6358/loginuid':  Permission denied

How do I kill off this chroot?

share|improve this question
up vote 12 down vote accepted

/proc and (usually) much of /dev are read only kernel-generated "filesystems". You don't delete them, you just umount the filesystem. If rm -r /proc/6352 worked, it would have to be semantically equivalent to kill -9 6352, since it's really just presenting information about pid 6352, not actual files anywhere.

Use mount to see what mounted filesystems are under the chroot and umount them before removing any files. This is perhaps even more important when it's a bind mount, since rm -r would remove the original files outside the jail.

share|improve this answer
On Linux, /dev is typically a writable instance of tmpfs, maintained by udev. – grawity Jun 3 '11 at 12:28
@grawity: I was thinking more of things like /dev/fd, which is typically a symlink to /proc/self/fd. IIRC there are some ALSA symlinks around as well. – geekosaur Jun 3 '11 at 14:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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