我正在尝试在 Ubuntu 18.04 上进行设置systemd-coredump
,以便我可以捕获并记录我的 C++ 应用程序的崩溃以进行调试。
到目前为止,我已经systemd-coredump
从 apt 安装了 237-3ubuntu10.47 版本,并且可以通过向我的应用程序发送分段错误信号来触发崩溃:
sudo kill -s SEGV <application-pid>
但是,我没有/var/crash/
像预期的那样看到转储。运行sudo coredumpctl list
也不会显示任何崩溃;它只回复No coredumps found.
我阅读了日志存储在日志中的systemd-coredump
手册,所以我打开它sudo journalctl
并搜索我的kill
命令。之后,我发现了这个错误信息:
Jun 30 21:53:41 ip-100-90-52-170 kernel: Core dump to |/usr/lib/systemd/systemd-coredump pipe failed
我检查了目录/usr/lib/systemd/
,发现它systemd-coredump
不存在。但是,我不确定这个...文件是否?..目录?应该是动态创建的。在文件/目录创建期间是否可能存在权限问题,因为我的应用程序以非特权用户身份运行,因为/usr/lib/systemd/
它是由 拥有的?root
这是我的kernel.core_pattern
配置,/usr/lib/sysctl.d/50-coredump.conf
. (这是默认设置。)
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See sysctl.d(5) for the description of the files in this directory,
# and systemd-coredump(8) and core(5) for the explanation of the
# setting below.
kernel.core_pattern=|/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %e
还有我的coredump
配置,/etc/systemd/coredump.conf
(也是默认配置)。
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See coredump.conf(5) for details.
[Coredump]
#Storage=external
#Compress=yes
#ProcessSizeMax=2G
#ExternalSizeMax=2G
#JournalSizeMax=767M
#MaxUse=
#KeepFree=
我还确认我没有配置片段/etc/systemd/coredump.conf.d/
(事实上,没有这样的目录。)