Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it expected for systemd to start disabled services?

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.

like image 692
Alexis Wilke Avatar asked Aug 22 '16 18:08

Alexis Wilke


1 Answers

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.

like image 185
intelfx Avatar answered Sep 17 '22 22:09

intelfx