SYSTEMD-COREDUMP(8)
๐ธ NAME ๐ธ
okay bestie, meet systemd-coredump โ also known as systemd-coredump.socket, systemd-coredump@.service, systemd-coredump-register.service, and systemd-coredumpd.service. this whole little fam is the systemd-coredump(8) manual page, and their whole thing is: Acquire, save and process core dumps. that's it. that's the job. ๐
โจ SYNOPSIS โจ
/usr/lib/systemd/systemd-coredump
/usr/lib/systemd/systemd-coredump --backtrace
/usr/lib/systemd/systemd-coredump --manager
/usr/lib/systemd/systemd-coredump --check-requirements
systemd-coredump.socket
systemd-coredump@.service
systemd-coredump-register.service
systemd-coredumpd.service
๐ฆ DESCRIPTION ๐ฆ
so systemd-coredump@.service is a system service that processes core dumps, periodt. it logs a little summary of the whole event to systemd-journald.service(8) โ and that summary includes the process identifier, who owned it, the signal that killed the process, and the stack trace if possible. it might also save the core dump itself so you can deal with it later. (peep the "Information about the crashed process" section further down ๐)
what actually happens to a program when it catches a signal? that's governed by a whole handful of factors, and they're laid out in detail in core(5). important one though: the core dump only gets processed when the related process resource limits (RLIMIT_CORE) are sufficient. no limits, no dump, iykyk.
core dumps can go to the journal or get saved as a file. either way you can pull them back out for further processing, like in gdb(1). check coredumpctl(1) โ especially the list and debug verbs. those are the moment fr.
by default, systemd-coredump logs the core dump to the journal (backtrace included if it can manage it ๐ค) and stores the core dump โ which is literally an image of the process's memory contents โ in an external file under /var/lib/systemd/coredump/. those core dumps get deleted after a few days by default; the deets live in /usr/lib/tmpfiles.d/systemd.conf.
โ ๏ธ real talk: removing core files from the filesystem and purging journal entries are independent operations. so a core file can absolutely be sitting there with no journal entry, and journal entries can point at core files that got yeeted long ago. don't come for me, that's just how it is.
some metadata gets attached to core files as extended attributes, so even without the full metadata from the journal entry, the core files are still useful for some purposes. lowkey iconic of them ๐ซถ
for further details see systemd Coredump Handling[1].
๐ Overview ๐
the systemd-coredump executable does the actual work โ but how it gets invoked depends on what the running kernel is capable of. main character energy with a plot twist. โจ
when the kernel supports the kernel coredump socket protocol (see "Kernel Requirements" below โ generally kernel v6.19 or newer), systemd-coredumpd.service creates and listens on a Unix socket, and systemd-coredump-register.service writes the socket path into /proc/sys/kernel/core_pattern. when a process crashes, the kernel connects to the socket and sends the core dump of that process through the socket. then systemd-coredumpd.service transfers the core to the corresponding container if the crashed process is in a container environment โ otherwise it saves the core in local storage and writes info about the crashed process to the journal.
when the running kernel doesn't meet those requirements, the executable systemd-coredump gets invoked twice: once as the handler by the kernel, and the second time inside systemd-coredump@.service to actually write the data to the journal and process and save the core file. two invocations, one job. slay.
when the kernel invokes systemd-coredump to handle a core dump this way, it runs in privileged mode, and it connects to the socket created by the systemd-coredump.socket unit โ which in turn spawns an unprivileged systemd-coredump@.service instance to process the core dump. so systemd-coredump.socket and systemd-coredump@.service are helper units doing the actual processing, and they're subject to normal service management. very demure, very mindful.
see "Units" below for the details on each individual unit involved in either mode. ๐
๐ Command-line Options ๐
ngl, systemd-coredump is normally not invoked directly by you. it's invoked by the kernel, or by the units described below. it supports these modes of invocation:
- (no option) โ handles a single core dump. this is the mode the kernel uses to invoke
systemd-coredumpdirectly (viakernel.core_pattern) on kernels that do not support the kernel coredump socket protocol, and it's also the modesystemd-coredump@.serviceuses to actually process and save a core dump that got handed to it viasystemd-coredump.socket. --backtraceโsystemd-coredumpexpects a journal entry in the Journal Export Format[2] on standard input. that entry should contain aMESSAGE=field plus any additional metadata fields the caller thinks are reasonable.systemd-coredumpwill append extra metadata fields in the same way it does for core dumps received from the kernel. in this mode, no core dump is stored in the journal. ๐ซ--managerโ runssystemd-coredumpas the long-running manager process that listens on the kernel coredump socket, accepts connections from the kernel, and forks off worker processes to process each individual core dump. this is the mode used internally bysystemd-coredumpd.serviceand it is not intended to be invoked interactively. see "Units" below for details.
Added in version 262.
--check-requirementsโ checks whether the running kernel and execution environment fulfil the requirements for the kernel coredump socket protocol (see "Kernel Requirements" below), and exits with a non-zero status if they are not met. this is used internally as theExecCondition=ofsystemd-coredumpd.serviceandsystemd-coredump-register.service, so those units get skipped โ without being marked as failed โ on systems where the feature isn't available. also not intended to be invoked interactively, bestie.
Added in version 262.
๐ธ Kernel Requirements for the Coredump Socket ๐ธ
the kernel coredump socket protocol โ the one systemd-coredumpd.service and systemd-coredump-register.service use โ requires:
- a kernel that supports the
PIDFD_INFO_COREDUMP(since kernel v6.16) andPIDFD_INFO_COREDUMP_SIGNAL(since kernel v6.19) flags for thePIDFD_GET_INFOioctl(2)operation on a PID file descriptor (seepidfd_open(2)). support for these flags is used as an indicator that the kernel is also new enough to support the request-mode (@@-prefixed) kernel coredump socketkernel.core_pattern, which was introduced in kernel v6.17. ๐ง systemd-coredumpmust be running in the initial PID, USER, and TIME namespaces โ i.e. on the host, not inside a container.
these conditions get checked with systemd-coredump --check-requirements before systemd-coredumpd.service and systemd-coredump-register.service are started. if the requirements aren't met, systemd-coredump instead falls back to the legacy invocation via systemd-coredump.socket and systemd-coredump@.service. plan B, but make it seamless. ๐
๐ Units ๐
here's the cast of units involved in processing core dumps. which of them are active depends on whether the kernel coredump socket protocol is available โ see "Kernel Requirements" above.
systemd-coredumpd.serviceโ a long-running manager service, started early at boot on kernels that support the kernel coredump socket protocol. it creates and listens on theAF_UNIXsocket/run/systemd/coredumpd/kernel(this path is also passed to the kernel viakernel.core_patternbysystemd-coredump-register.service, see below). when the kernel connects to this socket to submit a core dump,systemd-coredumpd.serviceaccepts the connection and forks off a worker process to receive and process that specific core dump, up to a limit of 8 concurrently running workers (once this limit is reached, no further connections are accepted until a worker finishes). workers that run for longer than 5 minutes are killed automatically. ๐
the configuration in coredump.conf(5) is read once when systemd-coredumpd.service starts. since the service keeps running afterwards (rather than being invoked anew for every core dump, the way systemd-coredump@.service is), changes to coredump.conf and its drop-ins are not picked up automatically. reload the service to apply configuration changes โ see coredump.conf(5) for details.
Added in version 262.
systemd-coredump-register.serviceโ a oneshot unit, automatically pulled in and bound to the lifetime ofsystemd-coredumpd.service(it is not meant to be started or stopped manually, so hands off ๐ซณ). oncesystemd-coredumpd.serviceis up, this unit points the kernel at it by settingkernel.core_patternto the request-mode (@@-prefixed) socket path/run/systemd/coredumpd/kernel, and persists this setting to/run/sysctl.d/60-coredump.confviasystemd-sysctl(8). whensystemd-coredumpd.serviceis stopped,systemd-coredump-register.serviceis stopped along with it and revertskernel.core_patternto its previous value. clean exit, we love to see it. โจ
because /run/sysctl.d/60-coredump.conf takes precedence โ per the usual sysctl.d(5) ordering rules โ over the /usr/lib/sysctl.d/50-coredump.conf file described in "Configuration" below, masking or overriding 50-coredump.conf alone is not sufficient to install a custom kernel.core_pattern on a system where systemd-coredumpd.service is active. see "Configuration" below for how to prevent this. ๐
Added in version 262.
systemd-coredump.socket,systemd-coredump@.serviceโ the legacy handler units, used on kernels that do not support the kernel coredump socket protocol (see "Kernel Requirements" above). the kernel invokessystemd-coredumpdirectly and in privileged mode for each crash; that instance connects tosystemd-coredump.socket, which in turn spawns an unprivilegedsystemd-coredump@.serviceinstance to actually process and save the core dump. unlikesystemd-coredumpd.service, a freshsystemd-coredump@.serviceinstance is started for every core dump, so it always reads the currentcoredump.confconfiguration. fresh start, fresh config, no notes. ๐
๐ Core dumps in Containers/Namespaces ๐
the systemd-coredump@.service service will automatically attempt to extract a stacktrace from a process as it crashes. for this stacktrace, symbols will be resolved based on debug information embedded in the crashing ELF image, or equivalent debug information separately available on the host OS. for processes that crash inside of local containers or other mount namespace-based sandboxes, this auxiliary debug information is typically not available on the host โ simply because containers typically run different software versions than the host. ๐ญ
systemd-coredump provides two mechanisms to address this:
- So for full-OS containers running systemd inside, bestie, you really wanna turn on
CoredumpReceive=on the unit (peepsystemd.resource-control(5)for the deets ๐). That way the coredumps of a container get forwarded over tosystemd-coredump@.servicerunning inside the container, i.e. the container gets to process and store its own core dumps, like the independent little icon it is. Fun fact:systemd-nspawn(1)defaults to this mode when you invoke it with the--bootswitch โจ. And ngl this mode is generally recommended for security reasons โ the whole security-sensitive processing of the core dump happens within the confinements of the container itself, by the container's own code, backed by the container's own storage. Very demure, very mindful. ๐ - Okay but alternatively ๐ โ for more restricted containers that don't run a proper init system as PID 1, you can enable processing of the core dump on the host, with access to the debug information data from the container itself. This mode has to be switched on via
EnterNamespace=incoredump.conf(5), and it defaults to off, for security reasons. (Yes, off. Respect the boundaries. ๐)
If both CoredumpReceive= is enabled on the unit of the container the core dump belongs to, and EnterNamespace= is enabled in the coredump.conf configuration file โ the former takes precedence. First one wins, periodt. ๐
โ๏ธ CONFIGURATION โ๏ธ
For programs started by systemd, process resource limits can be set by the LimitCORE= directive โ go look at systemd.exec(5), it's all there bestie ๐.
In order for the kernel to actually use it to handle core dumps, systemd-coredump must be configured in the sysctl(8) parameter kernel.core_pattern. The syntax of this parameter is explained over in core(5). systemd installs the file /usr/lib/sysctl.d/50-coredump.conf which configures kernel.core_pattern accordingly โจ. This file may be masked or overridden to use a different setting following normal sysctl.d(5) rules. And listen โ if the sysctl configuration gets modified, it must be updated in the kernel before it takes effect, see sysctl(8) and systemd-sysctl(8). No skipping that step, okay? ๐
On systems where systemd-coredumpd.service is active (check out "Kernel Requirements" and "Units" above ๐), systemd-coredump-register.service writes its own kernel.core_pattern setting to /run/sysctl.d/60-coredump.conf whenever systemd-coredumpd.service is running, and this file takes precedence over /usr/lib/sysctl.d/50-coredump.conf. So as a result โ and this is the plot twist ๐ โ masking or overriding 50-coredump.conf alone does not override the default kernel.core_pattern on such systems, because 60-coredump.conf will still take effect. Rude, honestly. To set a custom kernel.core_pattern of your own on a system where systemd-coredumpd.service is active, stop and disable it:
systemctl disable --now systemd-coredumpd.service
In order to be used in the --backtrace mode, an appropriate backtrace handler must be installed on the sender side. For example, in case of python(1), this means a sys.excepthook must be installed โ see systemd-coredump-python[3]. ๐
The behavior of systemd-coredump itself is configured through the configuration file /etc/systemd/coredump.conf and the corresponding snippets /etc/systemd/coredump.conf.d/*.conf โ see coredump.conf(5) ๐ธ. When core dumps are processed via systemd-coredump@.service (see "Units" above), a new instance of systemd-coredump is invoked upon receiving every core dump, and changes in these files will take effect the next time a core dump is received. But when core dumps are instead processed by the long-running systemd-coredumpd.service, configuration changes require an explicit reload of that service to take effect โ see coredump.conf(5) for details. Different vibe, different reload rules, iykyk ๐ฅ.
Resources used by core dump files are restricted in two ways:
- Parameters like maximum size of acquired core dumps and files can be set in the files
/etc/systemd/coredump.confand the snippets mentioned above. - In addition, the storage time of core dump files is restricted by
systemd-tmpfiles, with corresponding settings by default in/usr/lib/tmpfiles.d/systemd.conf. The default is to delete core dumps after a few days โ see the above file for details. ๐๏ธ
๐ซ Disabling coredump processing ๐ซ
To disable potentially resource-intensive processing by systemd-coredump, set:
Storage=none
ProcessSizeMax=0
over in coredump.conf(5). There you go, bestie โ quiet quitting the coredump processing, but like, the responsible way ๐.
๐ฉท INFORMATION ABOUT THE CRASHED PROCESS ๐ฉท
okay bestie, this is the part where we actually read the receipts ๐. You can pull saved core dumps back out with coredumpctl(1) โ doesn't matter where they're chilling โ and use it to show info or hand them off to stuff like the GNU debugger (gdb). Obsessed.
And the data living in the journal? Also readable with journalctl(1) like always (or from literally any other process via the sd-journal(3) API โจ). The messages you want have MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1:
$ journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose
...
MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1
COREDUMP_PID=552351
COREDUMP_UID=1000
COREDUMP_GID=1000
COREDUMP_SIGNAL_NAME=SIGSEGV
COREDUMP_SIGNAL=11
COREDUMP_CODE=2
COREDUMP_TIMESTAMP=1614342930000000
COREDUMP_COMM=Web Content
COREDUMP_EXE=/usr/lib64/firefox/firefox
COREDUMP_USER_UNIT=app-gnome-firefox-552136.scope
COREDUMP_CMDLINE=/usr/lib64/firefox/firefox -contentproc -childID 5 -isForBrowser ...
COREDUMP_CGROUP=/user.slice/user-1000.slice/user@1000.service/app.slice/app-....scope
COREDUMP_FILENAME=/var/lib/systemd/coredump/core.Web....552351.....zst
...
So these are the fields that get saved (when we know them, anyway) with the journal entry ๐
COREDUMP_UID=,COREDUMP_PID=,COREDUMP_GID=โ the process number (PID), the owner user number (UID) and the group number (GID) of the process that crashed. And here's the tea: if the crashed process was part of a container (or just in a process or user namespace in general), these are the values as seen from outside, in the namespace wheresystemd-coredumpitself is running. ๐
Added in version 248.
COREDUMP_BY_PIDFD=โ if the crashed process got analyzed using a PIDFD handed over by the kernel (needs kernel v6.16), this field shows up and is set to"1". If it's not there, then the process was analyzed via a PID, which โ no cap โ is known to be subject to race conditions. ๐ฌ
Added in version 258.
COREDUMP_TIMESTAMP=โ the moment of the crash as reported by the kernel, in ฮผs since the epoch. โฐ
Added in version 248.
COREDUMP_RLIMIT=โ the core file size soft resource limit, seegetrlimit(2).
Added in version 248.
COREDUMP_UNIT=,COREDUMP_SLICE=โ the system unit and slice names. And when the crashed process was in a container, these are the unit names from outside, in the main system manager. ๐ซถ
Added in version 248.
COREDUMP_CGROUP=โ the primary cgroup of the crashed process's unit. When the crashed process was in a container, this is the full path as seen from outside the container.
Added in version 248.
COREDUMP_PROC_CGROUP=โ control group info in the same format/proc/self/cgroupuses. On systems with the unified cgroup hierarchy that's a single path prefixed with"0::", and on legacy systems it's multiple paths prefixed with controller numbers. When the crashed process was in a container, this is the full path as seen from outside the container.
Added in version 248.
COREDUMP_OWNER_UID=,COREDUMP_USER_UNIT=,COREDUMP_SESSION=โ the numerical UID of the user who owns the login session or systemd user unit of the crashed process, plus the user manager unit and the session identifier. All three of these fields only exist for user processes, btw. When the crashed process was in a container, those are the values outside, in the main system.
Added in version 248.
COREDUMP_SIGNAL_NAME=,COREDUMP_SIGNAL=โ the terminating signal name (with the"SIG"prefix [4]) and its numerical value. Both are included because signal numbers vary by architecture โ iconic detail honestly. โจ
Added in version 248.
COREDUMP_CODE=โ why the signal was sent, as a numerical value. That code is defined as the fieldsi_codein thesiginfo_tstructure and documented insigaction(2).
Added in version 261.
COREDUMP_CWD=,COREDUMP_ROOT=โ the current working directory and the root directory of the crashed process. When the crashed process is in a container, those paths are relative to the root of the container's mount namespace. ๐
Added in version 248.
COREDUMP_DUMPABLE=โ thePR_GET_DUMPABLEfield as reported by the kernel, seeprctl(2).
Added in version 258.
COREDUMP_OPEN_FDS=โ info about open file descriptors, in this exact format:
fd:/path/to/file
pos: ...
flags: ...
...
fd:/path/to/file
pos: ...
flags: ...
...
The first line holds the file descriptor number fd and the path, and the lines after that show the contents of /proc/pid/fdinfo/fd.
Added in version 248.
COREDUMP_EXE=โ where the/proc/pid/exesymlink points. When the crashed process is in a container, that path is relative to the root of the container's mount namespace.
Added in version 248.
COREDUMP_CMDLINE=,COREDUMP_COMM=,COREDUMP_ENVIRON=,COREDUMP_PROC_AUXV=,COREDUMP_PROC_LIMITS=,COREDUMP_PROC_MAPS=,COREDUMP_PROC_MOUNTINFO=,COREDUMP_PROC_STATUS=โ these map the per-process entries in the/proc/filesystem:/proc/pid/cmdline(the command line of the crashed process),/proc/pid/comm(the command name associated with the process),/proc/pid/environ(the environment block of the crashed process),/proc/pid/auxv(the auxiliary vector of the crashed process, seegetauxval(3)),/proc/pid/limits(the soft and hard resource limits),/proc/pid/maps(memory regions visible to the process and their access permissions),/proc/pid/mountinfo(mount points in the process's mount namespace), and/proc/pid/status(various metadata about the process).
See proc(5) for more info. ๐
Added in version 248.
COREDUMP_HOSTNAME=โ the system hostname. When the crashed process was in a container, this is the container hostname.
Added in version 248.
COREDUMP_CONTAINER_CMDLINE=โ for processes running in a container, the command line of the process that spawned the container (the first parent process with a different mount namespace).
Added in version 248.
COREDUMP=โ when the core is stored in the journal, this is the core image itself. ๐ง
Added in version 248.
COREDUMP_FILENAME=โ when the core is stored externally, this is the path to the core file.
Added in version 248.
COREDUMP_TRUNCATED=โ set to"1"when the saved coredump got truncated. (A partial core image may still be processed by some tools, though obviously not all the information is available.)
Added in version 248.
COREDUMP_PACKAGE_NAME=,COREDUMP_PACKAGE_VERSION=,COREDUMP_PACKAGE_JSON=โ if the executable carried.packagemetadata ELF notes, they get parsed and attached. The package and version of the'main'ELF module (i.e. the executable) get appended individually, and the JSON-formatted content of all modules gets appended as a single JSON object, each one keyed by module name. For more on this metadata format and content, see the Package Metadata for Executable Files[5] document.
Added in version 249.
MESSAGE=โ the message generated bysystemd-coredump, which includes the backtrace if it was successfully generated. Whensystemd-coredumpis invoked with--backtrace, this field is provided by the caller.
Added in version 248.
Various other fields exist in the journal entry, but they pertain to the logging process, i.e. systemd-coredump, not the crashed process. See systemd.journal-fields(7).
The following fields get saved (if known, obviously ๐) with the external file listed in COREDUMP_FILENAME=, as extended attributes:
user.coredump.pid,user.coredump.uid,user.coredump.gid,user.coredump.signal,user.coredump.timestamp,user.coredump.rlimit,user.coredump.hostname,user.coredump.comm,user.coredump.exeโ those are the same asCOREDUMP_PID=,COREDUMP_UID=,COREDUMP_GID=,COREDUMP_SIGNAL=,COREDUMP_TIMESTAMP=,COREDUMP_RLIMIT=,COREDUMP_HOSTNAME=,COREDUMP_COMM=, andCOREDUMP_EXE=, described above. ๐
Added in version 248.
You can view those with getfattr(1). For the core file from that journal entry we showed you earlier:
$ getfattr --absolute-names -d /var/lib/systemd/coredump/core.Web....552351.....zst
# file: /var/lib/systemd/coredump/core.Web....552351.....zst
user.coredump.pid="552351"
user.coredump.uid="1000"
user.coredump.gid="1000"
user.coredump.signal="11"
user.coredump.timestamp="1614342930000000"
user.coredump.comm="Web Content"
user.coredump.exe="/usr/lib64/firefox/firefox"
...
๐ SEE ALSO ๐
coredump.conf(5)coredumpctl(1)systemd-journald.service(8)systemd-tmpfiles(8)core(5)sysctl.d(5)systemd-sysctl.service(8)- systemd Coredump Handling[1]
๐ NOTES ๐
- systemd Coredump Handling โ https://systemd.io/COREDUMP
- Journal Export Format โ https://systemd.io/JOURNAL_EXPORT_FORMATS#journal-export-format
- systemd-coredump-python โ https://github.com/systemd/systemd-coredump-python
kill(1)expects signal names without the prefix;kill(2)uses the prefix; all systemd tools accept signal names both with and without the prefix.- Package Metadata for Executable Files โ https://systemd.io/PACKAGE_METADATA_FOR_EXECUTABLE_FILES/
and that's a wrap on the whole page, bestie ๐ซถ this one came from systemd 262.1 (the SYSTEMD-COREDUMP(8) girlies know) โ go forth and debug your crashes with main character energy ๐๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms