首页 > 解决方案 > centos 不能用 ulimit coredump -c 是无限的

问题描述

我刚刚使用 Parallel Desktop 在我的 Mac 上安装了 CentOs 7。

这是结果ulimit -c

[root@centos-linux test1]# ulimit -c
无限制

这是 /etc/security/limits.conf 的内容

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

我还能做些什么来启用 coredump?

标签: centoscoredumpulimit

解决方案


这种现象是由于错误的核心转储文件路径造成的。

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

cat /proc/sys/kernel/core_pattern告诉 coredump 文件在哪里。

在我的系统中:

[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 中获取 coredump 文件。


推荐阅读