Gnu-hello example snap does not run, ubuntu 17.10

I installed snapcraft following the instructions in and then built gnu-hello following

I installed the resulting snap, and it fails to run for some reason.

$ snap run hello
/snap/hello/x1/command-hello.wrapper: 2: exec: hello: not found

As a test, I installed belder via snap and it works as expected.

These are the contents of the wrapper script

cat /snap/hello/x1/command-hello.wrapper
exec “hello” “$@”

Any idea what I am doing wrong?

Odd. Can you provide some more details, such as the output from snap version and snapcraft --version ?

I just used snapcraft cleanbuild on my 18.04 machine so it built in a 16.04 lxd container. I installed the snap and it runs okay.

That wrapper looks decidedly devoid of the normal content for a strict snap. Have you perchance set your snap to be classic? The wrapper should be auto-generated to look like this:

export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
exec "hello" "$@"

Installed versions

$ snap version
snap 2.31.2
snapd 2.31.2
series 16
ubuntu 17.10
kernel 4.13.0-37-generic

$ snapcraft --version
snapcraft, version 2.39.2


I just found out about snapcraft today, so I don’t know the difference between “classic” and other modes, or how to change them. I assumed the getting started / hello world tutorial would set these up correctly?

@popey snapcraft cleanbuild generates a working snap. Just using snapcraft as the tutorial says doesn’t. What is the difference of cleanbuild?

Cleanbuild uses an empty Ubuntu 16.04 container via the LXD system (similar to Virtual Machines like VirtualBox or VMware but without the overhead of emulating the PC Hardware).

Classic is a completely unrestricted package. The other modes are Devmode and Strict. Devmode works the same way as Strict but the restrictions are not enforced so they only log a message to the system log when they would prevent access in a Strict snap. Strict is the “confined” and preferred mode where access to the system is restricted and controlled via “interfaces” which explicitly define the parts of the system that the snap wants to access. You set the mode using the confinement flag in snapcraft.yaml:

name: my-snap
version: '0.1'
summary: My super snap
description: >
  A really awesome snap that does snappy things!

confinement: strict # this can be 'strict', 'devmode' or 'classic'.
1 Like