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