<p dir="ltr">On Dec 8, 2015 12:13, "Radoslaw Kamil Ejsmont" <<a href="mailto:radoslaw@ejsmont.net">radoslaw@ejsmont.net</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I am new to systemd. I am currently running Ubuntu 15.04 with ZFS. I would like to switch root filesystem to a tmpfs during system shutdown to reset root ZFS mount point (to dual boot FreeBSD). I have used /lib/systemd/system-shutdown/foo script. I have tried using systemctl switch-root, but the dbus daemon is already killed at this point.</p>
<p dir="ltr">systemctl wouldn't work anyway as systemd is not running anymore at that point – during shutdown it replaces itself with a small tool whose only purpose is to bring down whatever remains.</p>
<p dir="ltr">However, it already has the feature you need. If systemd-shutdown finds /run/initramfs at the end, it will automatically switch to that as the new root and launch /run/initramfs/shutdown.</p>
<p dir="ltr">For distros using dracut as initramfs, ZoL already has some support for this:</p>
<p dir="ltr"><a href="https://github.com/zfsonlinux/dracut/blob/master/modules.d/98systemd/dracut-shutdown.service.8.asc">https://github.com/zfsonlinux/dracut/blob/master/modules.d/98systemd/dracut-shutdown.service.8.asc</a></p>
<p dir="ltr"><a href="http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/">http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/</a></p>
<p dir="ltr">-- <br>
Mantas Mikulėnas <<a href="mailto:grawity@gmail.com">grawity@gmail.com</a>></p>