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:
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:
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.
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.
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