sergiusens@mirkwood:~$ snap try squashfs-root/
error: cannot try /home/sergiusens/squashfs-root: snap is unusable due to missing files;
contact developer
sergiusens@mirkwood:~$ cat squashfs-root/meta/snap.yaml
name: java-hello-world
version: "1.0"
summary: A java example
description: this is not much more than an example
architectures:
- amd64
confinement: strict
grade: stable
apps:
hello:
command: echo hello
Aside from the actual error, the error message is really too vague to be useful.
I saw this while running off of beta, I have since switched back to stable and things are working again.
Given that you are pretty familiar with snapd, can you please find out why you are getting this error? The message on the tin reflects the actual logic. Itâs trying to find files and canât.
It is because I have disabled the use of the wrapper script in that snapcraft creates with use of adapter: none and used a command which is found on PATH.
Previous to this dumbed down example I had something like
The echo command should be in the default path and found on core, fore any given snap,
$ snap run --shell corebird
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
sergiusens@mirkwood:/home/sergiusens$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
sergiusens@mirkwood:/home/sergiusens$ which echo
/bin/echo
But you say that this was working an earlier snapd release and now it doesnât? It seems surprising that snapd was searching for application commands out of the snap path.
The fact you can access the command from the shell is completely unrelated. When you run a shell you are inside bash, with everything that this means.
Sorry, Iâm still not entirely sure of what you are reporting. My comments above were attempting to clarify it.
Are you saying that âechoâ in âcommand:â in meta/snap.yaml worked with an earlier version of snapd or not? In which version was it working on?
It shouldnât work. If it works now, we broke compatibility and need to fix it, unfortunately. If it didnât work, then the only thing that needs fixing is the error message.
For what itâs worth, as far as I know in any version of snapd prior to the one that warned in this way, youâd get
~$ snap try /var/tmp/java-hello-world
java-hello-world 1.0 mounted from /var/tmp/java-hello-world
~$ java-hello-world.hello
cannot snap-exec: cannot exec "/snap/java-hello-world/x1/echo": no such file or directory
~$
which is exactly the sort of inscrutable error the validation is trying to avoid.
Having said this, there is a hackish âfeatureâ that I made the validation check preserve (not because I like it but because I didnât want to risk breaking working snaps) where you can use a relative path to the binary and itâll work.
@chipaca An absolute path might be fine as well, maybe? What seems unwise is having âfooâ meaning something inside the snap or anywhere else in arbitrary places in the filesystem of the base snap.
with /bin/echo: cannot snap-exec: cannot exec "/snap/java-hello-world/x1/bin/echo": no such file or directory.
This is, again, before this validation check was introduced. Now instead itâll tell you to complain to the developer (and log the errors to the journal for install and try, and to stderr for pack).
As an aside: note that âechoâ is also a shell builtin and PATH is not used by the shell to find it when specified without a relative or absolute path (so the which echo command doesnât test what the shell is doing). If you are testing things with bash (or dash) and only specify âechoâ without a relative or absolute path, then youâll end up with the shell builtin.
I am having the same issue on disabling the creation of wrapper scripts using adapter: none .
Error message: error: cannot install snap file: snap is unusable due to missing files; contact developer
$ snap version
snap 2.36.1
snapd 2.36.1
series 16
kernel 4.4.0-112-generic
Is there a workaround or solution for this problem?
The path in command needs to be relative to the prime directory for the snap to work, wrappers take care of this which by not using them, it is not taken care of. Later version of snapcraft should be warning about this situation though.
Also stop-command(if used). That was the case for me, I had the command path relative to the prime directory but somehow missed to change the stop-command path. journalctl logs for snapd helped me to pin point the issue.