➜ sudo snap install --classic snapcraft
Snaps are an incredible new packaging format for Linux from Canonical.[1] They offer application confinement and increased portability while also simplifying the development workflow. Recently I submitted a pull-request to extend the Sublime Merge snap with support for arm64 so that I could use it on my Pinebook Pro. Testing the snap locally required I figure out the process on the arm64 architecture. There is a little bit of tweaking required as its still early days for this, but that’s why I made this tutorial!
This tutorial is run on Armbian’s release of Ubuntu 20.04 Focal Fossa for the Pinebook Pro.[2] Your mileage may vary a little bit on other distributions. You should be comfortable using the command-line on Linux, managing Unix group membership, executing privileged commands with Sudo, packaging and installing snaps, and obtaining source with Git. That was a mouthful, wasn’t it? If you made it this far you probably know all of that stuff anyways, so let’s jump right into it!
Install Snapcraft.
➜ sudo snap install --classic snapcraft
It’s still early days for LXD on the 64-bit ARM architecture, so install the latest candidate release.
➜ sudo snap install lxd --channel candidate
To avoid having to use root for LXD, add your user to the lxd group.
➜ sudo usermod -a -G lxd $USER
Only place users you trust with root access in the lxd group.[3] |
Now that LXD is installed, it must be initialized.
➜ lxd init --auto
Get the snapcraft YAML file for an application that supports building on the arm64 architecture, such as the hello-snapcraftio example project.
➜ git clone https://github.com/ubuntu-core/hello-snapcraftio.git
Change into the project root or the directory containing the Snapcraft YAML file, usually located in a snap directory.
➜ cd hello-snapcraftio
Build the snap, using LXD to drive the containers.
➜ snapcraft --use-lxd
If you run into issues with LXD here, you might try a good old fashioned restart. |
Now, install the .snap file created in the current directory by the previous command.
➜ sudo snap install --devmode --dangerous hello_*.snap
hello 2.10 installed
And the magic moment, run your new snap!
➜ snap run hello
Hello, world!
To clean things up, remove the hello snap.
➜ sudo snap remove hello
Now you know how to get up and running with building your snap packages locally on a 64-bit ARM device. Happy snapping!