[systemd-devel] Boot ordering

Uoti Urpala uoti.urpala at pp1.inet.fi
Thu Mar 19 07:46:11 PDT 2015

On Thu, 2015-03-19 at 14:27 +0100, Christoph Pleger wrote:
> >> Then, I still do not understand why my definition of a new target did
> >> not
> >> work. What is the difference between multi-user.target waiting for
> >> basic.target on the one hand and new.target waiting for basic.target and
> >> multi-user.target waiting for new.target on the other hand, aside from
> >> that one intermediate step?

You're misunderstanding some of the basics of unit ordering. That
multi-user.target has an "After:" relationship to basic.target only
means that multi-user.target ITSELF will not be considered to have been
successfully started before basic.target has. This does not say anything
about the ordering of any other units, such as the services that are
started because multi-user.target wants them - the reason why some
service is started at boot (such as which target pulls it in via a
"Wants/Requires" relationship) says NOTHING about where the service can
be ordered. If multi-user.target wants some service, it's up to the
individual dependencies of that service to determine when the service
can be started.

Typically most services started by multi-user.target run after
basic.target, but that's only because they each have the default
configuration "DefaultDependencies=yes", which implies "After:
basic.target". If some service has "DefaultDependencies=no" and defines
no other ordering requirements, it can even be the first service to run
at boot even if it's only wanted by multi-user.target.

Thus your "between basic.target and multi-user.target" is not a
well-defined requirement. My best guess about what you might actually
want to achieve (assuming you aren't so thoroughly confused that it
makes no sense at all) is a service that runs before any service that
has DefaultDependencies enabled, and which requires (most of)
basic.target. I think this would be most practically implemented as a
"DefaultDependencies=no" service, which is wanted by basic.target, and
which has explicit dependencies on (most of) other services that are
wanted by basic.target.

More information about the systemd-devel mailing list