[systemd-devel] systemd shutdown vs ostree

Colin Guthrie gmane at colin.guthr.ie
Wed Jul 24 06:09:30 PDT 2013

'Twas brillig, and Colin Walters at 20/07/13 23:50 did gyre and gimble:
> 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:
> http://lists.freedesktop.org/archives/systemd-devel/2012-September/006668.html
> I now use this service inside dracut:
> https://git.gnome.org/browse/ostree/tree/src/dracut/ostree-prepare-root.service
> Which executes:
> https://git.gnome.org/browse/ostree/tree/src/switchroot/ostree-prepare-root.c
> 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
> for this.
> 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?

Interestingly, I asked something similar a while back. See the thread:
"x-initrd.mount + shutdown umount logic question"


In my case it was pretty much a cosmetic issue but you want a harder
exclusion I think...



Colin Guthrie

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

More information about the systemd-devel mailing list