As I know systemd stores dependencies between services in unit files. I need to know how systemd behaves on boot:

  1. Does it load unit files from specific paths and recalculate dependencies every time on boot?

  2. Or it stores this dependency graph in some file and load this file at boot?

in (2) case as I think dependency graph could be recalculated via some command for example on sysctl add.

As I see from sources it is (1). But it seems that this have bad influence on performance. Why (2) is not implemented? Am I wrong? Thanks.


The dependency graph in systemd is only kept in memory. There is no (binary) on-disk cache of loaded units or their properties whatsoever.

But it seems that this have bad influence on performance.

The unit files are completely re-read and the dependency graph is completely recalculated every time you issue systemctl daemon-reload or call an equivalent bus method (org.freedesktop.systemd1.Reload()), which is synchronous. As you may see from execution time of that command, such recalculation does not impede performance in any way.


It loads all the unit files from two specific paths (usually /usr/lib/systemd/system and /etc/systemd/system).

Calculating dependencies is VERY fast in systemd. It has a main target defined, such as the multi-user.target which runs after other targets such as basic.target but which in the same time wants some units that are actually symlinks in the multi-user.target.wants directory.

Figuring out which is the order the units would get executed should take just a few ms so it wouldn't be required to have some sort of cache for this.

  • There is also third path for the unit files: /run/systemd/system. – intelfx Apr 8 '15 at 10:09
  • 1
    Actually, it's nine specific paths. Five are currently documented, split across two manual pages. Three are intentionally undocumented. One was deleted from the documentation accidentally when the intentionally undocumented three were removed. – JdeBP Apr 8 '15 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.