[systemd-devel] How to keep certain services or mounts active during shutdown?

Lennart Poettering lennart at poettering.net
Fri Jul 3 09:35:21 PDT 2015


On Fri, 03.07.15 16:03, Frank Steiner (fsteiner-mail1 at bio.ifi.lmu.de) wrote:

> Lennart Poettering wrote
> 
> > Normally the network mounts should be ordered after network.target,
> > and wicked before that. Since in systemd the shutdown order is always
> > the inverse of the startup order this would mean that the mounts are
> > removed first, and wicked only stopped afterwards.
> 
> I guess the problem is the root-over-nfs. On reboot I can see all
> the NFS mounts are unmounted, but not / (which is good :-)). Then wicked
> stops. It seems the system is not aware of the root fs the way it
> gets mounted over nfs(v4) in dracut. I can't find any matching .mount
> in /run/systemd or in "systemctl list-dependencies".

But this means that wicked is generally incompatible with NFS-root. If
it is used in such a setup, then there are two options:

   a) it should be able to leave network interfaces up when it exits

or 

   b) it should run in the initrd, completely outside of all systemd
   management, as something that feels more like a kernel component
   then a userspace component. To make this happen it should run in a
   KillMode=none service, and set its argv[0][0] = '@'. The first
   thing will disable killing in the first shutdown phase, the second
   one also in the second one.

I am pretty sure that a) is the correct option though, and is what we
implement with networkd.

Option b) specifically means that you cannot restart wicked from
binaries of the host, it needs be remain started in the instance from
the initrd, and can never be replaced except via reboot.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list