Welcome to this three-part mini-series on embedded Linux development on Ubuntu.
Throughout this series, we will discuss the key challenges of traditional software distribution mechanisms for embedded Linux devices. We will understand why legacy development and update approaches do not suit the Internet-of-Things (IoT) world and assess how Ubuntu simplifies and secures embedded Linux development.
Although you don’t need prerequisite knowledge to follow this series, we recommend you have a basic understanding of the role played by Linux in the embedded portion of the compute spectrum. If you are new to the space and just getting started from scratch, get an intro to embedded Linux or delve into the official guide to Linux for embedded applications.
What you can expect from this series
Three elements lie at the heart of all embedded Linux devices running Ubuntu: snaps, snapcraft and Ubuntu Core. We will narrate the story of embedded Linux development with Ubuntu by gradually introducing those three concepts in Part I, Part II and Part III, respectively.
Here you are in Part I, at the beginning of the journey. We will start with the basics and offer a quick refresh of the pain point of discovering, developing and deploying new software for embedded Linux devices. Having set the stage, we will introduce a new Linux packaging format fit for IoT and embedded environments. In Part I, we will understand how Snap packaging secures embedded Linux development by confining applications and bundling them with their dependencies.
In Part II, we will explain how Snapcraft, the command and framework to build and publish snaps, simplifies embedded Linux development. And finally, we will introduce Ubuntu Core, Ubuntu for IoT and embedded environments, and study its relation to snaps and Snapcraft in Part III.
With so much to cover, let’s dive straight into Part I.
Traditional embedded Linux development
Delivering software for embedded Linux devices has traditionally been problematic.
The proliferation of a format per distribution in standard Linux packaging, whether a Slackware package, a DEB or an RPM for embedded environments or otherwise, means developers have to learn them all to reach a wider audience. Embedded Linux development is as painful as discovering new software. It often means hunting down PPAs, grabbing packages via command-line tools like rpm, apt and pktools, or building from source instructions. Furthermore, handcrafted packages often require complex code to manage installation and updates, are incompatible with each other, have unmet dependencies or may write all over the filesystem.
To solve the challenge of installed libraries having dependencies on specific software package versions, users often obtain newer or older versions of the dependent packages. This may break compatibility further, pushing the problem to another set of packages.
An equally painful story holds for updates. Because those packages are not transactional, software update strategies are mostly a manual, non-atomic package-based operation.
Whereas an apt-get update works fine for servers within a secure environment, intermittent power and network outages for devices in the field mean an update will likely be interrupted. Delivering reliable software updates to low-powered, inaccessible, and often remotely administered embedded devices requires a well-thought-out solution. With traditional mechanisms, faulty updates can cause IoT devices to become unstable, and fixing them requires costly manual intervention through on-site engineer visits or device recalls.
Embedded Linux development with snaps
Snaps were born to ease the pain points of embedded Linux developers looking for a secure environment and configuration to run their applications. Also, snaps allow software publishers to control the shipped binary and the exact version available to their users
Snaps are a new application packaging format that uses container technology. Snaps work anywhere, including all major Linux distributions, and are suitable for any class of devices, from desktop to cloud and IoT. As cross-platform, containerised software packages, snaps bundle applications with their dependencies.
Compared to traditional Linux software distribution and containerised packages, snaps are easy to create, build and deploy. Snap packaging was built from the ground up with security in mind, making them safer to run: embedded Linux development with snaps is secured because snaps undergo a rigorous review process before being published. By confining applications, the address book of a home appliance will not access the camera unless permitted, and the game on an embedded device will not reach into a bitcoin wallet and steal any cryptocurrencies that may be left.
Updates for embedded Linux development
Snaps automatically update over the air and using deltas, keeping the functionality of an embedded Linux device always fresh and without risk of breaking. When doing embedded Linux development, users can schedule updates for specific maintenance windows and keep them timely by only sending the delta.
With snaps comes reliability, as transactional updates make updating software worry-free. Should an update have unforeseen bugs or break the already deployed software, the system would automatically roll back to its last stable state. Failing health checks trigger the rollback of an updated snap, and admins can effortlessly audit these transactions from any machine.
Snaps provide for robust app rollouts: canary updates enable targeting a set of systems for initial testing, whereas phased updates allow throttling updates to smaller fractions of devices.
Transactional updates, airtight security, and compatibility across architectures and operating systems make snaps a perfect solution for embedded Linux development.
Snaps are app packages for embedded devices that are easy to install, secure, cross‐platform and dependency‐free. Snaps simplify installs for embedded Linux devices to a single standard command by bundling dependencies and assets.
With the necessary context behind snaps in mind, head over to Part II, where we will discuss how Snapcraft eases embedded Linux development.
Interested in a detailed comparison of Yocto and Ubuntu Core? Watch the Yocto or Ubuntu Core for your embedded Linux project? webinar.
Did you hear the news? Real-time Ubuntu 22.04 LTS Ubuntu is now available. Check out the latest webinar on real-time Linux to find out more.
Do you have a question, feedback, or news worth sharing? Join the conversation on IoT Discourse to discuss everything related to the Internet of Things and tightly connected, embedded devices.
Bring an IoT device to market fast. Focus on your apps, we handle the rest. Canonical offers hardware bring up, app integration, knowledge transfer and engineering support to get your first device to market. App store and security updates guaranteed.