Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 9 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
add comment

Your Answer

 
discard

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.