How to permanently edit the core_pattern file?

I am trying to locate my coredump file in ubuntu 12.04 LTS but I cant. The problem is that I have to edit the core_pattern file content after every reboot to get it, because apport doesn't work (don't know why).

Is there any way to permanently set core_pattern file's content??


Solution 1:

The /proc/sys/kernel/core_pattern configuration setting is set when the apport crash reporting service starts on system boot. So the first step in the process would be to disable apport. This can be done by editing the /etc/default/apport file, and setting enabled=0.

At this point, the kernel default core pattern should remain on boot. If you want to switch to some other pattern you can do this by placing a file in /etc/sysctl.d that ends in .conf (e.g. 60-core-pattern.conf). It's contents should look something like this (adjusting for your desired pattern):

kernel.core_pattern = core

That should cause your custom pattern to be loaded on boot. You should be able to test it without rebooting by running sudo sysctl --system.