From 45f09f939b50387d65ab6fc46f47608523a6ef19 Mon Sep 17 00:00:00 2001 From: John Lin Date: Tue, 12 Sep 2017 12:02:27 +0800 Subject: [PATCH] man: explicitly distinguish "implicit dependencies" and "default dependencies" Fixes: #6793 --- man/systemd-gpt-auto-generator.xml | 2 +- man/systemd.automount.xml | 29 ++++++++---- man/systemd.device.xml | 8 +++- man/systemd.exec.xml | 35 +++++++------- man/systemd.mount.xml | 73 ++++++++++++++++++------------ man/systemd.path.xml | 41 +++++++++++------ man/systemd.resource-control.xml | 15 ++++-- man/systemd.scope.xml | 33 +++++++++----- man/systemd.service.xml | 68 ++++++++++++++++------------ man/systemd.slice.xml | 30 ++++++++---- man/systemd.socket.xml | 71 ++++++++++++++++------------- man/systemd.swap.xml | 29 ++++++++---- man/systemd.target.xml | 33 ++++++++------ man/systemd.timer.xml | 38 +++++++++++----- man/systemd.unit.xml | 43 ++++++++++++------ 15 files changed, 347 insertions(+), 201 deletions(-) diff --git a/man/systemd-gpt-auto-generator.xml b/man/systemd-gpt-auto-generator.xml index eb7a2c4c28d..2927fcd2913 100644 --- a/man/systemd-gpt-auto-generator.xml +++ b/man/systemd-gpt-auto-generator.xml @@ -70,7 +70,7 @@ fstab5), the units this generator creates are overridden, but additional - automatic dependencies might be created. + implicit dependencies might be created. This generator will only look for root partitions on the same physical disk the EFI System Partition (ESP) is located on. diff --git a/man/systemd.automount.xml b/man/systemd.automount.xml index a43dc981bdf..49ea7e510c9 100644 --- a/man/systemd.automount.xml +++ b/man/systemd.automount.xml @@ -87,19 +87,30 @@ - Automatic Dependencies + Implicit Dependencies - If an automount unit is beneath another mount unit in the - file system hierarchy, both a requirement and an ordering - dependency between both units are created automatically. + The following dependencies are implicitly added: - An implicit Before= dependency is created - between an automount unit and the mount unit it activates. + + If an automount unit is beneath another mount unit in the + file system hierarchy, both a requirement and an ordering + dependency between both units are created automatically. - Automount units acquire automatic Before= and Conflicts= on - umount.target in order to be stopped during shutdown, unless - DefaultDependencies=no is set in the [Unit] section. + An implicit Before= dependency is created + between an automount unit and the mount unit it activates. + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Automount units acquire automatic Before= and + Conflicts= on umount.target in order to be stopped during + shutdown. + diff --git a/man/systemd.device.xml b/man/systemd.device.xml index effed098dd8..c60b9c035ef 100644 --- a/man/systemd.device.xml +++ b/man/systemd.device.xml @@ -86,7 +86,7 @@ - Automatic Dependencies + Implicit Dependencies Many unit types automatically acquire dependencies on device units of devices they require. For example, @@ -97,6 +97,12 @@ block devices. + + Default Dependencies + + There are no default dependencies for device units. + + The udev Database diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index 707cab28aae..0661fa8b39c 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -81,27 +81,30 @@ - Automatic Dependencies + Implicit Dependencies - A few execution parameters result in additional, automatic - dependencies to be added. + A few execution parameters result in additional, automatic dependencies to be added: - Units with WorkingDirectory=, RootDirectory=, RootImage=, - RuntimeDirectory=, StateDirectory=, CacheDirectory=, - LogsDirectory= or ConfigurationDirectory= set automatically gain dependencies - of type Requires= and After= on all mount units required to access the specified paths. - This is equivalent to having them listed explicitly in RequiresMountsFor=. + + Units with WorkingDirectory=, RootDirectory=, RootImage=, + RuntimeDirectory=, StateDirectory=, CacheDirectory=, + LogsDirectory= or ConfigurationDirectory= set automatically gain dependencies + of type Requires= and After= on all mount units required to access the specified paths. + This is equivalent to having them listed explicitly in RequiresMountsFor=. - Similar, units with PrivateTmp= enabled automatically get mount unit dependencies for all - mounts required to access /tmp and /var/tmp. They will also gain an - automatic After= dependency on - systemd-tmpfiles-setup.service8. + Similar, units with PrivateTmp= enabled automatically get mount unit dependencies for all + mounts required to access /tmp and /var/tmp. They will also gain an + automatic After= dependency on + systemd-tmpfiles-setup.service8. - Units whose standard output or error output is connected to , - or (or their combinations with console output, see below) automatically acquire dependencies - of type After= on systemd-journald.socket. + Units whose standard output or error output is connected to , + or (or their combinations with console output, see below) automatically acquire dependencies + of type After= on systemd-journald.socket. + + + Options @@ -591,7 +594,7 @@ If the standard output (or error output, see below) of a unit is connected to the journal, syslog or the kernel log buffer, the unit will implicitly gain a dependency of type After= on - systemd-journald.socket (also see the automatic dependencies section above). + systemd-journald.socket (also see the "Implicit Dependencies" section above). This setting defaults to the value set with in diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml index 3d3a0a7cc72..58cdb547ea8 100644 --- a/man/systemd.mount.xml +++ b/man/systemd.mount.xml @@ -109,40 +109,57 @@ - Automatic Dependencies + Implicit Dependencies - If a mount unit is beneath another mount unit in the file - system hierarchy, both a requirement dependency and an ordering - dependency between both units are created automatically. + The following dependencies are implicitly added: - Block device backed file systems automatically gain - BindsTo= and After= type - dependencies on the device unit encapsulating the block - device (see below). + + If a mount unit is beneath another mount unit in the file + system hierarchy, both a requirement dependency and an ordering + dependency between both units are created automatically. - If traditional file system quota is enabled for a mount - unit, automatic Wants= and - Before= dependencies on - systemd-quotacheck.service and - quotaon.service are added. + Block device backed file systems automatically gain + BindsTo= and After= type + dependencies on the device unit encapsulating the block + device (see below). - For mount units with DefaultDependencies=yes in the [Unit] section (the - default) a couple additional dependencies are added. Mount units referring to local file systems automatically gain - an After= dependency on local-fs-pre.target. Network mount units - automatically acquire After= dependencies on remote-fs-pre.target, - network.target and network-online.target. Towards the latter a - Wants= unit is added as well. Mount units referring to local and network file systems are + If traditional file system quota is enabled for a mount + unit, automatic Wants= and + Before= dependencies on + systemd-quotacheck.service and + quotaon.service are added. + + Additional implicit dependencies may be added as result of + execution and resource control parameters as documented in + systemd.exec5 + and + systemd.resource-control5. + + + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + All mount units acquire automatic Before= and Conflicts= on + umount.target in order to be stopped during shutdown. + + Mount units referring to local file systems automatically gain + an After= dependency on local-fs-pre.target. + + Network mount units + automatically acquire After= dependencies on remote-fs-pre.target, + network.target and network-online.target. Towards the latter a + Wants= unit is added as well. + + + Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases this is not sufficient (for example network block device based mounts, such as iSCSI), in which case may be added to the mount option - string of the unit, which forces systemd to consider the mount unit a network mount. Mount units (regardless if - local or network) also acquire automatic Before= and Conflicts= on - umount.target in order to be stopped during shutdown. - - Additional implicit dependencies may be added as result of - execution and resource control parameters as documented in - systemd.exec5 - and - systemd.resource-control5. + string of the unit, which forces systemd to consider the mount unit a network mount. diff --git a/man/systemd.path.xml b/man/systemd.path.xml index 7200c8fe276..9e8f2c66c1d 100644 --- a/man/systemd.path.xml +++ b/man/systemd.path.xml @@ -82,23 +82,36 @@ - Automatic Dependencies + Implicit Dependencies - If a path unit is beneath another mount unit in the file - system hierarchy, both a requirement and an ordering dependency - between both units are created automatically. + The following dependencies are implicitly added: - An implicit Before= dependency is added - between a path unit and the unit it is supposed to activate. + + If a path unit is beneath another mount unit in the file + system hierarchy, both a requirement and an ordering dependency + between both units are created automatically. - Unless DefaultDependencies=false in the [Unit] section is used, path - units will implicitly have dependencies of type Before= on paths.target, - dependencies of type After= and Requires= on - sysinit.target, and have dependencies of type Conflicts= and - Before= on shutdown.target. These ensure that path units are terminated - cleanly prior to system shutdown. Only path units involved with early boot or late system shutdown should disable - this option. - + An implicit Before= dependency is added + between a path unit and the unit it is supposed to activate. + + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Path units will automatically have dependencies of type Before= on + paths.target, + dependencies of type After= and Requires= on + sysinit.target, and have dependencies of type Conflicts= and + Before= on shutdown.target. These ensure that path units are terminated + cleanly prior to system shutdown. Only path units involved with early boot or late system shutdown should + disable DefaultDependencies= option. + + + diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index 9b1f5dbbabe..ed75e737ace 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -93,12 +93,19 @@ - Automatic Dependencies + Implicit Dependencies - Units with the Slice= setting set automatically acquire Requires= and - After= dependencies on the specified slice unit. + The following dependencies are implicitly added: + + + Units with the Slice= setting set automatically acquire + Requires= and After= dependencies on the specified + slice unit. + + + Unified and Legacy Control Group Hierarchies @@ -578,7 +585,7 @@ Special care should be taken when relying on the default slice assignment in templated service units that have DefaultDependencies=no set, see systemd.service5, section - "Automatic Dependencies" for details. + "Default Dependencies" for details. diff --git a/man/systemd.scope.xml b/man/systemd.scope.xml index 36f24d46a12..e41493cdd37 100644 --- a/man/systemd.scope.xml +++ b/man/systemd.scope.xml @@ -75,22 +75,31 @@ - Automatic Dependencies + Implicit Dependencies - Unless DefaultDependencies=false - is used, scope units will implicitly have dependencies of - type Conflicts= and - Before= on - shutdown.target. These ensure - that scope units are removed prior to system - shutdown. Only scope units involved with early boot or - late system shutdown should disable this option. - - - Additional implicit dependencies may be added as result of + Implicit dependencies may be added as result of resource control parameters as documented in systemd.resource-control5. + + + Default Dependencies + + The following dependencies are added unless + DefaultDependencies=no is set: + + + Scope units will automatically have dependencies of + type Conflicts= and + Before= on + shutdown.target. These ensure + that scope units are removed prior to system + shutdown. Only scope units involved with early boot or + late system shutdown should disable + DefaultDependencies= option. + + + diff --git a/man/systemd.service.xml b/man/systemd.service.xml index c6fa0edea0a..0b8963b7b89 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -89,37 +89,23 @@ - Automatic Dependencies + Implicit Dependencies - Services with Type=dbus set automatically - acquire dependencies of type Requires= and - After= on - dbus.socket. + The following dependencies are implicitly added: - Socket activated services are automatically ordered after - their activating .socket units via an - automatic After= dependency. - Services also pull in all .socket units - listed in Sockets= via automatic - Wants= and After= dependencies. + + Services with Type=dbus set automatically + acquire dependencies of type Requires= and + After= on + dbus.socket. - Unless DefaultDependencies= in the [Unit] is set to - , service units will implicitly have dependencies of type Requires= and - After= on sysinit.target, a dependency of type After= on - basic.target as well as dependencies of type Conflicts= and - Before= on shutdown.target. These ensure that normal service units pull in - basic system initialization, and are terminated cleanly prior to system shutdown. Only services involved with early - boot or late system shutdown should disable this option. - - Instanced service units (i.e. service units with an @ in their name) are assigned by - default a per-template slice unit (see - systemd.slice5), named after the - template unit, containing all instances of the specific template. This slice is normally stopped at shutdown, - together with all template instances. If that is not desired, set DefaultDependencies=no in the - template unit, and either define your own per-template slice unit file that also sets - DefaultDependencies=no, or set Slice=system.slice (or another suitable slice) - in the template unit. Also see - systemd.resource-control5. + Socket activated services are automatically ordered after + their activating .socket units via an + automatic After= dependency. + Services also pull in all .socket units + listed in Sockets= via automatic + Wants= and After= dependencies. + Additional implicit dependencies may be added as result of execution and resource control parameters as documented in @@ -128,6 +114,32 @@ systemd.resource-control5. + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Service units will have dependencies of type Requires= and + After= on sysinit.target, a dependency of type After= on + basic.target as well as dependencies of type Conflicts= and + Before= on shutdown.target. These ensure that normal service units pull in + basic system initialization, and are terminated cleanly prior to system shutdown. Only services involved with early + boot or late system shutdown should disable this option. + + Instanced service units (i.e. service units with an @ in their name) are assigned by + default a per-template slice unit (see + systemd.slice5), named after the + template unit, containing all instances of the specific template. This slice is normally stopped at shutdown, + together with all template instances. If that is not desired, set DefaultDependencies=no in the + template unit, and either define your own per-template slice unit file that also sets + DefaultDependencies=no, or set Slice=system.slice (or another suitable slice) + in the template unit. Also see + systemd.resource-control5. + + + + Options diff --git a/man/systemd.slice.xml b/man/systemd.slice.xml index 3ff3cc5188b..67f7a934481 100644 --- a/man/systemd.slice.xml +++ b/man/systemd.slice.xml @@ -103,17 +103,29 @@ - Automatic Dependencies + Implicit Dependencies - Slice units automatically gain dependencies of type - After= and Requires= on - their immediate parent slice unit. + The following dependencies are implicitly added: - Unless DefaultDependencies=false is used in the [Unit] section, slice - units will implicitly have dependencies of type Conflicts= and Before= on - shutdown.target. These ensure that slice units are removed prior to system shutdown. Only - slice units involved with early boot or late system shutdown should disable this option. - + + Slice units automatically gain dependencies of type + After= and Requires= on + their immediate parent slice unit. + + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Slice units will automatically have dependencies of type Conflicts= and + Before= on + shutdown.target. These ensure that slice units are removed prior to system shutdown. + Only slice units involved with late system shutdown should disable + DefaultDependencies= option. + diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 1d20a8f7f75..5bec53ac1ef 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -97,16 +97,7 @@ foo@.service must exist from which services are instantiated for each incoming connection. - Unless DefaultDependencies= in the [Unit] section is set to - , socket units will implicitly have dependencies of type Requires= and - After= on sysinit.target as well as dependencies of type - Conflicts= and Before= on shutdown.target. These ensure - that socket units pull in basic system initialization, and are terminated cleanly prior to system shutdown. Only - sockets involved with early boot or late system shutdown should disable this option. - - Socket units will have a Before= - dependency on the service which they trigger added implicitly. No - implicit WantedBy= or + No implicit WantedBy= or RequiredBy= dependency from the socket to the service is added. This means that the service may be started without the socket, in which case it must be able to open sockets @@ -130,31 +121,24 @@ - Automatic Dependencies + Implicit Dependencies - Socket units automatically gain a Before= - dependency on the service units they activate. + The following dependencies are implicitly added: - Socket units referring to file system paths (such as AF_UNIX - sockets or FIFOs) implicitly gain Requires= and - After= dependencies on all mount units - necessary to access those paths. + + Socket units automatically gain a Before= + dependency on the service units they activate. - Socket units using the BindToDevice= - setting automatically gain a BindsTo= and - After= dependency on the device unit - encapsulating the specified network interface. + Socket units referring to file system paths (such as AF_UNIX + sockets or FIFOs) implicitly gain Requires= and + After= dependencies on all mount units + necessary to access those paths. - If DefaultDependencies=yes is set (the - default), socket units automatically gain a - Before= dependency on - sockets.target. They also gain a pair of - After= and Requires= - dependency on sysinit.target, and a pair of - Before= and Conflicts= - dependencies on shutdown.target. These - dependencies ensure that the socket unit is started before normal - services at boot, and is stopped on shutdown. + Socket units using the BindToDevice= + setting automatically gain a BindsTo= and + After= dependency on the device unit + encapsulating the specified network interface. + Additional implicit dependencies may be added as result of execution and resource control parameters as documented in @@ -163,6 +147,29 @@ systemd.resource-control5. + + Default Dependencies + + The following dependencies are added unless + DefaultDependencies=no is set: + + + Socket units automatically gain a + Before= dependency on + sockets.target. + + Socket units automatically gain a pair of + After= and Requires= + dependency on sysinit.target, and a pair of + Before= and Conflicts= + dependencies on shutdown.target. These + dependencies ensure that the socket unit is started before normal + services at boot, and is stopped on shutdown. Only sockets + involved with early boot or late system shutdown should disable + DefaultDependencies= option. + + + Options @@ -358,7 +365,7 @@ specified network interfaces. This controls the SO_BINDTODEVICE socket option (see socket7 - for details). If this option is used, an automatic dependency + for details). If this option is used, an implicit dependency from this socket unit on the network interface device unit (systemd.device5 is created. Note that setting this parameter might result in diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml index 184abff2605..254389e774c 100644 --- a/man/systemd.swap.xml +++ b/man/systemd.swap.xml @@ -87,17 +87,16 @@ - Automatic Dependencies + Implicit Dependencies - All swap units automatically get the - BindsTo= and After= - dependencies on the device units or the mount units of the files - they are activated from. + The following dependencies are implicitly added: - Swap units with DefaultDependencies= set to its default value in the - [Unit] section enabled implicitly acquire a Conflicts= and a - Before= dependency on umount.target so that they are deactivated at - shutdown as well as a Before=swap.target dependency. + + All swap units automatically get the + BindsTo= and After= + dependencies on the device units or the mount units of the files + they are activated from. + Additional implicit dependencies may be added as result of execution and resource control parameters as documented in @@ -106,6 +105,18 @@ systemd.resource-control5. + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Swap units automatically acquire a Conflicts= and a + Before= dependency on umount.target so that they are deactivated at + shutdown as well as a Before=swap.target dependency. + + + <filename>fstab</filename> diff --git a/man/systemd.target.xml b/man/systemd.target.xml index dbe7ff014bc..281f5d4d6c6 100644 --- a/man/systemd.target.xml +++ b/man/systemd.target.xml @@ -80,22 +80,29 @@ - Automatic Dependencies + Implicit Dependencies - Unless DefaultDependencies= is set to - in either of related units or an explicit ordering - dependency is already defined, target units will implicitly complement all - configured dependencies of type Wants= or - Requires= with dependencies of type - After=. Note that Wants= or - Requires= must be defined in the target unit itself — if - you for example define Wants=some.target in - some.service, the implicit ordering will not be added. + There are no implicit dependencies for target units. + - All target units automatically gain Conflicts= - dependency against shutdown.target unless DefaultDependencies= - is set to . + + Default Dependencies + The following dependencies are added unless + DefaultDependencies=no is set: + + + Target units will automatically complement all + configured dependencies of type Wants= or + Requires= with dependencies of type + After=. Note that Wants= or + Requires= must be defined in the target unit itself — if + you for example define Wants=some.target in + some.service, the automatic ordering will not be added. + + Target units automatically gain Conflicts= + dependency against shutdown.target. + diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml index 26a47a1e5ab..b8f921f3af7 100644 --- a/man/systemd.timer.xml +++ b/man/systemd.timer.xml @@ -82,20 +82,34 @@ - Automatic Dependencies + Implicit Dependencies - Timer units automatically gain a Before= - dependency on the service they are supposed to activate. + The following dependencies are implicitly added: - Unless DefaultDependencies= in the [Unit] section is set to - , all timer units will implicitly have dependencies of type Requires= and - After= on sysinit.target, a dependency of type Before= - on timers.target, as well as Conflicts= and Before= on - shutdown.target to ensure that they are stopped cleanly prior to system shutdown. Timer units - with at least one OnCalendar= directive will have an additional After= - dependency on time-sync.target to avoid being started before the system clock has been - correctly set. Only timer units involved with early boot or late system shutdown should disable the - DefaultDependencies= option. + + Timer units automatically gain a Before= + dependency on the service they are supposed to activate. + + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Timer units will automatically have dependencies of type Requires= and + After= on sysinit.target, a dependency of type Before= + on timers.target, as well as Conflicts= and Before= on + shutdown.target to ensure that they are stopped cleanly prior to system shutdown. Only timer + units involved with early boot or late system shutdown should disable the + DefaultDependencies= option. + + Timer units + with at least one OnCalendar= directive will have an additional After= + dependency on time-sync.target to avoid being started before the system clock has been + correctly set. + diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index 32399ef9933..69000aab31f 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -268,24 +268,41 @@ - Automatic Dependencies + Implicit Dependencies - A number of unit dependencies are automatically established, - depending on unit configuration. On top of that, for units with - DefaultDependencies=yes (the default) a couple - of additional dependencies are added. The precise effect of - DefaultDependencies=yes depends on the unit - type (see below). + A number of unit dependencies are implicitly established, + depending on unit type and unit configuration. These implicit + dependencies can make unit configuration file cleaner. For the + implicit dependencies in each unit type, please refer to + section "Implicit Dependencies" in respective man pages. - If DefaultDependencies=yes is set, units - that are referenced by other units of type - .target via a Wants= or - Requires= dependency might automatically gain - an Before= dependency too. See - systemd.target5 + For example, service units with Type=dbus + automatically acquire dependencies of type Requires= + and After= on dbus.socket. See + systemd.service5 for details. + + Default Dependencies + + Default dependencies are similar to implicit dependencies, + but can be turned on and off by setting + DefaultDependencies= to yes + (the default) and no, while implicit dependencies + are always in effect. See section "Default Dependencies" in respective + man pages for the effect of enabling + DefaultDependencies= in each unit types. + + For example, target units will complement all configured + dependencies of type type Wants= or + Requires= with dependencies of type + After=. See + systemd.target5 + for details. Note that this behavior can be turned off by setting + DefaultDependencies=no. + + Unit File Load Path