I wrote a simple C application (in core_app.c) to process a coredump:

int main(int argc, char *argv[]) {
    FILE *fp = fopen("/tmp/coretest", "w");
    char input[MAX_INPUT];
    // write a coredump to /tmp/coretest
    if (fp != 0) {
        while (fgets(input, MAX_INPUT, stdin)) {
            fputs(input, fp);
    } else {
        perror("[FMon] cannot open file!");

    return EXIT_SUCCESS;

and then I set the core_pattern using a systemd service which contains:

ExecStart=/bin/sh -c "echo '| core_app' > /proc/sys/kernel/core_pattern"

After a reset the content of the file /proc/sys/kernel/core_pattern is correct. But the syslog shows:

Jan 01 00:19:52 kernel: Core dump to | core_app pipe failed

Anybody knows why the pipe failed? Thanks

  • 2
    have you tried full path? is your core_app has "x" bit?
    – user996142
    Commented Jun 30, 2017 at 13:09
  • thanks @user996142! yes, the missing full path was the issue. Do you know how to deal with the specifier conflict between systemd and coredump. If I type ExecStart=/bin/sh -c "echo '| /usr/bin/core_app %e %p %c' > /proc/sys/kernel/core_pattern in the service file, the specifier %p and `%c are subtitute to the service name and service path.
    – ywiyogo
    Commented Jun 30, 2017 at 14:39
  • Thats because of freedesktop.org/software/systemd/man/… look here: stackoverflow.com/questions/40532499/…
    – user996142
    Commented Jun 30, 2017 at 15:12

1 Answer 1


The kernel invokes the command declared in core_pattern from the process's current directory. This is a direct kernel invocation, so there is no PATH lookup. Therefore core_app must be an executable file in the process's current directory.

To invoke a particular core_app executable no matter what the process's current directory is, use the full path to core_app, e.g.

echo '|/usr/local/sbin/core_app' >/proc/sys/kernel/core_pattern

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .