]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs: add a note about selectively overriding default dependencies
authorLuca BRUNO <luca.bruno@coreos.com>
Mon, 19 Sep 2022 10:09:17 +0000 (10:09 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 20 Sep 2022 11:57:26 +0000 (13:57 +0200)
This documents that explicit `Before=`/`After=` dependencies can be
used to selectively override implicit ordering coming from default
dependencies. That allows for more granular control compared to the
already documented `DefaultDependencies=no` option.

The alternative approach came up in a discussion around the ordering
of `boot-complete.target`, so this also adds an explicit suggestion
in that direction to the "Automatic Boot Assessment" documentation.

Ref: https://lists.freedesktop.org/archives/systemd-devel/2022-September/048330.html

docs/AUTOMATIC_BOOT_ASSESSMENT.md
man/systemd.unit.xml

index c1173cf5093820337c1242b9e306a899426d3d85..c2a53f48dcf7a1c52762c4fef627a3e9026507c9 100644 (file)
@@ -197,6 +197,14 @@ are a couple of recommendations.
    wrap them in a unit and order them after `boot-complete.target`, pulling it
    in.
 
+   Such unit would be typically wanted (or required) by one of the
+   [`bootup`](https://www.freedesktop.org/software/systemd/man/bootup.html) targets,
+   for example `multi-user.target`. To avoid potential loops due to conflicting
+   [default dependencies](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Default%20Dependencies)
+   ordering, it is recommended to also add an explicit dependency (e.g.
+   `After=multi-user.target`) to the unit. This overrides the implicit ordering
+   and allows `boot-complete.target` to start after the given bootup target.
+
 ## FAQ
 
 1. *I have a service which — when it fails — should immediately cause a
index 02d5e72aeebf717244afa03b690d9cda567d4165..e29bb98540491991af341e7bb6c8027de086c76d 100644 (file)
 
       <para>For example, target units will complement all configured dependencies of type
       <varname>Wants=</varname> or <varname>Requires=</varname> with dependencies of type
-      <varname>After=</varname> unless <varname>DefaultDependencies=no</varname> is set in the
-      specified units. See
+      <varname>After=</varname>. See
       <citerefentry><refentrytitle>systemd.target</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-      for details. Note that this behavior can be turned off by setting
-      <varname>DefaultDependencies=no</varname>.</para>
+      for details. Note that this behavior can be opted out by setting
+      <varname>DefaultDependencies=no</varname> in the specified units, or it can be selectively
+      overidden via an explicit <varname>Before=</varname> dependency.</para>
     </refsect2>
   </refsect1>