]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/coredumpctl.xml
man: add version info
[thirdparty/systemd.git] / man / coredumpctl.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="coredumpctl" conditional='ENABLE_COREDUMP'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>coredumpctl</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>coredumpctl</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>coredumpctl</refname>
21 <refpurpose>Retrieve and process saved core dumps and metadata</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>coredumpctl</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 <arg choice="req">COMMAND</arg>
29 <arg choice="opt" rep="repeat">PID|COMM|EXE|MATCH</arg>
30 </cmdsynopsis>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para><command>coredumpctl</command> is a tool that can be used to retrieve and process core
37 dumps and metadata which were saved by
38 <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
39 </para>
40 </refsect1>
41
42 <refsect1>
43 <title>Commands</title>
44
45 <para>The following commands are understood:</para>
46
47 <variablelist>
48 <varlistentry>
49 <term><command>list</command></term>
50
51 <listitem><para>List core dumps captured in the journal
52 matching specified characteristics. If no command is
53 specified, this is the implied default.</para>
54
55 <para>The output is designed to be human readable and contains a table with the following
56 columns:</para>
57 <variablelist>
58 <varlistentry>
59 <term>TIME</term>
60 <listitem><para>The timestamp of the crash, as reported by the kernel.</para>
61
62 <xi:include href="version-info.xml" xpointer="v233"/>
63 </listitem>
64 </varlistentry>
65
66 <varlistentry>
67 <term>PID</term>
68 <listitem><para>The identifier of the process that crashed.</para>
69
70 <xi:include href="version-info.xml" xpointer="v233"/>
71 </listitem>
72 </varlistentry>
73
74 <varlistentry>
75 <term>UID</term>
76 <term>GID</term>
77 <listitem><para>The user and group identifiers of the process that crashed.</para>
78
79 <xi:include href="version-info.xml" xpointer="v233"/>
80 </listitem>
81 </varlistentry>
82
83 <varlistentry>
84 <term>SIGNAL</term>
85 <listitem><para>The signal that caused the process to crash, when applicable.
86 </para>
87
88 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term>COREFILE</term>
93 <listitem><para>Information whether the coredump was stored, and whether
94 it is still accessible: <literal>none</literal> means the core was
95 not stored, <literal>-</literal> means that it was not available (for
96 example because the process was not terminated by a signal),
97 <literal>present</literal> means that the core file is accessible by the
98 current user, <literal>journal</literal> means that the core was stored
99 in the <literal>journal</literal>, <literal>truncated</literal> is the
100 same as one of the previous two, but the core was too large and was not
101 stored in its entirety, <literal>error</literal> means that the core file
102 cannot be accessed, most likely because of insufficient permissions, and
103 <literal>missing</literal> means that the core was stored in a file, but
104 this file has since been removed.</para>
105
106 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term>EXE</term>
111 <listitem><para>The full path to the executable. For backtraces of scripts
112 this is the name of the interpreter.</para>
113
114 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
115 </varlistentry>
116 </variablelist>
117
118 <para>It's worth noting that different restrictions apply to
119 data saved in the journal and core dump files saved in
120 <filename>/var/lib/systemd/coredump</filename>, see overview in
121 <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
122 Thus it may very well happen that a particular core dump is still listed
123 in the journal while its corresponding core dump file has already been
124 removed.</para></listitem>
125 </varlistentry>
126
127 <varlistentry>
128 <term><command>info</command></term>
129
130 <listitem><para>Show detailed information about the last core dump
131 or core dumps matching specified characteristics
132 captured in the journal.</para></listitem>
133 </varlistentry>
134
135 <varlistentry>
136 <term><command>dump</command></term>
137
138 <listitem><para>Extract the last core dump matching specified
139 characteristics. The core dump will be written on standard
140 output, unless an output file is specified with
141 <option>--output=</option>. </para></listitem>
142 </varlistentry>
143
144 <varlistentry>
145 <term><command>debug</command></term>
146
147 <listitem><para>Invoke a debugger on the last core dump
148 matching specified characteristics. By default,
149 <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
150 will be used. This may be changed using the <option>--debugger=</option>
151 option or the <varname>$SYSTEMD_DEBUGGER</varname> environment
152 variable. Use the <option>--debugger-arguments=</option> option to pass extra
153 command line arguments to the debugger.</para>
154
155 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
156 </varlistentry>
157
158 </variablelist>
159
160 </refsect1>
161
162 <refsect1>
163 <title>Options</title>
164
165 <para>The following options are understood:</para>
166
167 <variablelist>
168
169 <xi:include href="standard-options.xml" xpointer="help" />
170 <xi:include href="standard-options.xml" xpointer="version" />
171 <xi:include href="standard-options.xml" xpointer="no-pager" />
172 <xi:include href="standard-options.xml" xpointer="no-legend" />
173 <xi:include href="standard-options.xml" xpointer="json" />
174
175 <varlistentry>
176 <term><option>-1</option></term>
177
178 <listitem><para>Show information of the most recent core dump only, instead of listing all known core
179 dumps. Equivalent to <option>--reverse -n 1</option>.</para>
180
181 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
182 </varlistentry>
183
184 <varlistentry>
185 <term><option>-n</option> <replaceable>INT</replaceable></term>
186
187 <listitem><para>Show at most the specified number of entries. The specified parameter must be an
188 integer greater or equal to 1.</para>
189
190 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
191 </varlistentry>
192
193 <varlistentry>
194 <term><option>-S</option></term>
195 <term><option>--since</option></term>
196
197 <listitem><para>Only print entries which are since the specified date.</para>
198
199 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><option>-U</option></term>
204 <term><option>--until</option></term>
205
206 <listitem><para>Only print entries which are until the specified date.</para>
207
208 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
209 </varlistentry>
210
211 <varlistentry>
212 <term><option>-r</option></term>
213 <term><option>--reverse</option></term>
214
215 <listitem><para>Reverse output so that the newest entries are displayed first.
216 </para>
217
218 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
219 </varlistentry>
220
221 <varlistentry>
222 <term><option>-F</option> <replaceable>FIELD</replaceable></term>
223 <term><option>--field=</option><replaceable>FIELD</replaceable></term>
224
225 <listitem><para>Print all possible data values the specified
226 field takes in matching core dump entries of the
227 journal.</para>
228
229 <xi:include href="version-info.xml" xpointer="v225"/></listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><option>-o</option> <replaceable>FILE</replaceable></term>
234 <term><option>--output=</option><replaceable>FILE</replaceable></term>
235
236 <listitem><para>Write the core to <option>FILE</option>.
237 </para></listitem>
238 </varlistentry>
239
240 <varlistentry>
241 <term><option>--debugger=</option><replaceable>DEBUGGER</replaceable></term>
242
243 <listitem><para>Use the given debugger for the <command>debug</command>
244 command. If not given and <varname>$SYSTEMD_DEBUGGER</varname> is unset, then
245 <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
246 will be used. </para>
247
248 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
249 </varlistentry>
250
251 <varlistentry>
252 <term><option>-A</option> <replaceable>ARGS</replaceable></term>
253 <term><option>--debugger-arguments=</option><replaceable>ARGS</replaceable></term>
254
255 <listitem><para>Pass the given <replaceable>ARGS</replaceable> as extra command line arguments
256 to the debugger. Quote as appropriate when <replaceable>ARGS</replaceable> contain whitespace.
257 (See Examples.)</para>
258
259 <xi:include href="version-info.xml" xpointer="v248"/></listitem>
260 </varlistentry>
261
262 <varlistentry>
263 <term><option>--file=<replaceable>GLOB</replaceable></option></term>
264
265 <listitem><para>Takes a file glob as an argument. If
266 specified, coredumpctl will operate on the specified journal
267 files matching <replaceable>GLOB</replaceable> instead of the
268 default runtime and system journal paths. May be specified
269 multiple times, in which case files will be suitably
270 interleaved.</para>
271
272 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
273 </varlistentry>
274
275 <varlistentry>
276 <term><option>-D</option> <replaceable>DIR</replaceable></term>
277 <term><option>--directory=</option><replaceable>DIR</replaceable></term>
278
279 <listitem><para>Use the journal files in the specified <option>DIR</option>.
280 </para>
281
282 <xi:include href="version-info.xml" xpointer="v225"/></listitem>
283 </varlistentry>
284
285 <varlistentry>
286 <term><option>--root=<replaceable>ROOT</replaceable></option></term>
287
288 <listitem><para>Use root directory <option>ROOT</option> when searching for coredumps.
289 </para>
290
291 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
292 </varlistentry>
293
294 <varlistentry>
295 <term><option>--image=<replaceable>image</replaceable></option></term>
296
297 <listitem><para>Takes a path to a disk image file or block device node. If specified, all operations
298 are applied to file system in the indicated disk image. This option is similar to
299 <option>--root=</option>, but operates on file systems stored in disk images or block devices. The
300 disk image should either contain just a file system or a set of file systems within a GPT partition
301 table, following the <ulink url="https://uapi-group.org/specifications/specs/discoverable_partitions_specification">Discoverable Partitions
302 Specification</ulink>. For further information on supported disk images, see
303 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
304 switch of the same name.</para>
305
306 <xi:include href="version-info.xml" xpointer="v252"/></listitem>
307 </varlistentry>
308
309 <xi:include href="standard-options.xml" xpointer="image-policy-open" />
310
311 <varlistentry>
312 <term><option>-q</option></term>
313 <term><option>--quiet</option></term>
314
315 <listitem><para>Suppresses informational messages about lack
316 of access to journal files and possible in-flight coredumps.
317 </para>
318
319 <xi:include href="version-info.xml" xpointer="v233"/></listitem>
320 </varlistentry>
321
322 <varlistentry>
323 <term><option>--all</option></term>
324
325 <listitem><para>Look at all available journal files in <filename>/var/log/journal/</filename>
326 (excluding journal namespaces) instead of only local ones.</para>
327
328 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
329 </varlistentry>
330 </variablelist>
331 </refsect1>
332
333 <refsect1>
334 <title>Matching</title>
335
336 <para>A match can be:</para>
337
338 <variablelist>
339 <varlistentry>
340 <term><replaceable>PID</replaceable></term>
341
342 <listitem><para>Process ID of the
343 process that dumped
344 core. An integer.</para>
345
346 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
347 </varlistentry>
348
349 <varlistentry>
350 <term><replaceable>COMM</replaceable></term>
351
352 <listitem><para>Name of the executable (matches
353 <option>COREDUMP_COMM=</option>). Must not contain slashes.
354 </para>
355
356 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
357 </varlistentry>
358
359 <varlistentry>
360 <term><replaceable>EXE</replaceable></term>
361
362 <listitem><para>Path to the executable (matches
363 <option>COREDUMP_EXE=</option>). Must contain at least one
364 slash. </para>
365
366 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
367 </varlistentry>
368
369 <varlistentry>
370 <term><replaceable>MATCH</replaceable></term>
371
372 <listitem><para>General journalctl match filter, must contain an equals
373 sign (<literal>=</literal>). See
374 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
375 </para>
376
377 <xi:include href="version-info.xml" xpointer="v215"/></listitem>
378 </varlistentry>
379 </variablelist>
380 </refsect1>
381
382 <refsect1>
383 <title>Exit status</title>
384 <para>On success, 0 is returned; otherwise, a non-zero failure
385 code is returned. Not finding any matching core dumps is treated as
386 failure.
387 </para>
388 </refsect1>
389
390 <refsect1>
391 <title>Environment</title>
392
393 <variablelist class='environment-variables'>
394 <varlistentry>
395 <term><varname>$SYSTEMD_DEBUGGER</varname></term>
396 <listitem><para>Use the given debugger for the <command>debug</command>
397 command. See the <option>--debugger=</option> option.</para>
398
399 <xi:include href="version-info.xml" xpointer="v239"/></listitem>
400 </varlistentry>
401 </variablelist>
402 </refsect1>
403
404 <refsect1>
405 <title>Examples</title>
406
407 <example>
408 <title>List all the core dumps of a program</title>
409
410 <programlisting>$ coredumpctl list /usr/lib64/firefox/firefox
411 TIME PID UID GID SIG COREFILE EXE SIZE
412 Tue … 8018 1000 1000 SIGSEGV missing /usr/lib64/firefox/firefox -
413 Wed … 251609 1000 1000 SIGTRAP missing /usr/lib64/firefox/firefox -
414 Fri … 552351 1000 1000 SIGSEGV present /usr/lib64/firefox/firefox 28.7M
415 </programlisting>
416
417 <para>The journal has three entries pertaining to <filename>/usr/lib64/firefox/firefox</filename>, and
418 only the last entry still has an available core file (in external storage on disk).</para>
419
420 <para>Note that <filename>coredumpctl</filename> needs access to the journal files to retrieve the
421 relevant entries from the journal. Thus, an unprivileged user will normally only see information about
422 crashing programs of this user.</para>
423 </example>
424
425 <example>
426 <title>Invoke <command>gdb</command> on the last core dump</title>
427
428 <programlisting>$ coredumpctl debug</programlisting>
429 </example>
430
431 <example>
432 <title>Use <command>gdb</command> to display full register info from the last core dump</title>
433
434 <programlisting>$ coredumpctl debug --debugger-arguments="-batch -ex 'info all-registers'"</programlisting>
435 </example>
436
437 <example>
438 <title>Show information about a core dump matched by PID</title>
439
440 <programlisting>$ coredumpctl info 6654
441 PID: 6654 (bash)
442 UID: 1000 (user)
443 GID: 1000 (user)
444 Signal: 11 (SEGV)
445 Timestamp: Mon 2021-01-01 00:00:01 CET (20s ago)
446 Command Line: bash -c $'kill -SEGV $$'
447 Executable: /usr/bin/bash
448 Control Group: /user.slice/user-1000.slice/…
449 Unit: user@1000.service
450 User Unit: vte-spawn-….scope
451 Slice: user-1000.slice
452 Owner UID: 1000 (user)
453 Boot ID: …
454 Machine ID: …
455 Hostname: …
456 Storage: /var/lib/systemd/coredump/core.bash.1000.….zst (present)
457 Size on Disk: 51.7K
458 Message: Process 130414 (bash) of user 1000 dumped core.
459
460 Stack trace of thread 130414:
461 #0 0x00007f398142358b kill (libc.so.6 + 0x3d58b)
462 #1 0x0000558c2c7fda09 kill_builtin (bash + 0xb1a09)
463 #2 0x0000558c2c79dc59 execute_builtin.lto_priv.0 (bash + 0x51c59)
464 #3 0x0000558c2c79709c execute_simple_command (bash + 0x4b09c)
465 #4 0x0000558c2c798408 execute_command_internal (bash + 0x4c408)
466 #5 0x0000558c2c7f6bdc parse_and_execute (bash + 0xaabdc)
467 #6 0x0000558c2c85415c run_one_command.isra.0 (bash + 0x10815c)
468 #7 0x0000558c2c77d040 main (bash + 0x31040)
469 #8 0x00007f398140db75 __libc_start_main (libc.so.6 + 0x27b75)
470 #9 0x0000558c2c77dd1e _start (bash + 0x31d1e)
471 </programlisting>
472 </example>
473
474 <example>
475 <title>Extract the last core dump of /usr/bin/bar to a file named
476 <filename index="false">bar.coredump</filename></title>
477
478 <programlisting>$ coredumpctl -o bar.coredump dump /usr/bin/bar</programlisting>
479 </example>
480 </refsect1>
481
482 <refsect1>
483 <title>See Also</title>
484 <para>
485 <citerefentry><refentrytitle>systemd-coredump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
486 <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
487 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
488 <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>
489 </para>
490 </refsect1>
491
492 </refentry>