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