and running the “snapcraft” command, my snap fails to build with the following error:
Failed to generate snap metadata: The specified command ‘filter’ defined in the app ‘filter’ does not exist or is not executable
From what I understand, the snapcraft program is searching for a bin that doesn’t exist, which results in the above error.
By comparing my current parts/stage/prime folders with those of another app that was successfully snapped, it seems that stage/bin is empty. I’d appreciate any help with troubleshooting what the issue could be; I’ve been looking into snappy-debug, but am having some difficulty getting this started as well. I appreciate any and all input. Thanks in advance!Preformatted text
Wanted to post an update in case there was anyone facing a similar issue - my updated yaml file is as follows (snaps and installs successfully although the service seems to fail; possibly because of permissions related to gpio access)
anyway, here’s a yaml file to simply create a daemon of a python file:
Just a word of caution, the use of sudo here will only work becuase you have set confinement to devmode. You should be using sudo from the calling shell instead for better future proofing.
Thanks for catching that! The daemon actually fails with sudo/I forgot to remove that before I posted.
For anyone reading, I’m currently stuck debugging why my daemon immediately exits with status 126. I’m inclined to believe the script doesn’t have permission to the gpio pins, although I’m not absolutely sure about this as the relevant gpio pins should be connected:
You can use snappy-debug.security scanlog to determine whether there are issues with confinement:
You need two terminals, one for the debug spew and the other to launch your application. On an Ubuntu Core device this can be achieved by connecting via SSH multiple times simultaneously.
# Terminal 2
# For a user-launchable app
sudo snap run filter # or `sudo /snap/bin/filter`
# or just `sudo filter` as $PATH should cover /snap/bin anyway
# For a systemd daemon (you want this one for your yaml above)
sudo systemctl restart snap.debounce-filter.filter.service
results in “command not found”, and I can’t find the folder it’s installed in to manually run the command either.
OTOH
gives me the following:
Failed to restart snap.debounce-filter.filter.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and ‘systemctl status snap.debounce-filter.filter.service’ for details.
Where the system logs and systemctl status have informed me that the exit status is 126.
this is extremely weird, the two should have the same version since on an UbuntuCore system they come from the same snap package. did you somehow tinker with the system installation ?
To my knowledge it’s still the same image that came preinstalled on the device. Could the different versions be a possible explanation for the behaviour of snap? I think the daemon issue is separate, but it’s definitely odd that I can’t find where snaps are being installed. What would you recommend going forward?
snaps usually get installed into /var/lib/snapd/snaps/ … the .snap files are squashfs’es that get mounted into /var/snap/ which is equivalent to /snap (both dirs should contain the same). apps defined in snapcraft.yaml of the snaps then get an executable entry in /snap/bin which typically is in your $PATH.
(i’m actually not sure the version difference is an actual issue, but i have never seen something like that on an UbuntuCore system … OTOH i am not even sure caracalla is shipped with only UbuntuCore, you might have one with a standard Ubuntu Server install, just running “apt” would tell you that you are on UbuntuCore and that apt is not supported in case you are on a Core system)
Which leads me to believe that ‘dump’ wasn’t the correct plugin to use in creating the Snap, as the necessary modules can’t be found. This seems a little odd to me as python2.7 is included in ‘stage-packages’…
I also tried specifying ‘python’ as the plugin and ‘python-version: python2’, but this results in a failure to create a snap.
That looks like it’s running bin/filter as a bash script, not a python script. Does the file have a correct #! line at the top? If you don’t have that line, or don’t want it, you can change your command to something like: