valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

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

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