valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0532-doc-document-service-exit-codes.patch

ecbff1
From a2176ebec2b1ff05b599362af2f8426e1c4fd3ef Mon Sep 17 00:00:00 2001
ecbff1
From: Jan Synacek <jsynacek@redhat.com>
ecbff1
Date: Thu, 26 Jan 2017 13:45:46 +0100
ecbff1
Subject: [PATCH] doc: document service exit codes
ecbff1
ecbff1
(Heavily reworked by Lennart while rebasing)
ecbff1
ecbff1
Fixes: #3545
ecbff1
Replaces: #5159
ecbff1
(cherry picked from commit 91a8f867b6fcdb9b2c4074b571e992e6c7869428)
ecbff1
ecbff1
Resolves: #1178929
ecbff1
---
de8967
 man/systemd.exec.xml | 310 +++++++++++++++++++++++++++++++++++++++++++
ecbff1
 1 file changed, 310 insertions(+)
ecbff1
ecbff1
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
ecbff1
index 1b14ced78..508146f06 100644
ecbff1
--- a/man/systemd.exec.xml
ecbff1
+++ b/man/systemd.exec.xml
ecbff1
@@ -1360,6 +1360,316 @@
ecbff1
     cf. <citerefentry project='man-pages'><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
ecbff1
   </refsect1>
ecbff1
 
