]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-coredump.xml
Merge pull request #9302 from keszybz/drop-my-copyright-and-some-license-tags
[thirdparty/systemd.git] / man / systemd-coredump.xml
CommitLineData
3802a3d3 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
5146e7e8 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5146e7e8
ZJS
4
5<!--
572eb058 6 SPDX-License-Identifier: LGPL-2.1+
5146e7e8
ZJS
7-->
8
9<refentry id="systemd-coredump" conditional='ENABLE_COREDUMP'
10 xmlns:xi="http://www.w3.org/2001/XInclude">
11
12 <refentryinfo>
13 <title>systemd-coredump</title>
14 <productname>systemd</productname>
15
16 <authorgroup>
17 <author>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
22 </author>
23 </authorgroup>
24 </refentryinfo>
25
26 <refmeta>
27 <refentrytitle>systemd-coredump</refentrytitle>
28 <manvolnum>8</manvolnum>
29 </refmeta>
30
31 <refnamediv>
32 <refname>systemd-coredump</refname>
6dfde7ac
ZJS
33 <refname>systemd-coredump.socket</refname>
34 <refname>systemd-coredump@.service</refname>
246ba4aa 35 <refpurpose>Acquire, save and process core dumps</refpurpose>
5146e7e8
ZJS
36 </refnamediv>
37
38 <refsynopsisdiv>
12b42c76 39 <para><filename>/usr/lib/systemd/systemd-coredump</filename></para>
f6940bc3 40 <para><filename>/usr/lib/systemd/systemd-coredump</filename> <option>--backtrace</option></para>
6dfde7ac
ZJS
41 <para><filename>systemd-coredump@.service</filename></para>
42 <para><filename>systemd-coredump.socket</filename></para>
5146e7e8
ZJS
43 </refsynopsisdiv>
44
45 <refsect1>
46 <title>Description</title>
f6940bc3
ZJS
47 <para><filename>systemd-coredump@.service</filename> is a system service that can acquire core
48 dumps from the kernel and handle them in various ways. The <command>systemd-coredump</command>
49 executable does the actual work. It is invoked twice: once as the handler by the kernel, and the
50 second time in the <filename>systemd-coredump@.service</filename> to actually write the data to
51 the journal.</para>
52
53 <para>When the kernel invokes <command>systemd-coredump</command> to handle a core dump, it runs
54 in privileged mode, and will connect to the socket created by the
55 <filename>systemd-coredump.socket</filename> unit, which in turn will spawn an unprivileged
56 <filename>systemd-coredump@.service</filename> instance to process the core dump. Hence
57 <filename>systemd-coredump.socket</filename> and <filename>systemd-coredump@.service</filename>
58 are helper units which do the actual processing of core dumps and are subject to normal service
59 management.</para>
5146e7e8 60
246ba4aa
PM
61 <para>Core dumps can be written to the journal or saved as a file. Once saved they can be retrieved
62 for further processing, for example in
63 <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
5146e7e8
ZJS
64 </para>
65
246ba4aa
PM
66 <para>By default, <command>systemd-coredump</command> will log the core dump including a backtrace
67 if possible to the journal and store the core dump itself in an external file in
68 <filename>/var/lib/systemd/coredump</filename>.</para>
5146e7e8 69
246ba4aa
PM
70 <para>The behavior of a specific program upon reception of a signal is governed by a few
71 factors which are described in detail in
72 <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
73 In particular, the core dump will only be processed when the related resource limits are sufficient.
f3962329 74 </para>
f6940bc3
ZJS
75
76 <para>It is also possible to invoke <command>systemd-coredump</command> with
77 <option>--backtrace</option> option. In this case, <command>systemd-coredump</command> expects
78 a journal entry in the journal
28a0ad81 79 <ulink url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal Export Format</ulink>
f6940bc3
ZJS
80 on standard input. The entry should contain a <varname>MESSAGE=</varname> field and any additional
81 metadata fields the caller deems reasonable. <command>systemd-coredump</command> will append
82 additional metadata fields in the same way it does for core dumps received from the kernel. In
83 this mode, no core dump is stored in the journal.</para>
246ba4aa 84 </refsect1>
7382a3cc 85
246ba4aa
PM
86 <refsect1>
87 <title>Configuration</title>
88 <para>For programs started by <command>systemd</command> process resource limits can be set by directive
89 <varname>LimitCore=</varname>, see
90 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
91 </para>
92
f6940bc3
ZJS
93 <para>In order to be used by the kernel to handle core dumps,
94 <command>systemd-coredump</command> must be configured in
246ba4aa
PM
95 <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
96 parameter <varname>kernel.core_pattern</varname>. The syntax of this parameter is explained in
97 <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
f95b0be7 98 systemd installs the file <filename>/usr/lib/sysctl.d/50-coredump.conf</filename> which configures
246ba4aa
PM
99 <varname>kernel.core_pattern</varname> accordingly. This file may be masked or overridden to use a different
100 setting following normal
101 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
f6940bc3
ZJS
102 rules. If the sysctl configuration is modified, it must be updated in the kernel before it
103 takes effect, see
246ba4aa 104 <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>
7382a3cc 105 and
246ba4aa 106 <citerefentry><refentrytitle>systemd-sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
7382a3cc 107 </para>
246ba4aa 108
f6940bc3
ZJS
109 <para>In order to by used in the <option>--backtrace</option> mode, an appropriate backtrace
110 handler must be installed on the sender side. For example, in case of
98e9d710 111 <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry>, this
f6940bc3
ZJS
112 means a <varname>sys.excepthook</varname> must installed, see
113 <ulink url="https://github.com/keszybz/systemd-coredump-python">systemd-coredump-python</ulink>.
114 </para>
115
2dd67817 116 <para>The behavior of <command>systemd-coredump</command> itself is configured through the configuration file
246ba4aa
PM
117 <filename>/etc/systemd/coredump.conf</filename> and corresponding snippets
118 <filename>/etc/systemd/coredump.conf.d/*.conf</filename>, see
119 <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. A new
120 instance of <command>systemd-coredump</command> is invoked upon receiving every core dump. Therefore, changes
121 in these files will take effect the next time a core dump is received.</para>
122
123 <para>Resources used by core dump files are restricted in two ways. Parameters like maximum size of acquired
124 core dumps and files can be set in files <filename>/etc/systemd/coredump.conf</filename> and snippets mentioned
125 above. In addition the storage time of core dump files is restricted by <command>systemd-tmpfiles</command>,
126 corresponding settings are by default in <filename>/usr/lib/tmpfiles.d/systemd.conf</filename>.</para>
c8e053fb
ZJS
127
128 <refsect2>
129 <title>Disabling coredump processing</title>
130
131 <para>To disable potentially resource-intensive processing by <command>systemd-coredump</command>,
132 set <programlisting>Storage=none
133ProcessSizeMax=0</programlisting> in
134 <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
135 </para>
136 </refsect2>
246ba4aa
PM
137 </refsect1>
138
139 <refsect1>
140 <title>Usage</title>
141 <para>Data stored in the journal can be viewed with
142 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
143 as usual.
144 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
145 can be used to retrieve saved core dumps independent of their location, to display information and to process
146 them e.g. by passing to the GNU debugger (gdb).</para>
5146e7e8
ZJS
147 </refsect1>
148
149 <refsect1>
150 <title>See Also</title>
151 <para>
152 <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
154 <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
246ba4aa 155 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
5146e7e8
ZJS
156 <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
157 <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
158 <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
159 </para>
160 </refsect1>
161</refentry>