3.8 Service Removal
When a definition disappears from Machine\System\Services\, peinit
learns of it through the ordinary change-notification path. What happens
next depends on whether anything is running.
3.8.1 Not running #
An entry in Inactive, Failed, Completed, Skipped or Abandoned is discarded immediately. There is no process to consider.
3.8.2 Running #
An entry in Active, Starting, Reloading, Backoff or Stopping is not killed. The running process is a job, and a job's lifecycle is independent of the definition that produced it — removing a definition stops future management, it does not terminate work in progress.
peinit marks the entry definition-removed and keeps the cached
definition, solely to go on supervising the instance it already has.
When that instance exits it is not restarted — RestartPolicy is moot,
because there is nothing left to restart from — and peinit then discards
the entry.
While an entry is definition-removed:
- it keeps satisfying its dependents for as long as the instance is alive, because it is still running;
stopis accepted, so an administrator can drain it cleanly, using the cachedStopTimeout;start,restartandreloadare rejected withUNKNOWN_SERVICE— there is no definition to work from;statusreports the current runtime state withdefinition_removedset, so the draining instance is visible rather than silent.
definition-removed is a flag on the existing runtime state, not a
state of its own. The state machine (§6.1) and the command × state
matrix (§10.3) are unchanged by it.
Once the instance exits or is stopped, the entry — including anything in
its fd store (§10.6) — is discarded. A dependent that Requires the
removed service keeps being satisfied while the instance runs; after the
entry is discarded, the dependent's next start sees an unresolved
dependency and takes the ordinary validation path.