Ubuntu Core is a lightweight, transactionally updated Ubuntu edition specifically designed for Internet of Things (IoT) devices. Its minimal footprint and strictly enforced security make it an ideal choice for Raspberry Pi-based IoT projects.
In this comprehensive guide, I‘ll walk you through the entire process of setting up Ubuntu Core on a Raspberry Pi. We‘ll cover:
- Ubuntu Core features and benefits
- Required hardware and components
- Configuring networking and creating an Ubuntu One account
- Downloading and flashing the OS image
- Initial setup and SSH access
- Managing snaps and applications
- Customization options
- Troubleshooting common issues
So if you‘re looking to build secure IoT solutions with a Raspberry Pi and Ubuntu Core, you‘re in the right place. Let‘s get started!
Overview of Ubuntu Core
Before we dive into the installation process, let me briefly introduce some key features that make Ubuntu Core unique:
-
Strictly Confined Apps: All software runs as snaps – containerized applications isolated from the core OS and from each other. This enhances reliability and security.
-
Atomic Updates: The OS and applications update transactionally as a unit, reducing corruption issues. Rollbacks are also available as a failsafe.
-
Small Footprint: Ubuntu Core has a minimal footprint ranging from 260MB (Raspberry Pi) to 75MB (virtual machines), maximizing storage for applications.
-
Managed Lifecycle: Each Ubuntu Core release receives 10 years of security coverage, maintenance and updates.
In summary, Ubuntu Core gives you an extremely robust foundation for building IoT products on the Raspberry Pi platform. You get the flexibility of snaps along with enterprise-grade stability and security.
Hardware Needed
To install Ubuntu Core on a Raspberry Pi, you will need:
- A Raspberry Pi 2, 3 or 4
- MicroSD card with 8GB or more of storage
- 5V micro USB power supply
- HDMI monitor and cable
- USB keyboard/mouse
- Ethernet cable or WiFi dongle
For initial setup, it‘s easiest if you connect the Raspberry Pi to a monitor, keyboard and internet connection. Once Ubuntu Core is up and running, you can switch to wireless connections and SSH in headlessly.
Optional items like a case, heatsinks and cameras can be added later as needed by your projects.
Step 1 – Create Ubuntu One Account
Ubuntu Core integrates authentication and authorization via your Ubuntu One account. So the first step is to visit https://login.ubuntu.com and create a free Ubuntu One account if you don‘t already have one.
Make note of your login email and password as you will need them during Ubuntu Core setup.
Step 2 – Download Ubuntu Core
With account creation done, now you can get the correct Ubuntu Core image for your Raspberry Pi model:
Raspberry Pi 2:
https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/ubuntu-core-20-pi2.img.xz
Raspberry Pi 3:
https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/ubuntu-core-20-pi3.img.xz
Raspberry Pi 4:
https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/ubuntu-core-20-pi4.img.xz
The file you download should have a .img.xz extension. Make sure to select the specific version matching your Raspberry Pi hardware.
Note: Ubuntu Core images are about 100MB compressed and 550MB when decompressed.
Step 3 – Flash Ubuntu Core Image
With the compressed OS image downloaded, the next step is "flashing" it onto a microSD card to create a bootable Ubuntu Core installation medium.
This requires imaging software that can handle the .img.xz format. On Linux and macOS, I recommend using Etcher. On Windows, Rufus has XZ support built-in.
The imaging process will decompress and write Ubuntu Core directly to your memory card, making it a bootable drive for your Raspberry Pi. Insert your card, select the image, choose your media and flash.
Be careful to select the correct target drive to avoid accidentally overwriting your hard disk. Once imaging completes, eject the media properly before removing it. You now have Ubuntu Core on an SD card, ready for first boot!
Step 4 – Initial Network Setup
With flashed card in hand, you can now set up your Raspberry Pi. Insert the SD card, connect ethernet / USB power / HDMI monitor and turn it on. Ubuntu Core will immediately start booting.
After about a minute you should be greeted by the Ubuntu Core first-run configuration screen. It will automatically attempt DHCP networking configuration, so make sure your ethernet cable or WiFi dongle is plugged in.
Using the keyboard, select OK to begin setup. Ubuntu Core will now fetch an IP address and connectivity details from your local network. If successful, write down the shown IP address for later reference.
If network configuration fails or gets stuck, verify physical connections and review router settings. For WiFi, double check SSID and passphrase entered earlier. Contact your network admin if issues persist.
With interfaces up, Ubuntu Core will next prompt you for account credentials. Enter the email address associated with your Ubuntu One account created earlier along with password.
After signing in successfully, reboot to complete the process and start using your Raspberry Pi with Ubuntu Core!
Step 5 – SSH Access & Usage
Once restarted, your Raspberry Pi will boot directly into Ubuntu Core. Unlike desktop Ubuntu, there is no graphical interface or concept of "logging in". Everything is managed remotely via SSH command line by default.
From another system on the same network, initialize secure shell access using the IP address displayed earlier:
ssh <ubuntuone-email>@<core-ip>
For example:
ssh john@192.168.1.100
You may need to type yes and hit enter to accept the host fingerprint initially. After signing in over SSH, you now have full access to start using Ubuntu Core!
The SSH interface landing page displays useful details like memory consumption (~250MB), Ubuntu version (20+), installed snaps and more.
Here are some useful commands to get started:
sudo snap list– List installed snapssudo snap install <package>– Install apps/servicessudo reboot– Reboot the device
By default Ubuntu Core includes essential utility packages like network tools along with a strict AppArmor security profile limiting all software behavior.
You now have a hardened Ubuntu base to start building IoT applications! Let‘s look at managing snaps next.
Working with Snaps
Snaps are containerized software packages that act as fundamental building blocks on Ubuntu Core. They isolate applications from the OS and each other, enhancing security. Some key advantages:
-
Automatic Updates – Snaps refresh in the background providing continuous delivery of the latest fixes and features.
-
Dependency Management – The bundle includes all required libraries; no need for complex system-level upgrades.
-
Strict Confinement – Apps are sandboxed via AppArmor, mitigating tampering and exploitation risks.
-
Transactional Rollbacks – Failed snap updates automatically roll back to previous working state.
Snaps are available for a wide range of applications like Docker, Chromium, Node.js, Jenkins and much more. Many popular development frameworks have snap distributions allowing you to focus on your use case code.
Finding Snaps
There are couple places to browse and search available snap packages:
snapcraft.io – Official community site with descriptions, versions and publisher information.
Ubuntu Store – Features screenshots, ratings and reviews. Great for exploring popular snaps.
For example, you can snap install classics like Python and GCC for coding or lightweight tools like Neovim and Tig as an IDE stack.
Installing Snaps
Once you‘ve identified an app to snap install, using sudo run:
sudo snap install <snap-name>
After downloading and unpacking data, the service will start automatically in the background. Check status with:
sudo snap list <snap-name>
Most snaps also install GUI desktop interfaces. While Ubuntu Core itself does not have local display support, these will become available on layered products like Ubuntu Server or IoT.
Managing Versions
You can track branch changes by channel:
sudo snap switch <pkg> --channel=<branch>
Then refresh to pull new releases:
sudo snap refresh <pkg>
Downgrades are also possible by reverting to older revisions:
sudo snap revert <pkg>
Using channels and revisions gives you precise control over your runtime environment.
Customization Options
Ubuntu Core‘s read-only firmware partitions enhance security and stability by default. But for flexibility in building solutions, Ubuntu Core also offers both system and application level customization.
Read/Write Filesystem Layouts
While OTA Updates require A/B root filesystems, Ubuntu Core‘s strict separation of OS and applications enables additional filesystem strategies like read/write bundles withFactory Reset options.
Some use cases for bundled writable areas:
- Persisting application data across updates
- Adding dynamic libraries or symlinks
- Overlaying configuration files
You can bundle these using the writable-paths snap declaration.
Interface Connections
Interfaces allow controlled communication between snaps and system resources like:
- Network
- Graphics
- GPIO
- Serial Ports
- Desktop interfaces
- PulseAudio
- OpenGL
- Kubernetes
- Docker
- …and more.
Connections define how data can be shared following the principle of least privilege. This maintains isolation while still enabling snaps to function together when required.
Snapcraft Plugins
The snapcraft build framework offers multiple mechanisms for customizing snaps:
- Wrap parts of an existing project
- Extend confinement with trusted helpers
- Bundle device drivers
- Auto-update scripts
- Kernel modules
- Specialized IoT hardware logic
- And more…
In summary, while Ubuntu Core guarantees base integrity, there are still many avenues for tailoring solutions to your specific needs.
Troubleshooting Ubuntu Core
Hopefully everything works smoothly getting Ubuntu Core running on your Raspberry Pi! But if you run into any issues, here is some guidance around common trouble areas:
Network Troubles
Can‘t obtain an IP address or connect to networks? Verify cables are properly plugged in and router has DHCP enabled. For WiFi, double check SSID and passwords entered into Ubuntu Core during OOBE match your access point configurations.
Still having problems? Boot into recovery mode and use the netplan tool to inspect and rewrite networking profiles.
Account Sign-in Failures
Double check your Ubuntu One credentials work properly at https://login.ubuntu.com. Make sure to enter the email address specifically used during account creation.
If you previously added 2FA, try using one of your application passwords instead of regular account password during Ubuntu Core login.
Snap Install Failing
Some snaps require enabled interfaces to operate properly. Refer to the specific snap page details on what permissions to grant. For example, the docker runtime snap needs the following:
sudo snap connect docker:daemon-support :docker-support docker:firewall-control :firewall-control docker:home :home docker:shutdown :shutdown docker:system-observe :system-observe docker:network :network docker:network-bind docker:network-status docker :process-control docker:kernel-module-control :kernel-module-control docker:hardware-observe :hardware-observe
GPU/Video Output
Since Ubuntu Core itself has no graphics stack, getting HDMI functioning requires an additional supporting snap installing relevant drivers and libraries. Refer to RPi documentation on suggested video core and Ubuntu Core graphics snap combinations.
Network Services Not Working
AppArmor security policies enforced on snaps disable all network services listening on 0.0.0.0 by default. To expose a port, define and attach a custom AppArmor profile using network-listener declarations.
Final Thoughts
Installing Ubuntu Core on a Raspberry Pi opens up exciting possibilities for experimenting with strict, secure IoT solutions. But it does require some learning around its declarative model and underlying technologies.
I hope walking through this full setup guide provided useful insight into getting started with Ubuntu Core, key features that set it apart and customization options available.
Of course there is still more to explore like building your own snaps, integration with cloud services, remote device management capabilities and over-the-air updates.
So use your freshly installed platform as a springboard for learning and take your Raspberry Pi projects to the next level with the robust foundations of Ubuntu Core!


