7

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?

14

/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.

  • On Linux, /dev is typically a writable instance of tmpfs, maintained by udev. – user1686 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 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.