[systemd-devel] systemd shutdown vs ostree

Colin Guthrie gmane at colin.guthr.ie
Thu Sep 12 13:27:04 PDT 2013


'Twas brillig, and Lennart Poettering at 12/09/13 17:43 did gyre and gimble:
> On Sat, 20.07.13 18:50, Colin Walters (walters at verbum.org) wrote:
> 
> Heya,
> 
>> 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.
> 
> So, as mentioned in the other thread, /usr should probably be on some
> "OS resource blacklist" or so, and not attempted to be shutdown.
> 
> But unmounting /var during shutdown should actually work. The only thing
> that currently stops this from working cleanly is that journald is
> configured to stay around until the last moment, but currently has not
> interface to tell it to move its logging back to /run from /var. When we
> have that then the /var issue should go away for you, no?

It would be quite nice to have an easy way for a compliant initrd to say
it can and will handle /var unmounting (perhaps by dropping a
var.mount.d/ snippet in the /run/systemd/system/ folder at boot?). This
will allow us to get persistent logs in which the initrd can report it's
progress until the last possible moment. This might help debugging any
problems in this particular link of the shutdown chain.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

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