centos 无法使用 ulimit -c 进行 coredump -c 是无限制的

centos cannot coredump with ulimit -c is unlimited

我刚刚使用并行桌面在 mac 上安装了 CentOs 7。

这是 ulimit -c 的结果:

[root@centos-linux test1]# ulimit -c
unlimited

这里是/etc/security/limits.conf

的内容

但是没有创建核心转储文件。

我还能做什么来启用 coredump?

此现象是核心转储文件路径错误造成的。

我认为核心转储文件应该在当前目录或/tmp 中创建。但事实并非如此。

cat /proc/sys/kernel/core_pattern 告诉核心转储文件在哪里。

在我的系统中:

[root@centos-linux Linux]# cat /proc/sys/kernel/core_pattern 
/mydata/corefile/core-%e-%s-%u-%g-%p-%t

但是,我的系统中没有/mydata/corefile

所以我可以创建一个新目录 /mydata/corefile 或使用

sysctl -w kernel.core_pattern=/tmp/core-%e-%s-%u-%g-%p-%t

获取 /tmp 中的核心转储文件。