You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<metaname="title"its:translate="yes">Managing Core Dumps with systemd-coredump</meta>
97
+
<metaname="social-descr"its:translate="yes">Configure systemd-coredump and analyze crash data</meta>
98
+
99
+
<!-- Search -->
100
+
<metaname="description"its:translate="yes">Learn how to configure systemd-coredump, collect and analyze core dumps, and manage crash data and storage</meta>
101
+
102
+
<abstract>
103
+
<variablelist>
104
+
<varlistentry>
105
+
<term>WHAT?</term>
106
+
<listitem>
107
+
<para>
108
+
From collecting and displaying core dumps, over providing stack traces for quick analysis to managing storage and retention, systemd-coredump enables you to investigate application crashes in a convenient way.
109
+
</para>
110
+
</listitem>
111
+
</varlistentry>
112
+
<varlistentry>
113
+
<term>WHY?</term>
114
+
<listitem>
115
+
<para>
116
+
This article provides a complete overview of the tasks that can be performed with systemd-coredump, such as collecting and displaying core dumps, providing backtraces for quick analysis, and managing the storage of crash data.</para></listitem>
117
+
</varlistentry>
118
+
<varlistentry>
119
+
<term>EFFORT</term>
120
+
<listitem>
121
+
<para>
122
+
The average reading time of this article is approximately 40 minutes.
123
+
</para>
124
+
</listitem>
125
+
</varlistentry>
126
+
<varlistentry>
127
+
<term>GOAL</term>
128
+
<listitem>
129
+
<para>
130
+
You will be able to analyze and manage application crashes using systemd-coredump.
131
+
</para>
132
+
</listitem>
133
+
</varlistentry>
134
+
<varlistentry>
135
+
<term>REQUIREMENTS</term>
136
+
<listitem>
137
+
<itemizedlist>
138
+
<listitem>
139
+
<para>
140
+
Basic understanding of Linux commands
141
+
</para>
142
+
</listitem>
143
+
<listitem>
144
+
<para>
145
+
Basic understanding of Linux processes
146
+
</para>
147
+
</listitem>
148
+
</itemizedlist>
149
+
</listitem>
150
+
</varlistentry>
151
+
</variablelist>
152
+
</abstract>
153
+
</merge>
154
+
<!-- pull in all the topic files you need -->
155
+
<!-- pick the appropriate type of include to match your needs -->
systemd-coredump collects and displays core dumps to analyze application crashes. A core dump is an image of the process memory at the time of termination.
<para>By default, when a process crashes, <literal>systemd-coredump</literal> performs the following actions:</para>
33
+
<itemizedlist>
34
+
<listitem><para>Stores the core dump in <filename>/var/lib/systemd/coredump/</filename>.</para></listitem>
35
+
<listitem><para>Logs the event to the systemd journal.</para></listitem>
36
+
<listitem><para>Includes a backtrace where possible.</para></listitem>
37
+
</itemizedlist>
38
+
<para>You can examine the dump file using <command>coredumpctl</command> or external tools such as <command>gdb</command> or <command>crash</command>. </para>
39
+
<note>
40
+
<para>Core dumps stored in <filename>/var/lib/systemd/coredump/</filename> are by default automatically deleted after three days. This is configured through the <literal>d /var/lib/systemd/coredump</literal>
41
+
line in <filename>/usr/lib/tmpfiles.d/systemd.conf</filename>. </para>
42
+
43
+
<para>It is recommended not to edit <filename>/usr/lib/tmpfiles.d/systemd.conf</filename> directly, as the changes will be overwritten during the next system update. Hence, perform the following:</para>
44
+
<procedure>
45
+
<step><para>Copy the file to <filename>/etc/tmpfiles.d/systemd.conf</filename>. As files in <filename>/etc/</filename> take precedence over those in <filename>/usr/lib/</filename>, your custom configuration is applied.</para></step>
46
+
<step><para>Open the file and find the line: <literal>d /var/lib/systemd/coredump</literal></para></step>
47
+
<step><para>Edit the age parameter; for example, change <literal>3d</literal> to <literal>7d</literal> to retain data for a week, or use the <literal>W</literal> notation for longer periods.</para></step>
<para><literal>systemd-coredump</literal> provides a centralized, automated framework for capturing and managing process crashes by intercepting kernel signals to store compressed memory images and metadata, which are then easily analyzed through the <literal>coredumpctl</literal> utility.</para>
19
+
</abstract>
20
+
</info>
21
+
<para><literal>systemd-coredump</literal> is enabled by default. The primary configuration file is located at <filename>/etc/systemd/coredump.conf</filename>.</para>
22
+
<screen>[Coredump]
23
+
#Storage=external
24
+
#Compress=yes
25
+
#ProcessSizeMax=2G
26
+
#ExternalSizeMax=2G
27
+
#JournalSizeMax=767M
28
+
#MaxUse=
29
+
#KeepFree=</screen>
30
+
<para>The following parameters in <filename>[Coredump]</filename> define how dumps are handled:</para>
31
+
<variablelist><varlistentry>
32
+
<term><literal>Storage</literal></term>
33
+
<listitem><para>Defines where to store dumps such as <literal>none</literal>, <literal>external</literal>, <literal>journal</literal>. The default is <literal>external</literal>.</para>
34
+
<para>For example:</para>
35
+
<screen>[Coredump]
36
+
# Directs dumps to be stored inside the system journal
37
+
Storage=journal
38
+
39
+
# Compress the data to save space within the journal
40
+
Compress=yes
41
+
42
+
# Limits the size of a single core dump stored in the journal to 500MB
43
+
# If a process dump is larger than 500M, it will be dropped/ignored
44
+
JournalSizeMax=500M
45
+
46
+
# Processes larger than 1GB will not be handled at all
<listitem><para>The maximum size for a dump stored on disk. The default size is <literal>2G</literal>, and this also supports a value of infinity.</para></listitem></varlistentry>
57
+
<varlistentry>
58
+
<term><literal>JournalSizeMax</literal></term>
59
+
<listitem><para>The maximum size of core dumps that can be stored directly within the system journal (when Storage=journal is used). If a core dump exceeds this value, it will be ignored or handled according to other storage settings.</para></listitem></varlistentry>
60
+
<varlistentry>
61
+
<term><literal>MaxUse</literal></term>
62
+
<listitem><para>The maximum amount of disk space the core dump storage (typically <filename>/var/lib/systemd/coredump/</filename>) is allowed to occupy. This value supports absolute sizes in bytes (e.g., <literal>2G</literal>) or a percentage of the total filesystem size (e.g., <literal>10%</literal>). Once this limit is reached, older core dumps are automatically deleted to make room for new ones.</para>
63
+
<para>The size units are <literal>B</literal>, <literal>K</literal>, <literal>M</literal>, <literal>G</literal>, <literal>T</literal>, <literal>P</literal>, and <literal>E</literal>.</para>
64
+
</listitem></varlistentry>
65
+
<varlistentry>
66
+
<term><literal>KeepFree</literal></term>
67
+
<listitem><para>The minimum amount of free disk space to maintain on the filesystem where core dumps are stored. This value can be specified in bytes (using suffixes such as K, M, G) or as a percentage of the total filesystem size (e.g., <literal>15%</literal>). <literal>systemd-coredump</literal> will stop saving new dumps if the available disk space would fall below this threshold.</para>
68
+
<para>The size units are <literal>B</literal>, <literal>K</literal>, <literal>M</literal>, <literal>G</literal>, <literal>T</literal>, <literal>P</literal>, and <literal>E</literal>.</para>
69
+
</listitem></varlistentry>
70
+
</variablelist>
71
+
72
+
<note><para>A new instance of <literal>systemd-coredump</literal> is invoked for every crash. Configuration changes are applied immediately to the next crash; you do not need to restart any services.</para></note>
<para>To minimize the storage of sensitive information or prevent disk exhaustion in <filename>/var/lib/systemd/coredump</filename>, you can modify the <filename>Storage=</filename> option in <filename>/etc/systemd/coredump.conf</filename>.</para>
75
+
<note><para>If the <filename>Storage=</filename> field is omitted, set to an empty value, or set to an invalid string, systemd defaults to <literal>external</literal>.</para></note>
76
+
<para>The available storage options are:</para>
77
+
<itemizedlist>
78
+
<listitem><para><literal>Storage=none</literal> the event is logged to the journal, but the memory image (the core dump itself) is discarded and files are not created in <filename>/var/lib/systemd/coredump</filename>.</para></listitem>
79
+
<listitem><para><literal>Storage=journal</literal> The core dump is compressed and stored directly within the systemd journal metadata and files are not created in <filename>/var/lib/systemd/coredump</filename>. The storage is managed by <filename>/etc/systemd/journald.conf</filename> limits.</para></listitem>
80
+
<listitem><para><literal>Storage=external</literal> The event is logged to the journal, and the memory image is saved as a separate file. The files are created in <filename>/var/lib/systemd/coredump</filename>.</para></listitem>
81
+
</itemizedlist>
82
+
<para>As core dumps may not be preserved after a system restart (for example, if stored in volatile journal memory or a temporary directory), run the command below to save a core dump to a permanent file for later analysis:</para>
<para>For more information, see <code>man systemd-coredump, man coredumpctl, man core, and man coredump.conf</code> for complete command and option listing.</para>
0 commit comments