0

According to various clauses in the docs, the "activating" state is the transition between inactive states and an active state. So far so obvious.

But how exactly is it defined?
What determines whether a service is no longer inactive but activating?
What determines whether a service is no longer activating but active?

The only thing I know of that plays into the "activating" state is the ExecStartPre script; while it is running, the service remains "activating".

Are there other means to cause a service to remain in an activating state?

Could you have the service start the primary ExecStart but only consider the service active once the executable causes some specific "I'm up!" event for instance?

1 Answer 1

1

while it is running, the service remains "activating".

That would indicate you're using the wrong Type= for your service file. See man systemd.unit and systemd.service for a pretty detailed discussion on when what service is called started. The text is too long to reasonably copy & paste in here, but from the Type= description in man systemd.service:

Type=

Configures the mechanism via which the service notifies the manager that the service start-up has finished. One of simple, exec, forking, oneshot, dbus, notify, notify-reload, or idle:

  • If set to simple (the default if ExecStart= is specified but neither Type= nor BusName= are), the service manager will consider the unit started immediately after the main service process has been forked off (i.e. immediately after fork(), and before various process attributes have been configured and in particular before the new process has called execve() to invoke the actual service binary). Typically, Type=exec is the better choice, see below.
  • The exec type is similar to simple, but the service manager will consider the unit started immediately after the main service binary has been executed.[…]
  • If set to forking, the manager will consider the unit started immediately after the binary that forked off by the manager exits. The use of this type is discouraged, use notify, notify-reload, or dbus instead […]
  • Behavior of oneshot is similar to simple; however, the service manager will consider the unit up after the main process exits. […]

[… and the bus-/notification-based schemes…]

So, there's different points in time when your service goes from "activating" to "active", depending on how it's set up. "activating" however always starts at the same point: the moment systemd begins to do whatever is specified in service file.

3
  • The service type is correct. This sentence was specifically concerning ExecStartPre and I would expect a service of any type to be considered "activating" while ExecStartPre is running.
    – Atemu
    Feb 25 at 15:16
  • Would you mind if I edited your answer to remove this confusion and add a section on the Type=notify which answers my last question?
    – Atemu
    Feb 25 at 15:17
  • I don't really understand your two comments! So I think, it might be wiser if you posted your own answer – feel free to refer to mine, if it helps :) Accepting your own answer is totally OK on here. Feb 25 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .