Embedded Linux development on Ubuntu – Part I

This article was last updated 2 years ago.


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.

Several reasons justify why Linux is developers’ #1 choice for embedded applications, from being open-source and scalable to hardware support and tooling.

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. 

The target devices of your embedded Linux project will likely connect to the internet, with their attack surface increasing due to the network exposure. Intruders may thus attempt to exploit eventual bugs remotely, and the frequency of the updates will increase due to security issues. 

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. 

Snaps enable every device to be software-defined. Every embedded Linux device running snaps is app-enabled: its main function is an app, and developers can ship other apps next to that primary function.

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 solve the update problem for embedded Linux devices regardless of fleet scale. Devices running Ubuntu deliver packages through snaps – a secure, confined, dependency-free, cross-platform Linux packaging system – which enable automated and transactional updates that are only installed if successful.

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. 

Final considerations

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.

Are you evaluating Ubuntu Linux for your embedded device?

Get in touch

Further reading

Why is Linux the OS of choice for embedded systems? Check out the official guide to Linux for embedded applications in whitepaper or webinar form.

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.

smart start

IoT as a service

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.

Get your IoT device to market fast ›

smart start logo

IoT app store

Build a platform ecosystem for connected devices to unlock new avenues for revenue generation. Get a secure, hosted and managed multi-tenant app store for your IoT devices.

Build your IoT app ecosystem ›

Newsletter signup

Get the latest Ubuntu news and updates in your inbox.

By submitting this form, I confirm that I have read and agree to Canonical's Privacy Policy.

Related posts

Advantech RSB-3810, a new Single Board Computer powered by MediaTek Genio 1200, is now certified on Ubuntu 22.04 LTS

Discover this new hardware solution designed for IoT and edge applications Canonical has partnered with MediaTek to optimise Ubuntu for IoT innovations and...

Optimised Real-time Ubuntu is now generally available on Intel SoCs

Canonical delivers Real-time Ubuntu on Intel Core processors with TSN and Intel TCC support London, 26 July 2023: Canonical today announced the availability...

Canonical announces public beta of optimized Ubuntu image for Qualcomm IoT platforms

Today Canonical, the publisher of Ubuntu, and Qualcomm® Technologies announce the official beta launch of the very first optimized image of  Ubuntu for...