]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man: using WantedBy=default.target is not a good idea
authorLukas Nykryn <lnykryn@redhat.com>
Tue, 1 Oct 2024 09:30:18 +0000 (11:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 2 Oct 2024 16:25:03 +0000 (18:25 +0200)
We had several users, that wrote their unit files with
WantedBy=default.target because it should be started "every time".
But for example in Fedora/CentOS/RHEL, this often breaks for
example selinux relabels (where we just want to do a relabel and reboot).

man/systemd.special.xml

index 192d09732a94a1a898e8a4614d8a461d8425f343..5fa4baed20435469fbf84025dc88017d3d09ace0 100644 (file)
             names like <varname>single</varname>, <varname>rescue</varname>, <varname>1</varname>,
             <varname>3</varname>, <varname>5</varname>, …; see
             <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
+
+            <para>For typical unit files please set <literal>WantedBy=</literal> to a regular target (like
+            <filename>multi-user.target</filename> or <filename>graphical.target</filename>),
+            instead of <filename>default.target</filename>, since such a service will also be run on special
+            boots like on system update, emergency boot…</para>
           </listitem>
         </varlistentry>
         <varlistentry>