"Could not find snap/snapcraft.yaml" when it is there

I am trying to build a snap. Snapcraft has worked for me on this machine in the past, but now it is continuously failing with:

    $ snapcraft
    Launching a VM.
    Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
    To start a new project, use `snapcraft init`
    Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
    An error occurred when trying to execute 'sudo -i env SNAPCRAFT_HAS_TTY=True snapcraft snap' with 'multipass': returned exit code 2.

The snapcraft.yaml does exist in snap and if I do:

    $ snapcraft init
    snap/snapcraft.yaml already exists!
1 Like

What directory are you in when you run snapcraft init? Preferably not your home directory.
What version of snapcraft and snapd do you have? Can you please paste the output from:

snap version

snapcraft version

This looks like Snapcraft failed to mount the project folder into the VM. Not sure what’s wrong though.

You might want to run again with the SNAPCRAFT_ENABLE_DEVELOPER_DEBUG=yes environment variable, and check out the log of the snap.multipass unit.

had the same issue a couple of times, this is how I solved it:

multipass list
note which instances exist, if any delete with
multipass delete --purge snapcraft-instance-name
reinstall multipass
sudo snap remove multipass
snapcraft (will install multipass automatically)

Sometimes multipass gets stuck (or freezes), this workaround works though!
Hope this helps.

1 Like

I have run into this a couple of times myself, I thought the issue was fixed, if this persists, do you mind login an issue on https://github.com/CanonicalLtd/multipass/issues/ ?

Hey @aaronw, it’s likely to be this issue - we fixed it since the last release, but it’s not yet available in beta. You can snap refresh multipass --edge to get the edge version with the fix.

2 Likes

Thanks for the reply.

I am in the project root directory, so:
~/coding/duplicity-0.7.0.999
and the snapcraft.yaml is in:
~/coding/duplicity-0.7.0.999/snap/

snap version:
$ snap version
snap 2.38+18.10
snapd 2.38+18.10
series 16
ubuntu 18.10
kernel 4.18.0-17-generic

$ snapcraft version
snapcraft, version 3.4

Thanks @joshirio ! Removing and reinstalling multipass solved this for me – perhaps also because the fix @Saviq has made it into beta in the meantime (@Saviq just refreshing the multipass version did not seem to be enough).

I faced the same issue today. This issue is hitting me still.

$ snap version
snap    2.42.5
snapd   2.42.5
series  16
ubuntu  19.10
kernel  5.3.0-24-generic

$ snapcraft version
snapcraft, version 3.8

I tried to remove the multipass snap and reinstall it but got the same error.

~/workspace/cheat-snap (master) $ snapcraft  

Launching a VM.
Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
To start a new project, use `snapcraft init`
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

Looking at the state of my multipass vm I could see this:

Name                    State             IPv4             Image
snapcraft-cheat         Delayed Shutdown  10.163.101.29    Ubuntu Snapcraft builder for Core 

Restarting the multipass instance helped …

Hi @bernermic, which version of Multipass are you using (multipass version)?

Hi @Saviq - the latest stable one

$ multipass version
multipass  1.0.0
multipassd 1.0.0

This is still an issue today:
Running ubuntu 19.10

multipass 1.0.2 1597 latest canonicalâś“ classic

snapcraft 3.9.8 3970 stable canonicalâś“ classic

I had to restart multipass and then delete the multipass vm(?) for my snap.