I’m currently trying to build a snap targeting the Raspberry Pi 3 Model B+ running Ubuntu Core 18 arm64.
To build the snap for the arm64 architecture, I’m using another Raspberry Pi (same model), which is running Ubuntu server arm64.
On the clean Ubuntu server, I installed snapcraft using
sudo snap install snapcraft --classic
When running snapcraft for the first time, it asked whether it should set up multipass, which I confirmed.
Multipass, however, does not work, even though KVM seems to be supported.
snapcraft
Support for ‘multipass’ needs to be set up. Would you like to do that it now? [y/N]: y
snapd is not logged in, snap install commands will use sudo
multipass (latest/beta) 0.8.1 from Canonical✓ installed
Waiting for multipass…
Launching a VM.
launch failed: failed to start qemu instance
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.
kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
multipass launch
launch failed: failed to start qemu instance
How do I fix multipass, so I can run snapcraft?
If running snapcraft in this configuration is not possible, what other way is there to build a snap for Ubuntu Core 18 arm64?
I read about snapcraft.io/build, but haven’t tried it out yet, as I think I have to publish the snap in the official snap store when using this.
I don’t know about multipass on arm, sorry. There’s at least 3 other options.
snapcraft --use-lxd which prints the following on usage:
The LXD provider is offered as a technology preview for early adopters.
The command line interface, container names or lifecycle handling may change in upcoming releases.
It requires you have snap install lxd and sudo lxd init and added yourself to the lxd group then logout/in (or newgrp lxd) before running. But that’s all once-off setup.
Use snapcraft.io/build which requires your code to be in github, or a packaging branch in github which points to your code elsewhere. I use this for a lot of projects. It’s quite handy and easy to setup.
Use launchpad.net which is the backend of snapcraft.io/build and enables you to have more control over the project. You can create a project in launchpad, push code there, and then setup a recipe to build on each commit. Alternatively launchpad can mirror code hosted elsewhere (if needed) and then build in launchpad infrastructure
Finally there’s remote-build which is a new feature of snapcraft 3.9 (currently in the candidate channel) which is useful for open source projects. It will push your code to launchpad, build it, and then pull the results down to your workstation (or CI if run there) for further publishing or testing. This is a really super feature I have been eager to use for some months now. It saves me battery life because I’m not building locally. Here’s an asciinema of it in action.
I think that you would probably have to wait for either Ubuntu 18.04.4 Server or Ubuntu 20.04 Server to get the kernel change since it was applied to the 5.3 kernel. Not sure if there are plans to backport that config change to the 5.0 kernel in 18.04.3.
Thank you all for your input regarding this matter.
I probably should have mentioned that I’m working with Ubuntu server 19.10, but also have tried 18.04.
Following your suggestion, I tried using snapcraft --use-lxd. However, after tinkering around quite a few hours, I could not get it to work this way.
Manually using lxd does work, so I wrote a simple Bash script to automate the steps listed in the “Building manually” section on snapcraft.io/docs/build-on-lxd. This produces the desired output but leaves me thinking, why isn’t snapcraft --use-lxd working?
Can you point me somewhere explaining how to debug the snapcraft command properly?
/ 3. Is there an option to use snapcraft.io/build or launchpad.net for private builds? By private build I mean, that the source and the resulting snap will not be publicly accessible.
remote-build sounds awesome! However, similar to the before mentioned, is there anything planned for private builds?
@ijohnson The efforts made on getting multipass to work on arm64 sound promising, great job!
I believe there was some plan to switch to using the buildd images (Ubuntu Buildd Images Daily Builds) instead, which is available for other architectures. @sergiusens is that accurate?