]>
Commit | Line | Data |
---|---|---|
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 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2014 Zbigniew Jędrzejewski-Szmek | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | --> | |
23 | ||
24 | <refentry id="systemd-coredump" conditional='ENABLE_COREDUMP' | |
25 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
26 | ||
27 | <refentryinfo> | |
28 | <title>systemd-coredump</title> | |
29 | <productname>systemd</productname> | |
30 | ||
31 | <authorgroup> | |
32 | <author> | |
33 | <contrib>Developer</contrib> | |
34 | <firstname>Lennart</firstname> | |
35 | <surname>Poettering</surname> | |
36 | <email>lennart@poettering.net</email> | |
37 | </author> | |
38 | </authorgroup> | |
39 | </refentryinfo> | |
40 | ||
41 | <refmeta> | |
42 | <refentrytitle>systemd-coredump</refentrytitle> | |
43 | <manvolnum>8</manvolnum> | |
44 | </refmeta> | |
45 | ||
46 | <refnamediv> | |
47 | <refname>systemd-coredump</refname> | |
6dfde7ac ZJS |
48 | <refname>systemd-coredump.socket</refname> |
49 | <refname>systemd-coredump@.service</refname> | |
246ba4aa | 50 | <refpurpose>Acquire, save and process core dumps</refpurpose> |
5146e7e8 ZJS |
51 | </refnamediv> |
52 | ||
53 | <refsynopsisdiv> | |
12b42c76 | 54 | <para><filename>/usr/lib/systemd/systemd-coredump</filename></para> |
f6940bc3 | 55 | <para><filename>/usr/lib/systemd/systemd-coredump</filename> <option>--backtrace</option></para> |
6dfde7ac ZJS |
56 | <para><filename>systemd-coredump@.service</filename></para> |
57 | <para><filename>systemd-coredump.socket</filename></para> | |
5146e7e8 ZJS |
58 | </refsynopsisdiv> |
59 | ||
60 | <refsect1> | |
61 | <title>Description</title> | |
f6940bc3 ZJS |
62 | <para><filename>systemd-coredump@.service</filename> is a system service that can acquire core |
63 | dumps from the kernel and handle them in various ways. The <command>systemd-coredump</command> | |
64 | executable does the actual work. It is invoked twice: once as the handler by the kernel, and the | |
65 | second time in the <filename>systemd-coredump@.service</filename> to actually write the data to | |
66 | the journal.</para> | |
67 | ||
68 | <para>When the kernel invokes <command>systemd-coredump</command> to handle a core dump, it runs | |
69 | in privileged mode, and will connect to the socket created by the | |
70 | <filename>systemd-coredump.socket</filename> unit, which in turn will spawn an unprivileged | |
71 | <filename>systemd-coredump@.service</filename> instance to process the core dump. Hence | |
72 | <filename>systemd-coredump.socket</filename> and <filename>systemd-coredump@.service</filename> | |
73 | are helper units which do the actual processing of core dumps and are subject to normal service | |
74 | management.</para> | |
5146e7e8 | 75 | |
246ba4aa PM |
76 | <para>Core dumps can be written to the journal or saved as a file. Once saved they can be retrieved |
77 | for further processing, for example in | |
78 | <citerefentry project='man-pages'><refentrytitle>gdb</refentrytitle><manvolnum>1</manvolnum></citerefentry>. | |
5146e7e8 ZJS |
79 | </para> |
80 | ||
246ba4aa PM |
81 | <para>By default, <command>systemd-coredump</command> will log the core dump including a backtrace |
82 | if possible to the journal and store the core dump itself in an external file in | |
83 | <filename>/var/lib/systemd/coredump</filename>.</para> | |
5146e7e8 | 84 | |
246ba4aa PM |
85 | <para>The behavior of a specific program upon reception of a signal is governed by a few |
86 | factors which are described in detail in | |
87 | <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
88 | In particular, the core dump will only be processed when the related resource limits are sufficient. | |
f3962329 | 89 | </para> |
f6940bc3 ZJS |
90 | |
91 | <para>It is also possible to invoke <command>systemd-coredump</command> with | |
92 | <option>--backtrace</option> option. In this case, <command>systemd-coredump</command> expects | |
93 | a journal entry in the journal | |
28a0ad81 | 94 | <ulink url="https://www.freedesktop.org/wiki/Software/systemd/export">Journal Export Format</ulink> |
f6940bc3 ZJS |
95 | on standard input. The entry should contain a <varname>MESSAGE=</varname> field and any additional |
96 | metadata fields the caller deems reasonable. <command>systemd-coredump</command> will append | |
97 | additional metadata fields in the same way it does for core dumps received from the kernel. In | |
98 | this mode, no core dump is stored in the journal.</para> | |
246ba4aa | 99 | </refsect1> |
7382a3cc | 100 | |
246ba4aa PM |
101 | <refsect1> |
102 | <title>Configuration</title> | |
103 | <para>For programs started by <command>systemd</command> process resource limits can be set by directive | |
104 | <varname>LimitCore=</varname>, see | |
105 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
106 | </para> | |
107 | ||
f6940bc3 ZJS |
108 | <para>In order to be used by the kernel to handle core dumps, |
109 | <command>systemd-coredump</command> must be configured in | |
246ba4aa PM |
110 | <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
111 | parameter <varname>kernel.core_pattern</varname>. The syntax of this parameter is explained in | |
112 | <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
113 | Systemd installs the file <filename>/usr/lib/sysctl.d/50-coredump.conf</filename> which configures | |
114 | <varname>kernel.core_pattern</varname> accordingly. This file may be masked or overridden to use a different | |
115 | setting following normal | |
116 | <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
f6940bc3 ZJS |
117 | rules. If the sysctl configuration is modified, it must be updated in the kernel before it |
118 | takes effect, see | |
246ba4aa | 119 | <citerefentry project='man-pages'><refentrytitle>sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
7382a3cc | 120 | and |
246ba4aa | 121 | <citerefentry><refentrytitle>systemd-sysctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>. |
7382a3cc | 122 | </para> |
246ba4aa | 123 | |
f6940bc3 ZJS |
124 | <para>In order to by used in the <option>--backtrace</option> mode, an appropriate backtrace |
125 | handler must be installed on the sender side. For example, in case of | |
98e9d710 | 126 | <citerefentry project='die-net'><refentrytitle>python</refentrytitle><manvolnum>1</manvolnum></citerefentry>, this |
f6940bc3 ZJS |
127 | means a <varname>sys.excepthook</varname> must installed, see |
128 | <ulink url="https://github.com/keszybz/systemd-coredump-python">systemd-coredump-python</ulink>. | |
129 | </para> | |
130 | ||
2dd67817 | 131 | <para>The behavior of <command>systemd-coredump</command> itself is configured through the configuration file |
246ba4aa PM |
132 | <filename>/etc/systemd/coredump.conf</filename> and corresponding snippets |
133 | <filename>/etc/systemd/coredump.conf.d/*.conf</filename>, see | |
134 | <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. A new | |
135 | instance of <command>systemd-coredump</command> is invoked upon receiving every core dump. Therefore, changes | |
136 | in these files will take effect the next time a core dump is received.</para> | |
137 | ||
138 | <para>Resources used by core dump files are restricted in two ways. Parameters like maximum size of acquired | |
139 | core dumps and files can be set in files <filename>/etc/systemd/coredump.conf</filename> and snippets mentioned | |
140 | above. In addition the storage time of core dump files is restricted by <command>systemd-tmpfiles</command>, | |
141 | corresponding settings are by default in <filename>/usr/lib/tmpfiles.d/systemd.conf</filename>.</para> | |
142 | </refsect1> | |
143 | ||
144 | <refsect1> | |
145 | <title>Usage</title> | |
146 | <para>Data stored in the journal can be viewed with | |
147 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
148 | as usual. | |
149 | <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
150 | can be used to retrieve saved core dumps independent of their location, to display information and to process | |
151 | them e.g. by passing to the GNU debugger (gdb).</para> | |
5146e7e8 ZJS |
152 | </refsect1> |
153 | ||
154 | <refsect1> | |
155 | <title>See Also</title> | |
156 | <para> | |
157 | <citerefentry><refentrytitle>coredump.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
158 | <citerefentry><refentrytitle>coredumpctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
159 | <citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
246ba4aa | 160 | <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
5146e7e8 ZJS |
161 | <citerefentry project='man-pages'><refentrytitle>core</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
162 | <citerefentry><refentrytitle>sysctl.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
163 | <citerefentry><refentrytitle>systemd-sysctl.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
164 | </para> | |
165 | </refsect1> | |
166 | </refentry> |