[systemd-devel] systemd shutdown: switch-root after remounting root fs ro

Mantas Mikulėnas grawity at gmail.com
Tue Dec 8 02:22:27 PST 2015


On Dec 8, 2015 12:13, "Radoslaw Kamil Ejsmont" <radoslaw at ejsmont.net> wrote:
>
> Hi,
>
> 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.

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.

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.

For distros using dracut as initramfs, ZoL already has some support for
this:

https://github.com/zfsonlinux/dracut/blob/master/modules.d/98systemd/dracut-shutdown.service.8.asc

http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface/

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151208/c9b9e50b/attachment.html>


More information about the systemd-devel mailing list