difficult unmount-on-shutdown problem

Daniel Drake dsd at laptop.org
Wed Nov 18 06:20:55 EST 2009

On Fri, 2009-11-06 at 11:13 -0500, Michael Stone wrote:
> Here's a crazy idea for you:
> In the startup sequence you mentioned, perform a lazy unmount like so:
> > mount disk at /sysroot
> > chdir(/sysroot)
> > mount --move /sysroot /
> > chroot(.)
> > chdir(/)
> umount("/", MNT_DETACH)  <--- hereish, I think... but please play around.
> > chdir(/versions/run/<hash>)
> > chroot(.)
> > chdir(/)
> > exec(/sbin/init)
> It seems plausible to me that this will result in / being unmounted when init
> and all its children are finished. (Whether the lazy unmount will cause any
> regressions remains to be seen; I don't understand its *exact* semantics well
> enough to predict in advance.)

Thanks, it didn't work, and also from looking at the kernel code in this
area it seems like this wouldn't help either.

> Other than this, I think you're going to need at least one of kernel patches, a
> long-lived child of /init forked before the second chroot(), or a new design
> for the startup sequence.

I added a kernel hack for now
and lets see if the kernel developers can help us at all


More information about the Devel mailing list