---
title: 'Handy snapcraft features: Remote build'
description: '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  […]'
url: https://canonical.com/blog/handy-snapcraft-features-remote-build?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Igor Ljubuncic](https://canonical.com/blog/author/igorljubuncic "More about Igor Ljubuncic")

18 July 2019

# Handy snapcraft features: Remote build

[Launchpad](https://canonical.com/blog/tag/launchpad)
[remote build](https://canonical.com/blog/tag/remote-build)
[snapcraft](https://canonical.com/blog/tag/snapcraft)
[snapcraft.io](https://canonical.com/blog/tag/snapcraft-io)

---

Share the article

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](https://docs.snapcraft.io/channels) 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](https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair), 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 (162.213.33.95)' 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:

https://launchpad.net/~”your-Launchpad-username”/+snaps

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

# Summary

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](https://forum.snapcraft.io/) and tell us what you think.

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

Photo by [Felix Berger](https://unsplash.com/@felixberger?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Snapcraft 8.0 and the respectable end of core18](https://canonical.com/blog/snapcraft-8-0-and-the-respectable-end-of-core18)

‘E’s not pinin’! ‘E’s passed on! This base is no more! He has ceased to be! ‘E’s expired and gone to meet ‘is maker! ‘E’s a stiff! Bereft of life, ‘e rests in peace! If you...

[Igor Ljubuncic](https://canonical.com/blog/author/igorljubuncic)

16 June 2023

[### TurtleBot3 OpenCR firmware update from a snap](https://canonical.com/blog/turtlebot3-opencr-firmware-update-from-a-snap)

The TurtleBot3 robot is a standard platform robot in the ROS community, and it’s a reference that Canonical knows well, since we’ve used it in our tutorials. As a matter of...

[gbeuzeboc](https://canonical.com/blog/author/gbeuzeboc)

25 September 2024

[### Creating Snaps on Ubuntu Touch](https://canonical.com/blog/creating-snaps-on-ubuntu-touch)

This article was written in collaboration with Alfred E. Neumayer of the UBports Project. Tablets, phones and current technology’s capabilities are phenomenal. Who would have...

[Aaron Prisk](https://canonical.com/blog/author/aaronprisk)

3 April 2024

[### Managing software in complex network environments: the Snap Store Proxy](https://canonical.com/blog/managing-software-snap-store-proxy)

As enterprises grapple with the evolving landscape of security threats, the need to safeguard internal networks from the broader internet is increasingly important. In...

[Holly Hall](https://canonical.com/blog/author/hollyhall)

15 January 2024
