Ubuntu Core Snap – How to Debug Snaps

snapubuntu-core

I've successfully built a snap that I can install on my system.

However, it crashes upon start, and I'm not quite sure where to start debugging that crash.

What are the different approaches to debugging an installed app failing to start?

Best Answer

For debugging confined snaps (ie, installed without --devmode) there is a snap in the store called snappy-debug that will get better over time but is already useful. To use:

    sudo snap install snappy-debug --devmode # after snapd 2.0.7 lands, drop --devmode
    sudo snap connect snappy-debug:log-observe ubuntu-core:log-observe
    sudo /snap/bin/snappy-debug.security scanlog

This scanlog command will tail the syslog, resolving seccomp syscall numbers and make suggestions on what interfaces to use, changes to make to your snap to work within the sandbox, etc. You can filter by snap with:

    sudo /snap/bin/snappy-debug.security scanlog <snapname>

Some more tips are covered here:

Using snap try can be helpful too.

Related Question