I’m trying to build a new version of my program, but when I run sudo snapcraft it gives me this error: 'sudo' cannot be used with build provider 'multipass'.
I already build this package before (the last version), and I didn’t receive that error.
I tried to remove and reinstall multipass but it didn’t work and I also tried to use a virtual machine (ubuntu 20.04) and I received the same error again.
This is the reason we did this as you would run once with sudo and have your home directory structure with different ownership Call for testing: Snapcraft 4.0
If any of the PermissionError you get are in ~/.cache/snapcraft, ~/.local/share/snapcraft or ~/.config/snapcraft I would suggest to chown them back to $USER.
Launching a VM.
launch failed: Downloaded image hash does not match
An error occurred with the instance when trying to launch with ‘multipass’: returned exit code 2.
Ensure that ‘multipass’ is setup correctly and try again.
I looked in the properties of ~/.cache/snapcraft, ~/.local/share/snapcraft and ~/.config/snapcraft and it seems I still own them.
What I tried:
sg daniel -c ‘snapcraft --use-lxd’
and after installing lxd it gave me:
Error: LXD still not running after 30s timeout (Get “http://unix.socket/1.0”: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied)
Timeout reached waiting for LXD to start.
sudo usermod -a -G lxd my_user_name # ________this line worked
sudo snapcraft # _________keeps giving me the same error message
sg lxd -c ‘snapcraft’
I received:
Launching a VM.
launch failed: Downloaded image hash does not match
An error occurred with the instance when trying to launch with ‘multipass’: returned exit code 2.
Ensure that ‘multipass’ is setup correctly and try again.
sg lxd -c ‘snapcraft --use-lxd’
I received:
Launching a container.
Project base changed from None to ‘core18’, cleaning build instance.
An error occurred with the instance when trying to launch with ‘LXD’: No storage pool found. Please > create a new storage pool.
Ensure that ‘LXD’ is setup correctly and try again.
sg my_user_name -c ‘snapcraft’
I received:
Launching a VM.
Project base changed from None to ‘core18’, cleaning build instance.
delete failed: The following errors occurred:
instance “snapcraft-tic-tac-toe-x” does not exist
An error occurred with the instance when trying to delete with ‘multipass’: returned exit code 2.
Ensure that ‘multipass’ is setup correctly and try again.
In the end running it without sudo became the correct answer, although in the beginning it wasn’t working. I only don’t know why, maybe because I changed my OS and the versions of multipass and snapcraft until it worked. Thank you all.