Debug service app crash


I am trying to build a snap that packs a service, but whenever I do snap try --devmode prime my computer crashes (hangs). Running the app itself by hand outside of the snap is fine. The same snap built on my colleague’s laptop doesn’t crash. Mine and his os respectively is Xubuntu 16.04 and Xubuntu 17.10.

I read another topic where snap run --strace and --gdb was suggested, but I cannot run the service via snap run. snap list marks the snap as broken, and snap info is missing basic metadata fields such as description. See the output below:

name:      myapp
summary:   ""
license:   unknown
description: |
 myapp: simple, enabled, inactive
installed:                                   (x1) 0B devmode,try,broken
refreshed:                                 2018-03-13 13:46:10.463150451 +0100 CET

Any suggestion on debugging this issue?


For full system lockup/crash debugging you’ll need to find a way of monitoring the system during the crash. If you have a serial/RS232 port on your machine you could use an external PC to receive serial debugging output from the kernel. I’ve tried to do this myself with USB serial adapters but it seems that the kernel requires the serial device to be part of the mainboard for pushing the debugging logs to it - the USB stack seems to come up too late for the serial output to get tied to a USB RS232 port.

Alternatively, you could try a network console but this is less reliable than RS232-based log capture.

Finally there is the option of using a crash kernel to capture a stack trace from a running kernel via the kexec mechanism.

In all three of these there is no guarantee that you’ll be able to get useful logging but they do provide more likelihood of getting at least something.

Would it be OK for you to share your snapcraft.yaml so that we can see if there is something obviously amiss there, or rebuild it ourselves to replicate your issue?

Hi Daniel,

This is the snapcraft.yaml

name: myapp
version: git
summary: Some REST service
description: Some REST service

grade: devel
confinement: devmode

    command: |
      bin/gunicorn myapp.wsgi
    daemon: simple
      - network
      - network-bind

    plugin: python
    python-version: python2
    source: .
      - gunicorn
      - psycopg2
    requirements: requirements.txt
      - libbz2-1.0
      - libncursesw5
      - libtinfo5
      - zlib1g
      - libdb5.3
      - libstdc++6
      - libgcc1
    after: [frontend-deps]
    prepare: |
      install $SNAPCRAFT_STAGE/softwarecat.js ./myapp/static/scripts.js
      install $SNAPCRAFT_STAGE/master.css ./myapp/static/master.css

    plugin: nodejs
    node-engine: 8.10.0
    source: .
    install: |
      install myapp/static/softwarecat.js  $SNAPCRAFT_PART_INSTALL/softwarecat.js
      install myapp/static/master.css  $SNAPCRAFT_PART_INSTALL/master.css
      - softwarecat.js
      - master.css
      - -softwarecat.js
      - -master.css

Is there something wrong with it?

It works if I change the confinement to classic.

That’s an intriguing discovery. I wonder if @jdstrand or @sergiusens can help?

I can only suspect some weird apparmor/seccomp issue coming into play; @jdstrand will be unavailable this week so some patience is required.

It’s no hurry. For now I will stick to classic confinement.