[systemd-devel] Unmount / right before reboot/shutdown/kexec

Tom Gundersen teg at jklm.no
Fri Feb 13 15:37:46 PST 2015


On Fri, Feb 13, 2015 at 11:15 PM, Lorenzo Pistone
<blaffablaffa at gmail.com> wrote:
> the cloud provider I'm testing has rather strange setup. All volumes are
> provided through nbd, including /, and they have to be unmounted cleanly for
> reboot to work successfully, because the rebooted or kexec'd kernel will
> retry to attach them and if there host thinks there's already a connection
> mounting will fail. However, unmounting needs to happen as the very last
> thing before rebooting, because after that / will disappear. They currently
> have an unholy hack: they replace systemd-reboot.service with their own
> version that simply disconnects / and calls 'echo b > /proc/sysrq-trigger'.
> I believe this is far from the correct way of doing things (among the other
> things, an update of systemd replaces systemd-reboot.service). How can this
> be done more cleanly?
>
> Please don't argue whether having / as a ndb device is a good thing. It is
> not my call.

I don't know all the details of your setup, so take this with a pinch of salt:

Usually it is the task of whomever set up / in the first place to tear
it down. So if your initrd sets upd the ndb device, you might want to
have a logic similar to what dracut does where you would jump back
into the initrd at shutdown and cleanly tear stuff down from there.

HTH,

Tom


More information about the systemd-devel mailing list