Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change apport default behaviour for non-packaged application crashes?

We have an Ubuntu server deployed with apport enabled as shown.

~$ cat /proc/sys/kernel/core_pattern 
|/usr/share/apport/apport %p %s %c

Unfortunately apport's behaviour in dealing with non-packaged application crashes is not entirely to our liking. apport is producing "core" files (assuming ulimit -c is set appropriately) in the working directory in these scenarios. For example, from the apport logs,

ERROR: apport (pid 10117) Tue Jan  8 08:56:25 2013: executable: /home/jess/a.out (command line "./a.out")
ERROR: apport (pid 10117) Tue Jan  8 08:56:25 2013: executable does not belong to a package, ignoring
ERROR: apport (pid 10117) Tue Jan  8 08:56:25 2013: writing core dump to /home/jess/core (limit: 18889465931478580853760)

Frustratingly, once a core file is there it will not be overwritten. So for example if we're testing an app and forgot to clear an old core file from the working directory, then the app crashes during test, we won't see a new core file. Even if it were overwritten, this might not be ideal either as we then lose the old core.

Ideally what we'd like is the ability to tell apport, via an argument for example, that for non-packaged application case, generate a core file with a file name formatted according to a specified pattern (as per the core_pattern file specification) ... is there any way of doing this, or something equivalent?

like image 441
Jess Avatar asked Jan 07 '13 22:01

Jess


People also ask

What is apport package?

Apport intercepts Program crashes, collects debugging information about the crash and the operating system environment, and sends it to bug trackers in a standardized form. It also offers the user to report a bug about a package, with again collecting as much information about it as possible.

What is Apport process?

DESCRIPTION. apport automatically collects data from crashed processes and compiles a problem report in /var/crash/. This is a command line frontend for reporting those crashes to the developers. It can also be used to report bugs about packages or running processes.

What is apport unpack?

The apport-unpack command will output human readable files into a directory provided a . crash file and the name of a directory.


1 Answers

Another alternative is to use Apport to handle your crashes. It will save the core dump, along with a ton of other useful context about the crash. Add the following lines to ~/.config/apport/settings (create it if it doesn't exist):

[main]
unpackaged=true

Now crashes will appear as Apport .crash files in /var/crash. You can unpack them with apport-unpack.

One caveat: it appears that Apport still tries to upload these crashes to the Ubuntu bug tracker if the user leaves the 'Send error report' checkbox checked; this may be a problem if you are working on proprietary code, etc. I'm looking for more info on this; it seems that /etc/apport/crashdb.conf may control where the crash reports get sent.

like image 105
Tom Avatar answered Sep 21 '22 23:09

Tom