How do I debug snaps?

Solution 1:

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:

  • https://developer.ubuntu.com/snappy/build-apps/debug

Using snap try can be helpful too.