9

I have two services, A and B, installed by two different packages.

Service B depends on service A.

Both are disabled and stopped by default.

In order to get service B running on each boot, I enable it, then I start it:

systemctl enable B
systemctl start B

Since B depends on A, I expect A to be started, and it does get started! Yet A is not enabled. Is that an expected behavior? It kind of looks weird to me, somehow.

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156

1 Answers1

17

Yes, it is the expected behavior.

The systemctl enable and systemctl disable operations configure auto-starting of a unit.

More precisely, these operations simply perform what is described in the [Install] section of a unit file (or an inverse of these actions). Most of the times, this includes adding an artificial dependency to the unit from multi-user.target or a similar system-wide target, and nothing more.

Hence, starting the unit manually or via other dependencies is completely unaffected by this. If you really want to prevent starting the unit file, either manually or via a dependency, run systemctl mask UNIT.

intelfx
  • 2,386
  • 1
  • 19
  • 32
  • Ah! I guess is not very clear when you just see the words used. We do not really need masking at this point, I just wanted to skip the `enable` so that way I do not have to handle that specific daemon. As long as others start it as required, we're all good. – Alexis Wilke Aug 24 '16 at 00:26