<itemizedlist>
<listitem><para>If set to <option>simple</option> (the default if <varname>ExecStart=</varname>
- is specified but neither <varname>Type=</varname> nor <varname>BusName=</varname> are), the
- service manager will consider the unit started immediately after the main service process has
- been forked off (i.e. immediately after <function>fork()</function>, and before various process
- attributes have been configured and in particular before the new process has called
- <function>execve()</function> to invoke the actual service binary). Typically,
+ is specified but neither <varname>Type=</varname> nor <varname>BusName=</varname> are, and
+ credentials are not used), the service manager will consider the unit started immediately after
+ the main service process has been forked off (i.e. immediately after <function>fork()</function>,
+ and before various process attributes have been configured and in particular before the new process
+ has called <function>execve()</function> to invoke the actual service binary). Typically,
<varname>Type=</varname><option>exec</option> is the better choice, see below.</para>
<para>It is expected that the process configured with <varname>ExecStart=</varname> is the main
Note that this means <command>systemctl start</command> command lines for <option>exec</option>
services will report failure when the service's binary cannot be invoked successfully (for
example because the selected <varname>User=</varname> doesn't exist, or the service binary is
- missing).</para></listitem>
+ missing). This type is implied if credentials are used (refer to <varname>LoadCredential=</varname>
+ in <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details).</para></listitem>
<listitem><para>If set to <option>forking</option>, the manager will consider the unit started
immediately after the binary that forked off by the manager exits. <emphasis>The use of this type
#include "devnum-util.h"
#include "env-util.h"
#include "escape.h"
+#include "exec-credential.h"
#include "exit-status.h"
#include "fd-util.h"
#include "fileio.h"
if (s->runtime_max_usec == USEC_INFINITY && s->runtime_rand_extra_usec != 0)
log_unit_warning(UNIT(s), "Service has RuntimeRandomizedExtraSec= setting, but no RuntimeMaxSec=. Ignoring.");
+ if (s->type == SERVICE_SIMPLE && s->exec_command[SERVICE_EXEC_START_POST] && exec_context_has_credentials(&s->exec_context))
+ log_unit_warning(UNIT(s), "Service uses a combination of Type=simple, ExecStartPost=, and credentials. This could lead to race conditions. Continuing.");
+
if (s->exit_type == SERVICE_EXIT_CGROUP && cg_unified() < CGROUP_UNIFIED_SYSTEMD)
log_unit_warning(UNIT(s), "Service has ExitType=cgroup set, but we are running with legacy cgroups v1, which might not work correctly. Continuing.");
/* Figure out a type automatically */
if (s->bus_name)
s->type = SERVICE_DBUS;
+ else if (exec_context_has_credentials(&s->exec_context))
+ s->type = SERVICE_EXEC;
else if (s->exec_command[SERVICE_EXEC_START])
s->type = SERVICE_SIMPLE;
else