ecbff1
+  <refsect1>
ecbff1
+    <title>Process exit codes</title>
ecbff1
+
ecbff1
+    <para>When invoking a unit process the service manager possibly fails to apply the execution parameters configured
ecbff1
+    with the settings above. In that case the already created service process will exit with a non-zero exit code
ecbff1
+    before the configured command line is executed. (Or in other words, the child process possibly exits with these
ecbff1
+    error codes, after having been created by the 
ecbff1
+    project='man-pages'><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry> system call, but
ecbff1
+    before the matching 
ecbff1
+    project='man-pages'><refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum></citerefentry> system call is
ecbff1
+    called.) Specifically, exit codes defined by the C library, by the LSB specification and by the systemd service
ecbff1
+    manager itself are used.</para>
ecbff1
+
ecbff1
+    <para>The following basic service exit codes are defined by the C library.</para>
ecbff1
+
ecbff1
+    
ecbff1
+      <title>Basic C library exit codes</title>
ecbff1
+      <tgroup cols='3'>
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>Exit Code</entry>
ecbff1
+            <entry>Symbolic Name</entry>
ecbff1
+            <entry>Description</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>0</entry>
ecbff1
+            <entry><constant>EXIT_SUCCESS</constant></entry>
ecbff1
+            <entry>Generic success code.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>1</entry>
ecbff1
+            <entry><constant>EXIT_FAILURE</constant></entry>
ecbff1
+            <entry>Generic failure or unspecified error.</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+      </tgroup>
ecbff1
+    
ecbff1
+
ecbff1
+    <para>The following service exit codes are defined by the 
ecbff1
+    url="https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB specification
ecbff1
+    </ulink>.
ecbff1
+    </para>
ecbff1
+
ecbff1
+    
ecbff1
+      <title>LSB service exit codes</title>
ecbff1
+      <tgroup cols='3'>
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>Exit Code</entry>
ecbff1
+            <entry>Symbolic Name</entry>
ecbff1
+            <entry>Description</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>2</entry>
ecbff1
+            <entry><constant>EXIT_INVALIDARGUMENT</constant></entry>
ecbff1
+            <entry>Invalid or excess arguments.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>3</entry>
ecbff1
+            <entry><constant>EXIT_NOTIMPLEMENTED</constant></entry>
ecbff1
+            <entry>Unimplemented feature.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>4</entry>
ecbff1
+            <entry><constant>EXIT_NOPERMISSION</constant></entry>
ecbff1
+            <entry>The user has insufficient privileges.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>5</entry>
ecbff1
+            <entry><constant>EXIT_NOTINSTALLED</constant></entry>
ecbff1
+            <entry>The program is not installed.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>6</entry>
ecbff1
+            <entry><constant>EXIT_NOTCONFIGURED</constant></entry>
ecbff1
+            <entry>The program is not configured.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>7</entry>
ecbff1
+            <entry><constant>EXIT_NOTRUNNING</constant></entry>
ecbff1
+            <entry>The program is not running.</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+      </tgroup>
ecbff1
+    
ecbff1
+
ecbff1
+    <para>
ecbff1
+      The LSB specification suggests that error codes 200 and above are reserved for implementations. Some of them are
ecbff1
+      used by the service manager to indicate problems during process invocation:
ecbff1
+    </para>
ecbff1
+    
ecbff1
+      <title>systemd-specific exit codes</title>
ecbff1
+      <tgroup cols='3'>
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>Exit Code</entry>
ecbff1
+            <entry>Symbolic Name</entry>
ecbff1
+            <entry>Description</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+        
ecbff1
+          <row>
ecbff1
+            <entry>200</entry>
ecbff1
+            <entry><constant>EXIT_CHDIR</constant></entry>
ecbff1
+            <entry>Changing to the requested working directory failed. See <varname>WorkingDirectory=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>201</entry>
ecbff1
+            <entry><constant>EXIT_NICE</constant></entry>
ecbff1
+            <entry>Failed to set up process scheduling priority (nice level). See <varname>Nice=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>202</entry>
ecbff1
+            <entry><constant>EXIT_FDS</constant></entry>
ecbff1
+            <entry>Failed to close unwanted file descriptors, or to adjust passed file descriptors.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>203</entry>
ecbff1
+            <entry><constant>EXIT_EXEC</constant></entry>
ecbff1
+            <entry>The actual process execution failed (specifically, the <citerefentry project='man-pages'><refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum></citerefentry> system call). Most likely this is caused by a missing or non-accessible executable file.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>204</entry>
ecbff1
+            <entry><constant>EXIT_MEMORY</constant></entry>
ecbff1
+            <entry>Failed to perform an action due to memory shortage.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>205</entry>
ecbff1
+            <entry><constant>EXIT_LIMITS</constant></entry>
ecbff1
+            <entry>Failed to adjust resoure limits. See <varname>LimitCPU=</varname> and related settings above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>206</entry>
ecbff1
+            <entry><constant>EXIT_OOM_ADJUST</constant></entry>
ecbff1
+            <entry>Failed to adjust the OOM setting. See <varname>OOMScoreAdjust=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>207</entry>
ecbff1
+            <entry><constant>EXIT_SIGNAL_MASK</constant></entry>
ecbff1
+            <entry>Failed to set process signal mask.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>208</entry>
ecbff1
+            <entry><constant>EXIT_STDIN</constant></entry>
ecbff1
+            <entry>Failed to set up standard input. See <varname>StandardInput=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>209</entry>
ecbff1
+            <entry><constant>EXIT_STDOUT</constant></entry>
ecbff1
+            <entry>Failed to set up standard output. See <varname>StandardOutput=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>210</entry>
ecbff1
+            <entry><constant>EXIT_CHROOT</constant></entry>
ecbff1
+            <entry>Failed to change root directory (<citerefentry project='man-pages'><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>). See <varname>RootDirectory=</varname>/<varname>RootImage=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>211</entry>
ecbff1
+            <entry><constant>EXIT_IOPRIO</constant></entry>
ecbff1
+            <entry>Failed to set up IO scheduling priority. See <varname>IOSchedulingClass=</varname>/<varname>IOSchedulingPriority=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>212</entry>
ecbff1
+            <entry><constant>EXIT_TIMERSLACK</constant></entry>
ecbff1
+            <entry>Failed to set up timer slack. See <varname>TimerSlackNSec=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>213</entry>
ecbff1
+            <entry><constant>EXIT_SECUREBITS</constant></entry>
ecbff1
+            <entry>Failed to set process secure bits. See <varname>SecureBits=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>214</entry>
ecbff1
+            <entry><constant>EXIT_SETSCHEDULER</constant></entry>
ecbff1
+            <entry>Failed to set up CPU scheduling. See <varname>CPUSchedulingPolicy=</varname>/<varname>CPUSchedulingPriority=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>215</entry>
ecbff1
+            <entry><constant>EXIT_CPUAFFINITY</constant></entry>
ecbff1
+            <entry>Failed to set up CPU affinity. See <varname>CPUAffinity=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>216</entry>
ecbff1
+            <entry><constant>EXIT_GROUP</constant></entry>
ecbff1
+            <entry>Failed to determine or change group credentials. See <varname>Group=</varname>/<varname>SupplementaryGroups=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>217</entry>
ecbff1
+            <entry><constant>EXIT_USER</constant></entry>
ecbff1
+            <entry>Failed to determine or change user credentials, or to set up user namespacing. See <varname>User=</varname>/<varname>PrivateUsers=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>218</entry>
ecbff1
+            <entry><constant>EXIT_CAPABILITIES</constant></entry>
ecbff1
+            <entry>Failed to drop capabilities, or apply ambient capabilities. See <varname>CapabilityBoundingSet=</varname>/<varname>AmbientCapabilities=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>219</entry>
ecbff1
+            <entry><constant>EXIT_CGROUP</constant></entry>
ecbff1
+            <entry>Setting up the service control group failed.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>220</entry>
ecbff1
+            <entry><constant>EXIT_SETSID</constant></entry>
ecbff1
+            <entry>Failed to create new process session.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>221</entry>
ecbff1
+            <entry><constant>EXIT_CONFIRM</constant></entry>
ecbff1
+            <entry>Execution has been cancelled by the user. See the <varname>systemd.confirm_spawn=</varname> kernel command line setting on <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>222</entry>
ecbff1
+            <entry><constant>EXIT_STDERR</constant></entry>
ecbff1
+            <entry>Failed to set up standard error output. See <varname>StandardError=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>224</entry>
ecbff1
+            <entry><constant>EXIT_PAM</constant></entry>
ecbff1
+            <entry>Failed to set up PAM session. See <varname>PAMName=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>225</entry>
ecbff1
+            <entry><constant>EXIT_NETWORK</constant></entry>
ecbff1
+            <entry>Failed to set up network namespacing. See <varname>PrivateNetwork=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>226</entry>
ecbff1
+            <entry><constant>EXIT_NAMESPACE</constant></entry>
ecbff1
+            <entry>Failed to set up mount namespacing. See <varname>ReadOnlyPaths=</varname> and related settings above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>227</entry>
ecbff1
+            <entry><constant>EXIT_NO_NEW_PRIVILEGES</constant></entry>
ecbff1
+            <entry>Failed to disable new priviliges. See <varname>NoNewPrivileges=yes</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>228</entry>
ecbff1
+            <entry><constant>EXIT_SECCOMP</constant></entry>
ecbff1
+            <entry>Failed to apply system call filters. See <varname>SystemCallFilter=</varname> and related settings above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>229</entry>
ecbff1
+            <entry><constant>EXIT_SELINUX_CONTEXT</constant></entry>
ecbff1
+            <entry>Determining or changing SELinux context failed. See <varname>SELinuxContext=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>230</entry>
ecbff1
+            <entry><constant>EXIT_PERSONALITY</constant></entry>
ecbff1
+            <entry>Failed to set up a execution domain (personality). See <varname>Personality=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>231</entry>
ecbff1
+            <entry><constant>EXIT_APPARMOR_PROFILE</constant></entry>
ecbff1
+            <entry>Failed to prepare changing AppArmor profile. See <varname>AppArmorProfile=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>232</entry>
ecbff1
+            <entry><constant>EXIT_ADDRESS_FAMILIES</constant></entry>
ecbff1
+            <entry>Failed to restrict address families. See <varname>RestrictAddressFamilies=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>233</entry>
ecbff1
+            <entry><constant>EXIT_RUNTIME_DIRECTORY</constant></entry>
ecbff1
+            <entry>Setting up runtime directory failed. See <varname>RuntimeDirectory=</varname> and related settings above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>235</entry>
ecbff1
+            <entry><constant>EXIT_CHOWN</constant></entry>
ecbff1
+            <entry>Failed to adjust socket ownership. Used for socket units only.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>236</entry>
ecbff1
+            <entry><constant>EXIT_SMACK_PROCESS_LABEL</constant></entry>
ecbff1
+            <entry>Failed to set SMACK label. See <varname>SmackProcessLabel=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>237</entry>
ecbff1
+            <entry><constant>EXIT_KEYRING</constant></entry>
ecbff1
+            <entry>Failed to set up kernel keyring.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>238</entry>
ecbff1
+            <entry><constant>EXIT_STATE_DIRECTORY</constant></entry>
ecbff1
+            <entry>Failed to set up a the unit's state directory. See <varname>StateDirectory=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>239</entry>
ecbff1
+            <entry><constant>EXIT_CACHE_DIRECTORY</constant></entry>
ecbff1
+            <entry>Failed to set up a the unit's cache directory. See <varname>CacheDirectory=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>240</entry>
ecbff1
+            <entry><constant>EXIT_LOGS_DIRECTORY</constant></entry>
ecbff1
+            <entry>Failed to set up a the unit's logging directory. See <varname>LogsDirectory=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+          <row>
ecbff1
+            <entry>241</entry>
ecbff1
+            <entry><constant>EXIT_CONFIGURATION_DIRECTORY</constant></entry>
ecbff1
+            <entry>Failed to set up a the unit's configuration directory. See <varname>ConfigurationDirectory=</varname> above.</entry>
ecbff1
+          </row>
ecbff1
+        
ecbff1
+      </tgroup>
ecbff1
+    
ecbff1
+  </refsect1>
ecbff1
+
ecbff1
   <refsect1>
ecbff1
       <title>See Also</title>
ecbff1
       <para>