| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd-coredump" conditional='ENABLE_COREDUMP' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-coredump</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-coredump</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-coredump</refname> |
| 21 |
<refname>systemd-coredump.socket</refname> |
| 22 |
<refname>[email protected]</refname> |
| 23 |
<refpurpose>Acquire, save and process core dumps</refpurpose> |
| 24 |
</refnamediv> |
| 25 |
|
| 26 |
<refsynopsisdiv> |
| 27 |
<para><filename>/usr/lib/systemd/systemd-coredump</filename></para> |
| 28 |
<para><filename>/usr/lib/systemd/systemd-coredump</filename> <option>--backtrace</option></para> |
| 29 |
<para><filename>[email protected]</filename></para> |
| 30 |
<para><filename>systemd-coredump.socket</filename></para> |
| 31 |
</refsynopsisdiv> |
| 32 |
|
| 33 |
<refsect1> |
| 34 |
<title>Description</title> |
| 35 |
<para><filename>[email protected]</filename> is a system service to process core dumps. It will |
| 36 |
log a summary of the event to |
| 37 |
<citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 38 |
including information about the process identifier, owner, the signal that killed the process, and the |
| 39 |
stack trace if possible. It may also save the core dump for later processing. See the "Information about |
| 40 |
the crashed process" section below.</para> |
| 41 |
|
| 42 |
<para>The behavior of a specific program upon reception of a signal is governed by a few factors which |
| 43 |
are described in detail in <citerefentry |
| 44 |
project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>. In |
| 45 |
particular, the core dump will only be processed when the related process resource limits |
| 46 |
(<constant>RLIMIT_CORE</constant>) are sufficient.</para> |
| 47 |
|
| 48 |
<para>Core dumps can be written to the journal or saved as a file. In both cases, they can be retrieved |
| 49 |
for further processing, for example in |
| 50 |
<citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 51 |
See <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
| 52 |
in particular the <command>list</command> and <command>debug</command> verbs.</para> |
| 53 |
|
| 54 |
<para>By default, <command>systemd-coredump</command> will log the core dump to the journal, including a |
| 55 |
backtrace if possible, and store the core dump (an image of the memory contents of the process) itself in |
| 56 |
an external file in <filename>/var/lib/systemd/coredump/</filename>. These core dumps are deleted after a |
| 57 |
few days by default; see <filename>/usr/lib/tmpfiles.d/systemd.conf</filename> for details. Note that the |
| 58 |
removal of core files from the file system and the purging of journal entries are independent, and the |
| 59 |
core file may be present without the journal entry, and journal entries may point to since-removed core |
| 60 |
files. Some metadata is attached to core files in the form of extended attributes, so the core files are |
| 61 |
useful for some purposes even without the full metadata available in the journal entry.</para> |
| 62 |
|
| 63 |
<para>For further details see <ulink url="https://systemd.io/COREDUMP">systemd Coredump |
| 64 |
Handling</ulink>.</para> |
| 65 |
|
| 66 |
<refsect2> |
| 67 |
<title>Invocation of <command>systemd-coredump</command></title> |
| 68 |
|
| 69 |
<para>The <command>systemd-coredump</command> executable does the actual work. It is invoked twice: |
| 70 |
once as the handler by the kernel, and the second time in the |
| 71 |
<filename>[email protected]</filename> to actually write the data to the journal and process |
| 72 |
and save the core file.</para> |
| 73 |
|
| 74 |
<para>When the kernel invokes <command>systemd-coredump</command> to handle a core dump, it runs in |
| 75 |
privileged mode, and will connect to the socket created by the |
| 76 |
<filename>systemd-coredump.socket</filename> unit, which in turn will spawn an unprivileged |
| 77 |
<filename>[email protected]</filename> instance to process the core dump. Hence |
| 78 |
<filename>systemd-coredump.socket</filename> and <filename>[email protected]</filename> are |
| 79 |
helper units which do the actual processing of core dumps and are subject to normal service |
| 80 |
management.</para> |
| 81 |
|
| 82 |
<para>It is also possible to invoke <command>systemd-coredump</command> with |
| 83 |
<option>--backtrace</option> option. In this case, <command>systemd-coredump</command> expects a |
| 84 |
journal entry in the journal |
| 85 |
<ulink url="https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format">Journal Export Format</ulink> |
| 86 |
on standard input. The entry should contain a <varname>MESSAGE=</varname> field and any additional |
| 87 |
metadata fields the caller deems reasonable. <command>systemd-coredump</command> will append additional |
| 88 |
metadata fields in the same way it does for core dumps received from the kernel. In this mode, no core |
| 89 |
dump is stored in the journal.</para> |
| 90 |
</refsect2> |
| 91 |
|
| 92 |
<refsect2> |
| 93 |
<title>Core dumps in Containers/Namespaces</title> |
| 94 |
|
| 95 |
<para>The <filename>[email protected]</filename> service will automatically attempt to extract |
| 96 |
a stacktrace from a process as it crashes. For this stacktrace symbols will be resolved based on debug |
| 97 |
information embedded in the crashing ELF image, or equivalent debug information separately available on |
| 98 |
the host OS. For processes that crash inside of local containers or other mount namespace-based |
| 99 |
sandboxes, this auxiliary debug information is typically not available on the host (simply because |
| 100 |
containers typically run different software versions than the |
| 101 |
host). <filename>systemd-coredump</filename> provides two mechanisms to address this:</para> |
| 102 |
|
| 103 |
<orderedlist> |
| 104 |
<listitem><para>For full-OS containers running systemd inside it is a good idea to enable |
| 105 |
<varname>CoredumpReceive=</varname> on the unit (see |
| 106 |
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>), |
| 107 |
which ensures that coredumps of a container are attempted to be forwarded to |
| 108 |
<filename>[email protected]</filename> running inside the container, i.e the container gets |
| 109 |
to process and store its own core dumps. Note that |
| 110 |
<citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 111 |
defaults to this mode if invoked with the <option>--boot</option> switch. This mode of operation is |
| 112 |
generally recommended for security reasons: the security-sensitive processing of the core dump is |
| 113 |
done within the confinements of the container itself, by the container's own code, backed by the |
| 114 |
container's own storage.</para></listitem> |
| 115 |
|
| 116 |
<listitem><para>Alternatively, for more restricted containers (that do not run a proper |
| 117 |
<filename>init</filename> system as PID 1) it is possible to enable processing of the core dump on |
| 118 |
the host, with access to the debug information data from the container itself. This mode of operation |
| 119 |
must be enabled via <varname>EnterNamespace=</varname> in |
| 120 |
<citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
| 121 |
and defaults to off, for security reasons.</para></listitem> |
| 122 |
</orderedlist> |
| 123 |
|
| 124 |
<para>If both <varname>CoredumpReceive=</varname> is enabled on the unit of the container the core dump |
| 125 |
belongs to, and <varname>EnterNamespace=</varname> is enabled in the <filename>coredump.conf</filename> |
| 126 |
configuration file, the former takes precedence.</para> |
| 127 |
</refsect2> |
| 128 |
</refsect1> |
| 129 |
|
| 130 |
<refsect1> |
| 131 |
<title>Configuration</title> |
| 132 |
<para>For programs started by <command>systemd</command>, process resource limits can be set by directive |
| 133 |
<varname>LimitCORE=</varname>, see |
| 134 |
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 135 |
</para> |
| 136 |
|
| 137 |
<para>In order to be used by the kernel to handle core dumps, |
| 138 |
<command>systemd-coredump</command> must be configured in |
| 139 |
<citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 140 |
parameter <varname>kernel.core_pattern</varname>. The syntax of this parameter is explained in |
| 141 |
<citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 142 |
systemd installs the file <filename>/usr/lib/sysctl.d/50-coredump.conf</filename> which configures |
| 143 |
<varname>kernel.core_pattern</varname> accordingly. This file may be masked or overridden to use a different |
| 144 |
setting following normal |
| 145 |
<citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 146 |
rules. If the sysctl configuration is modified, it must be updated in the kernel before it |
| 147 |
takes effect, see |
| 148 |
<citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 149 |
and |
| 150 |
<citerefentry><refentrytitle>systemd-sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
| 151 |
</para> |
| 152 |
|
| 153 |
<para>In order to be used in the <option>--backtrace</option> mode, an appropriate backtrace |
| 154 |
handler must be installed on the sender side. For example, in case of |
| 155 |
<citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry>, this |
| 156 |
means a <varname>sys.excepthook</varname> must be installed, see |
| 157 |
<ulink url="https://github.com/systemd/systemd-coredump-python">systemd-coredump-python</ulink>. |
| 158 |
</para> |
| 159 |
|
| 160 |
<para>The behavior of <command>systemd-coredump</command> itself is configured through the configuration file |
| 161 |
<filename>/etc/systemd/coredump.conf</filename> and corresponding snippets |
| 162 |
<filename>/etc/systemd/coredump.conf.d/*.conf</filename>, see |
| 163 |
<citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. A new |
| 164 |
instance of <command>systemd-coredump</command> is invoked upon receiving every core dump. Therefore, changes |
| 165 |
in these files will take effect the next time a core dump is received.</para> |
| 166 |
|
| 167 |
<para>Resources used by core dump files are restricted in two ways. Parameters like maximum size of acquired |
| 168 |
core dumps and files can be set in files <filename>/etc/systemd/coredump.conf</filename> and snippets mentioned |
| 169 |
above. In addition the storage time of core dump files is restricted by <command>systemd-tmpfiles</command>, |
| 170 |
corresponding settings are by default in <filename>/usr/lib/tmpfiles.d/systemd.conf</filename>. The default is |
| 171 |
to delete core dumps after a few days; see the above file for details.</para> |
| 172 |
|
| 173 |
<refsect2> |
| 174 |
<title>Disabling coredump processing</title> |
| 175 |
|
| 176 |
<para>To disable potentially resource-intensive processing by <command>systemd-coredump</command>, set |
| 177 |
<programlisting>Storage=none |
| 178 |
ProcessSizeMax=0</programlisting> in |
| 179 |
<citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 180 |
</para> |
| 181 |
</refsect2> |
| 182 |
</refsect1> |
| 183 |
|
| 184 |
<refsect1> |
| 185 |
<title>Information about the crashed process</title> |
| 186 |
|
| 187 |
<para><citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> can |
| 188 |
be used to retrieve saved core dumps independently of their location, to display information, and to |
| 189 |
process them e.g. by passing to the GNU debugger (gdb).</para> |
| 190 |
|
| 191 |
<para>Data stored in the journal can be also viewed with |
| 192 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> as usual |
| 193 |
(or from any other process, using the |
| 194 |
<citerefentry><refentrytitle>sd-journal</refentrytitle><manvolnum>3</manvolnum></citerefentry> API). |
| 195 |
The relevant messages have <constant>MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1</constant>:</para> |
| 196 |
<programlisting>$ journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose |
| 197 |
… |
| 198 |
MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 |
| 199 |
COREDUMP_PID=552351 |
| 200 |
COREDUMP_UID=1000 |
| 201 |
COREDUMP_GID=1000 |
| 202 |
COREDUMP_SIGNAL_NAME=SIGSEGV |
| 203 |
COREDUMP_SIGNAL=11 |
| 204 |
COREDUMP_CODE=2 |
| 205 |
COREDUMP_TIMESTAMP=1614342930000000 |
| 206 |
COREDUMP_COMM=Web Content |
| 207 |
COREDUMP_EXE=/usr/lib64/firefox/firefox |
| 208 |
COREDUMP_USER_UNIT=app-gnome-firefox-552136.scope |
| 209 |
COREDUMP_CMDLINE=/usr/lib64/firefox/firefox -contentproc -childID 5 -isForBrowser … |
| 210 |
COREDUMP_CGROUP=/user.slice/user-1000.slice/[email protected]/app.slice/app-….scope |
| 211 |
COREDUMP_FILENAME=/var/lib/systemd/coredump/core.Web….552351.….zst |
| 212 |
… |
| 213 |
</programlisting> |
| 214 |
|
| 215 |
<para>The following fields are saved (if known) with the journal entry</para> |
| 216 |
|
| 217 |
<variablelist class='journal-directives'> |
| 218 |
<varlistentry> |
| 219 |
<term><varname>COREDUMP_UID=</varname></term> |
| 220 |
<term><varname>COREDUMP_PID=</varname></term> |
| 221 |
<term><varname>COREDUMP_GID=</varname></term> |
| 222 |
<listitem><para>The process number (PID), owner user number (UID), and group number (GID) of the |
| 223 |
crashed process.</para> |
| 224 |
|
| 225 |
<para>When the crashed process was part of a container (or in a process or user namespace in |
| 226 |
general), those are the values as seen <emphasis>outside</emphasis>, in the namespace where |
| 227 |
<filename>systemd-coredump</filename> is running.</para> |
| 228 |
|
| 229 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 230 |
</listitem> |
| 231 |
</varlistentry> |
| 232 |
|
| 233 |
<varlistentry> |
| 234 |
<term><varname>COREDUMP_BY_PIDFD=</varname></term> |
| 235 |
<listitem><para>If the crashed process was analyzed using a PIDFD provided by the kernel (requires |
| 236 |
kernel v6.16) then this field will be present and set to <literal>1</literal>. If this field is |
| 237 |
not set, then the crashed process was analyzed via a PID, which is known to be subject to race |
| 238 |
conditions.</para> |
| 239 |
|
| 240 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 241 |
</listitem> |
| 242 |
</varlistentry> |
| 243 |
|
| 244 |
<varlistentry> |
| 245 |
<term><varname>COREDUMP_TIMESTAMP=</varname></term> |
| 246 |
<listitem><para>The time of the crash as reported by the kernel (in μs since the epoch).</para> |
| 247 |
|
| 248 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 249 |
</listitem> |
| 250 |
</varlistentry> |
| 251 |
|
| 252 |
<varlistentry> |
| 253 |
<term><varname>COREDUMP_RLIMIT=</varname></term> |
| 254 |
<listitem><para>The core file size soft resource limit, see |
| 255 |
<citerefentry project='man-pages'><refentrytitle>getrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry>. |
| 256 |
</para> |
| 257 |
|
| 258 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 259 |
</varlistentry> |
| 260 |
|
| 261 |
<varlistentry> |
| 262 |
<term><varname>COREDUMP_UNIT=</varname></term> |
| 263 |
<term><varname>COREDUMP_SLICE=</varname></term> |
| 264 |
<listitem><para>The system unit and slice names.</para> |
| 265 |
|
| 266 |
<para>When the crashed process was in container, those are the units names |
| 267 |
<emphasis>outside</emphasis>, in the main system manager.</para> |
| 268 |
|
| 269 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 270 |
</listitem> |
| 271 |
</varlistentry> |
| 272 |
|
| 273 |
<varlistentry> |
| 274 |
<term><varname>COREDUMP_CGROUP=</varname></term> |
| 275 |
|
| 276 |
<listitem><para>The primary cgroup of the unit of the crashed process.</para> |
| 277 |
|
| 278 |
<para>When the crashed process was in a container, this is the full path, as seen outside of the |
| 279 |
container.</para> |
| 280 |
|
| 281 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 282 |
</listitem> |
| 283 |
</varlistentry> |
| 284 |
|
| 285 |
<varlistentry> |
| 286 |
<term><varname>COREDUMP_PROC_CGROUP=</varname></term> |
| 287 |
<listitem><para>Control group information in the format used in |
| 288 |
<filename>/proc/self/cgroup</filename>. On systems with the unified cgroup hierarchy, this is a |
| 289 |
single path prefixed with <literal>0::</literal>, and multiple paths prefixed with controller numbers |
| 290 |
on legacy systems.</para> |
| 291 |
|
| 292 |
<para>When the crashed process was in a container, this is the full path, as seen outside of the |
| 293 |
container.</para> |
| 294 |
|
| 295 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 296 |
</listitem> |
| 297 |
</varlistentry> |
| 298 |
|
| 299 |
<varlistentry> |
| 300 |
<term><varname>COREDUMP_OWNER_UID=</varname></term> |
| 301 |
<term><varname>COREDUMP_USER_UNIT=</varname></term> |
| 302 |
<term><varname>COREDUMP_SESSION=</varname></term> |
| 303 |
<listitem><para>The numerical UID of the user owning the login session or systemd user unit of the |
| 304 |
crashed process, the user manager unit, and the session identifier. All three fields are only present |
| 305 |
for user processes.</para> |
| 306 |
|
| 307 |
<para>When the crashed process was in container, those are the values <emphasis>outside</emphasis>, |
| 308 |
in the main system.</para> |
| 309 |
|
| 310 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 311 |
</listitem> |
| 312 |
</varlistentry> |
| 313 |
|
| 314 |
<varlistentry> |
| 315 |
<term><varname>COREDUMP_SIGNAL_NAME=</varname></term> |
| 316 |
<term><varname>COREDUMP_SIGNAL=</varname></term> |
| 317 |
|
| 318 |
<listitem><para>The terminating signal name (with the <literal>SIG</literal> prefix |
| 319 |
<footnote><para><citerefentry |
| 320 |
project='man-pages'><refentrytitle>kill</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 321 |
expects signal names <emphasis>without</emphasis> the prefix; <citerefentry |
| 322 |
project='man-pages'><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry> uses |
| 323 |
the prefix; all systemd tools accept signal names both with and without the prefix. |
| 324 |
</para></footnote>) and numerical value. (Both are included because signal numbers vary by |
| 325 |
architecture.)</para> |
| 326 |
|
| 327 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 328 |
</listitem> |
| 329 |
</varlistentry> |
| 330 |
|
| 331 |
<varlistentry> |
| 332 |
<term><varname>COREDUMP_CODE=</varname></term> |
| 333 |
|
| 334 |
<listitem><para>The reason why the signal was sent as a numerical value. The code is defined as |
| 335 |
field <varname>si_code</varname> in the <varname>siginfo_t</varname> structure and |
| 336 |
documented in <citerefentry |
| 337 |
project='man-pages'><refentrytitle>sigaction</refentrytitle><manvolnum>2</manvolnum></citerefentry>. |
| 338 |
</para> |
| 339 |
|
| 340 |
<xi:include href="version-info.xml" xpointer="v261"/> |
| 341 |
</listitem> |
| 342 |
</varlistentry> |
| 343 |
|
| 344 |
<varlistentry> |
| 345 |
<term><varname>COREDUMP_CWD=</varname></term> |
| 346 |
<term><varname>COREDUMP_ROOT=</varname></term> |
| 347 |
|
| 348 |
<listitem><para>The current working directory and root directory of the crashed process.</para> |
| 349 |
|
| 350 |
<para>When the crashed process is in a container, those paths are relative to the root of the |
| 351 |
container's mount namespace.</para> |
| 352 |
|
| 353 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 354 |
</listitem> |
| 355 |
</varlistentry> |
| 356 |
|
| 357 |
<varlistentry> |
| 358 |
<term><varname>COREDUMP_DUMPABLE=</varname></term> |
| 359 |
|
| 360 |
<listitem><para>The <constant>PR_GET_DUMPABLE</constant> field as reported by the kernel, see |
| 361 |
<citerefentry |
| 362 |
project='man-pages'><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>. |
| 363 |
</para> |
| 364 |
|
| 365 |
<xi:include href="version-info.xml" xpointer="v258"/> |
| 366 |
</listitem> |
| 367 |
</varlistentry> |
| 368 |
|
| 369 |
<varlistentry> |
| 370 |
<term><varname>COREDUMP_OPEN_FDS=</varname></term> |
| 371 |
|
| 372 |
<listitem><para>Information about open file descriptors, in the following format:</para> |
| 373 |
<programlisting><replaceable>fd</replaceable>:<replaceable>/path/to/file</replaceable> |
| 374 |
pos: ... |
| 375 |
flags: ... |
| 376 |
... |
| 377 |
|
| 378 |
<replaceable>fd</replaceable>:<replaceable>/path/to/file</replaceable> |
| 379 |
pos: ... |
| 380 |
flags: ... |
| 381 |
... |
| 382 |
</programlisting> |
| 383 |
|
| 384 |
<para>The first line contains the file descriptor number <replaceable>fd</replaceable> and the path, |
| 385 |
while subsequent lines show the contents of |
| 386 |
<filename>/proc/<replaceable>pid</replaceable>/fdinfo/<replaceable>fd</replaceable></filename>. |
| 387 |
</para> |
| 388 |
|
| 389 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 390 |
</varlistentry> |
| 391 |
|
| 392 |
<varlistentry> |
| 393 |
<term><varname>COREDUMP_EXE=</varname></term> |
| 394 |
|
| 395 |
<listitem><para>The destination of the <filename>/proc/<replaceable>pid</replaceable>/exe</filename> |
| 396 |
symlink.</para> |
| 397 |
|
| 398 |
<para>When the crashed process is in a container, that path is relative to the root of the |
| 399 |
container's mount namespace.</para> |
| 400 |
|
| 401 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 402 |
</varlistentry> |
| 403 |
|
| 404 |
<varlistentry> |
| 405 |
<term><varname>COREDUMP_CMDLINE=</varname></term> |
| 406 |
<term><varname>COREDUMP_COMM=</varname></term> |
| 407 |
<term><varname>COREDUMP_ENVIRON=</varname></term> |
| 408 |
<term><varname>COREDUMP_PROC_AUXV=</varname></term> |
| 409 |
<term><varname>COREDUMP_PROC_LIMITS=</varname></term> |
| 410 |
<term><varname>COREDUMP_PROC_MAPS=</varname></term> |
| 411 |
<term><varname>COREDUMP_PROC_MOUNTINFO=</varname></term> |
| 412 |
<term><varname>COREDUMP_PROC_STATUS=</varname></term> |
| 413 |
|
| 414 |
<listitem><para>Fields that map the per-process entries in the <filename>/proc/</filename> |
| 415 |
filesystem: <filename>/proc/<replaceable>pid</replaceable>/cmdline</filename> (the command line of |
| 416 |
the crashed process), <filename>/proc/<replaceable>pid</replaceable>/comm</filename> (the command |
| 417 |
name associated with the process), <filename>/proc/<replaceable>pid</replaceable>/environ</filename> |
| 418 |
(the environment block of the crashed process), |
| 419 |
<filename>/proc/<replaceable>pid</replaceable>/auxv</filename> (the auxiliary vector of the crashed |
| 420 |
process, see <citerefentry |
| 421 |
project='man-pages'><refentrytitle>getauxval</refentrytitle><manvolnum>3</manvolnum></citerefentry>), |
| 422 |
<filename>/proc/<replaceable>pid</replaceable>/limits</filename> (the soft and hard resource limits), |
| 423 |
<filename>/proc/<replaceable>pid</replaceable>/maps</filename> (memory regions visible to the process |
| 424 |
and their access permissions), <filename>/proc/<replaceable>pid</replaceable>/mountinfo</filename> |
| 425 |
(mount points in the process's mount namespace), |
| 426 |
<filename>/proc/<replaceable>pid</replaceable>/status</filename> (various metadata about the |
| 427 |
process).</para> |
| 428 |
|
| 429 |
<para>See |
| 430 |
<citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 431 |
for more information.</para> |
| 432 |
|
| 433 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 434 |
</varlistentry> |
| 435 |
|
| 436 |
<varlistentry> |
| 437 |
<term><varname>COREDUMP_HOSTNAME=</varname></term> |
| 438 |
|
| 439 |
<listitem><para>The system hostname.</para> |
| 440 |
|
| 441 |
<para>When the crashed process was in container, this is the container hostname.</para> |
| 442 |
|
| 443 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 444 |
</listitem> |
| 445 |
</varlistentry> |
| 446 |
|
| 447 |
<varlistentry> |
| 448 |
<term><varname>COREDUMP_CONTAINER_CMDLINE=</varname></term> |
| 449 |
|
| 450 |
<listitem><para>For processes running in a container, the command line of the process spawning the |
| 451 |
container (the first parent process with a different mount namespace).</para> |
| 452 |
|
| 453 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 454 |
</varlistentry> |
| 455 |
|
| 456 |
<varlistentry> |
| 457 |
<term><varname>COREDUMP=</varname></term> |
| 458 |
|
| 459 |
<listitem><para>When the core is stored in the journal, the core image itself.</para> |
| 460 |
|
| 461 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 462 |
</listitem> |
| 463 |
</varlistentry> |
| 464 |
|
| 465 |
<varlistentry> |
| 466 |
<term><varname>COREDUMP_FILENAME=</varname></term> |
| 467 |
|
| 468 |
<listitem><para>When the core is stored externally, the path to the core file.</para> |
| 469 |
|
| 470 |
<xi:include href="version-info.xml" xpointer="v248"/> |
| 471 |
</listitem> |
| 472 |
</varlistentry> |
| 473 |
|
| 474 |
<varlistentry> |
| 475 |
<term><varname>COREDUMP_TRUNCATED=</varname></term> |
| 476 |
|
| 477 |
<listitem><para>Set to <literal>1</literal> when the saved coredump was truncated. (A partial core |
| 478 |
image may still be processed by some tools, though obviously not all information is available.) |
| 479 |
</para> |
| 480 |
|
| 481 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 482 |
</varlistentry> |
| 483 |
|
| 484 |
<varlistentry> |
| 485 |
<term><varname>COREDUMP_PACKAGE_NAME=</varname></term> |
| 486 |
<term><varname>COREDUMP_PACKAGE_VERSION=</varname></term> |
| 487 |
<term><varname>COREDUMP_PACKAGE_JSON=</varname></term> |
| 488 |
|
| 489 |
<listitem><para>If the executable contained .package metadata ELF notes, they will be parsed and |
| 490 |
attached. The <varname>package</varname> and <varname>version</varname> of the 'main' ELF module |
| 491 |
(i.e., the executable) will be appended individually. The JSON-formatted content of all modules will |
| 492 |
be appended as a single JSON object, each with the module name as the key. For more information about |
| 493 |
this metadata format and content, see the |
| 494 |
<ulink url="https://systemd.io/PACKAGE_METADATA_FOR_EXECUTABLE_FILES/">Package Metadata for Executable Files</ulink> |
| 495 |
document. |
| 496 |
</para> |
| 497 |
|
| 498 |
<xi:include href="version-info.xml" xpointer="v249"/> |
| 499 |
</listitem> |
| 500 |
</varlistentry> |
| 501 |
|
| 502 |
<varlistentry> |
| 503 |
<term><varname>MESSAGE=</varname></term> |
| 504 |
|
| 505 |
<listitem><para>The message generated by <command>systemd-coredump</command> that includes the |
| 506 |
backtrace if it was successfully generated. When <command>systemd-coredump</command> is invoked with |
| 507 |
<option>--backtrace</option>, this field is provided by the caller.</para> |
| 508 |
|
| 509 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 510 |
</varlistentry> |
| 511 |
</variablelist> |
| 512 |
|
| 513 |
<para>Various other fields exist in the journal entry, but pertain to the logging process, |
| 514 |
i.e. <command>systemd-coredump</command>, not the crashed process. See |
| 515 |
<citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>. |
| 516 |
</para> |
| 517 |
|
| 518 |
<para>The following fields are saved (if known) with the external file listed in |
| 519 |
<varname>COREDUMP_FILENAME=</varname> as extended attributes:</para> |
| 520 |
|
| 521 |
<variablelist> |
| 522 |
<varlistentry> |
| 523 |
<term><varname>user.coredump.pid</varname></term> |
| 524 |
<term><varname>user.coredump.uid</varname></term> |
| 525 |
<term><varname>user.coredump.gid</varname></term> |
| 526 |
<term><varname>user.coredump.signal</varname></term> |
| 527 |
<term><varname>user.coredump.timestamp</varname></term> |
| 528 |
<term><varname>user.coredump.rlimit</varname></term> |
| 529 |
<term><varname>user.coredump.hostname</varname></term> |
| 530 |
<term><varname>user.coredump.comm</varname></term> |
| 531 |
<term><varname>user.coredump.exe</varname></term> |
| 532 |
|
| 533 |
<listitem><para>Those are the same as <varname>COREDUMP_PID=</varname>, |
| 534 |
<varname>COREDUMP_UID=</varname>, <varname>COREDUMP_GID=</varname>, |
| 535 |
<varname>COREDUMP_SIGNAL=</varname>, <varname>COREDUMP_TIMESTAMP=</varname>, |
| 536 |
<varname>COREDUMP_RLIMIT=</varname>, <varname>COREDUMP_HOSTNAME=</varname>, |
| 537 |
<varname>COREDUMP_COMM=</varname>, and <varname>COREDUMP_EXE=</varname>, described above. |
| 538 |
</para> |
| 539 |
|
| 540 |
<xi:include href="version-info.xml" xpointer="v248"/></listitem> |
| 541 |
</varlistentry> |
| 542 |
</variablelist> |
| 543 |
|
| 544 |
<para>Those can be viewed using |
| 545 |
<citerefentry project='man-pages'><refentrytitle>getfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 546 |
For the core file described in the journal entry shown above: |
| 547 |
<programlisting>$ getfattr --absolute-names -d /var/lib/systemd/coredump/core.Web….552351.….zst |
| 548 |
# file: /var/lib/systemd/coredump/core.Web….552351.….zst |
| 549 |
user.coredump.pid="552351" |
| 550 |
user.coredump.uid="1000" |
| 551 |
user.coredump.gid="1000" |
| 552 |
user.coredump.signal="11" |
| 553 |
user.coredump.timestamp="1614342930000000" |
| 554 |
user.coredump.comm="Web Content" |
| 555 |
user.coredump.exe="/usr/lib64/firefox/firefox" |
| 556 |
… |
| 557 |
</programlisting> |
| 558 |
</para> |
| 559 |
</refsect1> |
| 560 |
|
| 561 |
<refsect1> |
| 562 |
<title>See Also</title> |
| 563 |
<para><simplelist type="inline"> |
| 564 |
<member><citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 565 |
<member><citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 566 |
<member><citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 567 |
<member><citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 568 |
<member><citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 569 |
<member><citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 570 |
<member><citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 571 |
<member><ulink url="https://systemd.io/COREDUMP">systemd Coredump Handling</ulink></member> |
| 572 |
</simplelist></para> |
| 573 |
</refsect1> |
| 574 |
</refentry> |