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


#1

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!

#2

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


#3

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.


#4

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.


#5

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/ ?


#6

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.