difficult unmount-on-shutdown problem

Daniel Drake dsd at laptop.org
Fri Nov 6 10:46:31 EST 2009


In #9629 I found a bug that also affects our deployed XO-1 OSes. We are
always shutting down without unmounting the root filesystem.

This seems hard to fix.

On our disk/nand, our core filesystem is *not* stored at /
Instead, it is stored at /versions/run/<hash>/

For example, /bin/mkdir is actually at /versions/run/<hash>/bin/mkdir

We hide this from you: In our early boot procedure we do this from the
initramfs:

mount disk at /sysroot
chdir(/sysroot)
mount --move /sysroot /
chroot(.)
chdir(/)
chdir(/versions/run/<hash>)
chroot(.)
chdir(/)
exec(/sbin/init)

and everything looks normal once you've booted up.

But during shutdown, i.e. if I modify /etc/init.d/halt to open a shell
just before it calls /sbin/halt at the very end, I can't figure out any
way to remount / read-only (or unmount it)

I've tried all kinds of umount and mount flags and I just get -EINVAL
I would expect umount to fail (this is the active filesystem), but
remount read-only to work. However the mount(2) man page says that for
remounting, you must provide the exact same mountpoint and device, and
we lost that mountpoint (/sysroot) a long time ago...

Any ideas?

Daniel





More information about the Devel mailing list