Handy snapcraft features: Remote build

As you probably know, there are many ways you can build snaps: locally using snapcraft, with CI systems like Travis, through Launchpad, and also via the free online Snapcraft Build Service. Now, a new preview feature called Remote build also allows you to build snaps for multiple architectures directly from the command line. This has been high on the developers’ wish list, and now it’s here. Let’s see how it works.

Install experimental branch

To get the remote build preview, you will need to install a separate branch of snapcraft:

snap install snapcraft --channel=beta/remote-build

If you already have snapcraft installed, you will then use the refresh command instead.

sudo snap refresh snapcraft --channel beta/remote-build
snapcraft (beta/remote-build) 3.5+git1.g13c59d4 from Canonical✓ refreshed

Configure system for use

Once the remote-build branch is configured on your system, you can start building snaps. You will need a valid snapcraft.yaml file (that builds successfully) and a Launchpad account, configured for SSH access. This means you will have created an SSH key pair, and the public key will be configured in your Launchpad account.

Start remote build

You invoke remote builds by providing your Launchpad user ID and several optional flags. The remote build functionality comes with some rather nifty features, like the ability to check the status of a running build, resume a previously interrupted build using a unique build number, build from a local git repo, and most importantly, specify target architectures.

--recover <build-number>  Recover interrupted remote build.
--status <build-number>   Display remote build status.
--arch <arch-list>        Set architectures to build.
--git                     Build a local git repository.
--user <username>         Launchpad username.
--help                    Show this message and exit.

The arch option is really handy if your snaps need to run on multiple platforms, for which you might not have sufficient hardware resources (or toolchain expertise) to perform the necessary builds and testing. You can build for i386, amd64, arm64, armhf, ppc64el, and s390x. By default, without any arch arguments supplied, only the first two will be built.

First time run

When you invoke your first remote build, snapcraft will (try to) open your Launchpad account in the browser, and approve snapcraft for authorized access. Depending on your operating system environment setup, snapcraft may automatically launch the browser page, or you can manually access the provided link. The command-line execution will wait until you have completed this step.

snapcraft remote-build --user “your Launchpad user id”
snapcraft remote-build is offered as a preview. Authentication and transport mechanisms will change in future releases. Use with caution in scripts.

The authorization page:

(https://launchpad.net/+authorize-token?oauth_token=swT6JPJhMZwz0ztrb6X8&allow_permission=DESKTOP_INTEGRATION) should be opening in your browser. Use your browser to authorize this program to access Launchpad on your behalf.

Waiting to hear from Launchpad about your decision...

In Launchpad, the requester application will be your hostname, and you have the option to decide for how long you want to allow access. You can go for temporary or permanent access, and of course, you can always revoke it later on if you like.

The next step is to approve the authenticity of the remote host – as we’re establishing an SSH connection. Optionally, depending on your security configuration, you will be asked to provide a password for your private key.

Sending data to remote builder…
The authenticity of host 'git.launchpad.net (' can't be established.
RSA key fingerprint is SHA256:ABCDEF…
Are you sure you want to continue connecting (yes/no)? Yes
Enter passphrase for key '/home/your-username/.ssh/id_rsa':
Building package. This may take some time to finish.

Once this step completes, the build will resume.

Building in progress

The remote build can take a little while to start. You snapcraft build will be placed in a queue, and you will see an expected time for it to initialize and finish. You can track the status from the command line as well as through your Launchpad account.

The easiest way to access the snaps page is by using the following URL format:


Meanwhile, the build ought to continue:

Building package. This may take some time to finish.
If interrupted, resume with: 'snapcraft remote-build --recover 49937505'

After a while, if your YAML syntax is valid, the build will finish successfully.

The created snaps will be copied over to your host, and you will see them in your project directory. In our example, since we haven’t used any architecture overrides, we have two snaps (i386 and amd64):

Building package. This may take some time to finish.
If interrupted, resume with: 'snapcraft remote-build --recover 49937505'
Snapped tqdm_1.0_i386.snap
Snapped tqdm_1.0_amd64.snap
Build complete.


Remote build is rather useful feature, as it provides developers with a great deal of flexibility and power in the snap build cycles. It allows you to use snapcraft even if your local system is not well suited for the task, like hardware or resources(or both). The multi-arch support makes remote build extra useful for IoT and non-desktop platforms. The initial setup takes a little bit of effort, but after that, you should have a robust, elegant capability in place, which greatly expands your application reach. At the moment, this is still a test feature, so we welcome feedback and ideas. Please join our forum and tell us what you think.

Bonus points if you picked up the C&C: RA references in this article.

Photo by Felix Berger on Unsplash.

Ubuntu desktop

Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.

Newsletter signup

Select topics you’re
interested in

In submitting this form, I confirm that I have read and agree to Canonical’s Privacy Notice and Privacy Policy.

Related posts

The Windows Calculator on Linux with Uno Platform

The good folks in the Uno Platform community have ported the open-source Windows Calculator to Linux. And they’ve done it quicker than Microsoft could bring...

How to make snaps and configuration management tools work together

In environments with large numbers of client machines, configuration management tools are often used to simplify and standardize the target state of each host...

Stepping Down Gracefully

The Snap Store has been designed to enable upstream developers and enthusiastic community contributors to publish snaps. As with most Linux packaging...