[systemd-devel] unable to attach pid to service delegated directory in unified mode after restart

Michal Koutný mkoutny at suse.com
Wed Mar 16 16:35:12 UTC 2022


On Wed, Mar 16, 2022 at 05:06:28PM +0100, Lennart Poettering <lennart at poettering.net> wrote:
> > That owner would be a process -- bang, you created a service with
> > delegation or a scope with "keepalive" process.
> 
> can't parse this.

That was meant as a humorous proof by contradiction that delegation on
slices is unnecessary. Nvm.

> > (The above is slightly misleading) there could be an alternative of
> > something like RemainAfterExit=yes for scopes, i.e. such scopes would
> > not be stopped after last process exiting (but systemd would still be in
> > charge of cleaning the cgroup after explicit stop request and that'd
> > also mark the scope as truly stopped).
> 
> Yeah, I'd be fine with adding RemainAfterExit= to scope units

Felip, I'd happily review such a PR ;-)


> > Such a recycled scope would only be useful via
> > org.freedesktop.systemd1.Manager.AttachProcessesToUnit().
> 
> Well, if delegation is on, then people don#t really have to use our
> API, they can just do that themselves.

True, in the unified mode it should be safe doing manually.
I was worried about migrating e.g. MainPID of a service into this scope
but PID1 should handle that AFAICS. Also since this has to be performed
by the privileged user (scopes are root's), the manual migration works.

Michal


More information about the systemd-devel mailing list