[systemd-devel] systemd shutdown vs ostree
walters at verbum.org
Sat Jul 20 15:50:13 PDT 2013
So OSTree sets up systemd inside a chroot - /usr is a read-only bind
mount, and /var is a bind mount outside the root to a shared location.
Furthermore, /sysroot points to the real root.
Since last time we discussed this:
I now use this service inside dracut:
Then finally we do dracut's normal systemctl switch-root, and everything
continues as normal. I haven't had to patch the systemd codebase at all
The problem is that on shutdown, systemd will synthesize usr.mount and
var.mount from /proc/self/mountinfo, but it can't really unmount them
until the same point as the rootfs. Because these units fail to
unmount, the normal shutdown process wedges.
I can shutdown fine with systemctl --force poweroff, but then I don't
get plymouth integration etc.
One way to fix this might be to somehow tell systemd to just ignore
these mount points during shutdown. Or possibly, switch back to the
initramfs and unmount them from there.
The ugly thing about switching back to the initramfs is that it requires
unpacking it from the cpio blob again, which requires /boot to be
mounted, only to run a few unmount syscalls, and then finally power off.
But if there was a way to tell systemd to just ignore the mounts, then
we'd drop into the final poweroff SIGTERM/SIGKILL/umount spree like
sysvinit did, and things would work.
Anyone else doing bind mount tricks like this?
More information about the systemd-devel