Ubuntu – Apport support for non ubuntu packages

application-developmentapportpackage-management

I have been reading about apport and its usage for a week by now. But could not understand the below things.

Scenario:

I have developed an application and packaged it. And its name is MyApp.deb. The binary package name is MyApp .The application is installed in the path /opt/myapplication/bin/MyApp.

Requirement:

  1. When my application crashes, I want to be able to collect core dump.
  2. On each subsequent crash, it has to create a new crash, but not overwriting the existing one. Something like auto renaming with the current time stamp, etc would help me.
  3. When I install my application on a customer machine, my installer must not modify his system wide parameters. Say for example, I must not change the pattern of his core file generation, because the user/customer might hate my application as I would change his system parameters without his consent.
  4. I am ok with the path of core file generation. Either current directory or /var/crash

Things that I have explored till now:

Apport is a nice utility which enables core file generations. Using /proc/sys/kernel/core_pattern I can format core files. This provides flexibility to redirect the core files to a predefined directory, name core files with pid, file path pattern appended or prep-ended to it,etc.. For non Ubuntu packages, I have to write hooks to generate core dumps (reports). Apport after collecting the report it will upload.

Things that I do not understand:

  1. Is Apport the one I must be looking at?? I mean does it suffice my purpose? Or should I be looking at something else?
  2. What kind of package does my application fall under? Do I call it non-ubuntu? 3rd part? what is it? I see different terminologies in documents?
  3. As I mentioned, MyApp runs from /opt/myapplication/bin/MyApp, so where will the core files be generated? Current dir or /var/crash? Does Apport detect crashes trigerred from /opt? Does it interpret it?
  4. Important question: If I have developed the application and if Apport uploads the report to Ubuntu repositories, it does not make sense. So how can I tell Apport to send the report to me.
  5. I get this error: executable does not belong to a package, ignoring. So what am I doing wrong?
  6. For apport to recognise my package, do I need to make it a source package? Is it mandatory? I just want to create a binary package?
  7. I also saw somewhere in the documents that Apport recognises:
    1. Ubuntu packages or
    2. Launchpad applications but my application is neither of these. So how does Apport help me in the current scenario?

Best Answer

  1. It looks close, but might not be what you need. Apport automatically changes /proc/sys/kernel/core_pattern. So if that can't be changed, you're pretty much out of luck. On the other hand, apport is in the default Ubuntu install now, so practically everyone using Ubuntu already has that parameter changed by it. I'm also not aware of any way to tell apport to keep more than the most recent crash from a particular app, but as long as each crash is uploaded, that's not an issue.
  2. I'd refer to it as third-party.
  3. Apport supports executables installed in /opt. You will need to provide a hook in /opt/path/to/your/app/share/apport/package-hooks.
  4. You can set a custom crash database in the package-hook for your package. But if your crash database doesn't act like debbugs or launchpad, you will also need to create a custom crash database connector implementation, which doesn't look like it can be done without installing a python file outside of /opt.
  5. The executable needs to be installed by dpkg, which means you need to package it in a .deb file.
  6. You have to create a source package in order to create a binary package, because binary packages are created from source packages. You do not need to distribute the source package.
  7. Apport works with anything packaged as a .deb file.