[Nix-dev] Bind mounts are Evil(TM)

Ludovic Courtès ludo at gnu.org
Wed Oct 8 14:55:43 CEST 2008


Hello!

There are days when one had better stay in bed.  Today was one of these
for me.

This morning, I decided I'd "rm -rf" some of the things under /tmp.
Among these things were `chroot-*' directories.  After that "rm -rf"
succeeded, I started to stumble upon "Command not found" messages.  This
reminded me that earlier in the morning, for some reason, `nix-env' had
failed to unmount a bind mount in a chroot...

IOW, my harmless-looking "rm -rf" had deleted the contents of
/nix/store, which, needless to say, is a Bad Thing.  :-)


Of course, PEBKAC, but I wonder if there is something we could do to
avoid it.  An improvement would be to have the boot scripts clear /tmp
upon startup, like Debian does.  As for bind mounts, I don't think much
can be done since we can't bind-mount /nix/store read-only anyway, for
example.

Thoughts?

Ludo'.




More information about the nix-dev mailing list