We are proud to share our first Ubuntu Core release for all our i.MX platforms.
For the impatient
You can download the OS image from here:
The image is a 1GB SD card image that can be restored using zcat and dd under Linux.
~$ zcat ubuntu-core-nitrogen-*.img.gz | sudo dd of=/dev/sdX
For Windows users, please use Alex Page’s USB Image Tool.
What is Ubuntu Core?
Ubuntu Core is a minimalist rendition of Ubuntu. It is a lightweight, transactionally updated OS, where every application is installed confined from others. It is designed to run securely on autonomous machines, devices and other internet-connected digital things.
Compared to a “regular” Ubuntu image, it offers:
- Faster, more reliable and stronger security guarantees for apps and users.
- Atomic transactional upgrades for apps and the OS itself (with roll-back).
- Snaps, a new and simple application packaging system.
- Signature authentication to prove that what’s running is secure.
What are the requirements?
An Ubuntu SSO account is required to create the first user on an Ubuntu Core installation.
- Start by creating an Ubuntu SSO account
- Import an SSH Key into your Ubuntu SSO account on this page.
- Instructions to generate an SSH Key on your computer can be found here.
Once the account is properly created you will be able to login to the image and installing or developing snap packages.
What are snap packages?
As the website puts it, a
- a squashFS filesystem containing your app code and a
snap.yamlfile containing specific metadata. It has a read-only file-system and, once installed, a writable area.
- self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
- confined from the OS and other apps through security mechanisms, but can exchange content and functions controlled by OS policies.
So every piece of software must be bundle into a
snap package. For instance, the entire base OS is packaged inside the
Then the kernel and its firmware and modules are packaged inside a specific
kernel snap. Another mandatory snap package to boot a system is called
gadget which contains bootloader environment to allow to boot the board.
How to build an application?
This will not be covered in this article since the Ubuntu Core website covers the subject very well:
How to build an OS image?
First, we provide all the source code required to build the
kernel snaps to make an image that runs on all our platforms:
As the repository documentation says, it is highly recommended to build from Ubuntu 16.04 or later.
You first need to install the following packages in order to build Ubuntu Core.
~$ sudo apt update ~$ sudo apt install -y build-essential u-boot-tools lzop gcc-arm-linux-gnueabihf ~$ sudo apt install -y snap snapcraft ~$ sudo snap install ubuntu-image
Then the build is pretty straight-forward:
~$ git clone https://github.com/boundarydevices/ubuntu-core.git ~$ cd ubuntu-core ~/ubuntu-core$ make
The output file should be named
Now that you’ve flashed the pre-built (or your own) image, you can start experiencing with the OS.
This section will provide some information we think are important to get started with Ubuntu Core.
- The system will boot then become ready to configure
- The device will display the prompt “Press enter to configure”
- Press enter then select “Start” to begin configuring your network and an administrator account.
- Follow the instructions on the screen, you will be asked to configure your network and enter your Ubuntu SSO credentials.
- At the end of the process, you will see your credentials to access your Ubuntu Core machine.
ssh <Ubuntu SSO user name>@<device IP address>
At this point, the SSH key registered to your Ubuntu SSO account is on the target and you should be able to access the platform without any other credential required.
NOTE: at bootup a network.py warning can appear if your board has a WiFi module. This is a warning telling us the interface is busy, there’s no harm but we are investigating a work-around.
Useful snap commands
The snap tool offers many features, here will be listed the one we used:
listto see the installed packages and their version
user@localhost$ snap list Name Version Rev Developer Notes core 16-2 1267 canonical - nitrogen-gadget 16.04-1 x1 - nitrogen-kernel 4.1.15-1 x1 - snapweb 0.21.2 25 canonical -
infoto learn about a specific snap
user@localhost$ snap info core name: core summary: "snapd runtime environment" publisher: canonical description: | The core runtime environment for snapd type: core tracking: stable installed: 16-2 (1267) 67MB - refreshed: 2017-02-21 09:42:38 +0000 UTC channels: stable: 16-2 (1267) 67MB - candidate: 16-2 (1443) 69MB - beta: 16-2 (1443) 69MB - edge: 16-2 (1491) 69MB -
refreshto update your components
user@localhost$ snap refresh
NOTE: at the time of this writing, the beta (1443) became stable and breaks the boot, a
snap refresh will most likely fail. We are investigating the issue with Canonical.
- You can even change a snap package using
user@localhost$ snap refresh core --edge
changesto learn about the system changes
user@localhost$ snap changes ID Status Spawn Ready Summary 1 Done 2017-03-14T14:43:28Z 2017-03-14T14:48:10Z Initialize system state 2 Doing 2017-03-14T14:56:00Z - Initialize device
installto install a new package (like you would
user@localhost$ snap install bluez
Manage your device remotely
Our image comes with the
snapweb package which allows you to manage your device via a web interface.
Simply visit the
https://<ip of the board>:4201 and should see the following window.
This token needs to be generate by the device, so you need to run the following command via SSH:
user@localhost$ sudo snapweb.generate-token
Then enter the provided token and click on Submit.
You can see above that the web page shows which packages are currently installed.
On the top right corner can be seen a Browse Store button which allows you to see which snap can be installed.
As an example, we will install the
Once installed, it is possible to generate QRCode on the platform as expected:
user@localhost$ sudo su -c "qrcode-terminal 'https://boundarydevives.com' > /dev/tty0"
Setting up a WiFi connection
In order to setup a WiFi connection, you need to first enable the interface by creating a new configuration file:
user@localhost$ sudo vi /etc/network/interfaces.d/wlan0 auto wlan0 iface wlan0 inet dhcp wpa-conf /home/<username>/wireless-setup.conf
Then in your home folder, you create add known SSID to the
user@localhost$ wpa_passphrase <SSID> <passphrase> >> wireless-setup.conf
You now need to reboot and the platform will connect automatically to the listed SSID.
That’s it, this post should be a good introduction to this OS and how to use it on our platforms.
As usual, feel free to leave a comment below, letting us know what is your experience.