Expand the snapcraft.yml file and analyze extensions
snapcraft expand-extensions | yq '.apps[].plugs' | sort | uniq
Analyze the snap application log
sudo journalctl -e | grep DENIED | grep apparmor | grep <application-name>
Analyze the journalctl log
journalctl | grep snap
Clean, pack, remove and install snap
# clean
sudo snapcraft clean --verbosity debug && snapcraft pack --verbosity debug; sudo snap remove --purge fromgtog; sudo snap install fromgtog_*_amd64.snap --devmode && fromgtog
#super clean
sudo snapcraft clean --verbosity debug && snapcraft pack --verbosity debug; sudo snap remove --purge fromgtog; sudo snap install fromgtog_*_amd64.snap --devmode && fromgtog
# super super clean fromgtog
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug;
sudo snap remove --purge fromgtog; rm -rf /snap/fromgtog; rm -rf ~/snap/fromgtog/common/.cache; sudo snap install fromgtog_*_amd64.snap --devmode && fromgtog
# super super clean fromgtog
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug;
sudo snap remove --purge fromgtog; rm -rf /snap/fromgtog; rm -rf ~/snap/fromgtog; sudo snap install fromgtog_*_amd64.snap --devmode && fromgtog
# super super clean fromgtog + pack + remove + install + upload
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug && sudo snap remove --purge fromgtog && rm -rf /snap/fromgtog && rm -rf ~/snap/fromgtog && sudo snap install fromgtog_*_amd64.snap --devmode && gnome-terminal --working-directory=$(pwd) -- sh -c 'snapcraft upload --release=edge fromgtog_*_*.snap; sleep'; fromgtog
# super super clean noc-converter
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug;
sudo snap remove --purge noc-convert; rm -rf /snap/noc-convert; gnome-terminal --working-directory=$(pwd) -- sh -c 'snapcraft upload --release=edge noc-convert_*_*.snap; sleep'; rm -rf ~/snap/noc-convert/common/.cache; sudo snap install noc-convert_*_amd64.snap --devmode && noc-convert
# super super clean justfocus
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug;
sudo snap remove --purge justfocus; rm -rf /snap/justfocus; rm -rf ~/snap/justfocus/common/.cache; sudo snap install justfocus_*_amd64.snap --devmode && justfocus
# super super clean justfocus
sudo snapcraft clean --use-lxd --verbosity debug && snapcraft pack --verbosity debug && sudo snap remove --purge justfocus && rm -rf /snap/justfocus && rm -rf ~/snap/justfocus/common/.cache && sudo snap install justfocus_*_amd64.snap --devmode && justfocus
sudo snapcraft clean && snapcraft pack -f snapcraft-core20.yml && sudo snap remove fromgtog && sudo snap install fromgtog_9.0.7.1_amd64.snap --dangerous && fromgtog
sudo snapcraft clean && snapcraft pack --destructive-mode && sudo snap remove fromgtog && sudo snap install fromgtog_9.0.7_amd64.snap --dangerous && fromgtog
Upload
# upload fromgtog
snapcraft upload --release=edge fromgtog_*_*.snap
snapcraft upload --release=stable <my-snap>.snap
Snap Debugging
Open a shell
snap run --shell fromgtog
$SNAP/usr/lib/jvm/custom-jre/bin/java -Djava.awt.headless=false -classpath $SNAP/jar/fromgtog.jar com.andreidodu.fromgtog.Main
Snap connections
snap connections jmodules
Snappy debug
sudo snap install snappy-debug
sudo snappy-debug.security scanlog
Full clean
sudo snapcraft clean --use-lxd --verbosity debug
Pack your application
sudo snapcraft pack --verbosity debug;
Remove all from your old snap
sudo snap remove --purge YOU_SNAP_NAME;
Remove the remaining old stuff if exists
sudo rm -rf /snap/YOU_SNAP_NAME && rm -rf ~/snap/YOU_SNAP_NAME
Install and execute the new snap
sudo snap install YOU_SNAP_NAME_*_*.snap --devmode && YOU_SNAP_NAME
- If you application writes and reads from tmp folder, clean the tmp folder otherwise it could happen that starting the application from your IDE works fine, because it writes and reads from /tmp, but if you run the snap you will not be able to write (just read), because from snap is not possible to access to the /tmp folder, so you could encounter unexpected behaviour.