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

Lennart Poettering lennart at poettering.net
Fri Jul 3 09:43:02 PDT 2015


On Fri, 03.07.15 17:22, Andrei Borzenkov (arvidjaar at gmail.com) wrote:

> On Fri, Jul 3, 2015 at 5:03 PM, 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".
> >
> 
> This would not fit systemd dependency chain anyway. All standard
> services are stopped on shutdown. As long as all existing interfaces
> are represented by a single running service (wickedd) it is
> responsibility of this service to avoid interface shutdown in such
> case. Note that 13.1 tried to use different model where each interface
> had own service. That would allow to easily exempt root filesystem
> interface from shutting down by dropping in DefaultDependency=no.
> 
> Alternative is to always use DefaultDependency=no to keep wikcedd from
> being stopped on shutdown.

I am pretty sure it's simply wrong to shutdown an interface just
because the daemon managing it goes down. Instead the daemon should
maintain its interface state somewhere in /run, and thus support being
restarted or stopped any time, without losing state or breaking the
network connection. That's what we implemented in networkd, basically.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list