You are correct in your guess that this is because of the separated /var -- the first set of mount points corresponds to /var/run and /var/lock on the root filesystem *underneath* the /var mount point, the second set of mount points corresponds to the /var/run and /var/lock on top.
This is actually deliberate. It means that if you unmounted /var for whatever reason (including simply shutdown of the machine), /var/run and /var/lock still exist. However you are incorrect in your theory that this could result in hidden lock files. The mountpoints are for the SAME filesystem, it is bind-mounted in multiple places (which happen to share the same file, with one set hidden). If you unmount /var, and write to /var/run there -- then remount /var (you'll have to play with the additional mounts for this to be truly tested) the file will still exist. And if you step through the init scripts, they are implemented exactly as you suggest. /var/run and /var/lock are mounted extremely early; then during mountall, they are bind mounted elsewhere and moved onto /var, leaving the original copies underneath. This has zero race conditions, is completely atomic, and doesn't leave us with the issue you fear might have happened. ** Changed in: sysvinit (Ubuntu) Status: New => Invalid -- /var/{run|lock} mounted twice https://bugs.launchpad.net/bugs/163956 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs