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:
This image has been updated (20180404) with the following changes:
- Update kernel to 4.9.x revision
- Update bootscript to read core/kernel version dynamically
- Update core to revision 4330
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 oflag=sync
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 snap
is:
- a squashFS filesystem containing your app code and a
snap.yaml
file 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 core
snap.
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 gadget
and 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 --classic --edge
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 ubuntu-core-nitrogen-stable-yyyymmdd.img.gz
.
Getting started
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.
First Boot
- 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:
- Use
list
to see the installed packages and their version
user@localhost$ snap list Name Version Rev Tracking Developer Notes core 16-2.32.1 4330 stable canonical core nitrogen-gadget 16.04-1 1 stable boundary gadget nitrogen-kernel 4.9.x-1 1 stable boundary kernel snapweb 0.26-11 323 stable canonical -
- Use
info
to learn about a specific snap
user@localhost$ snap info core name: core summary: snapd runtime environment publisher: canonical contact: snappy-canonical-storeaccount@canonical.com license: unknown description: | The core runtime environment for snapd type: core snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776 tracking: stable refreshed: 2018-03-26T19:58:36Z installed: 16-2.32.1 (4330) 72MB core channels: stable: 16-2.31.2 (4209) 72MB - candidate: 16-2.32.1 (4330) 72MB - beta: 16-2.32.2 (4380) 76MB - edge: 16-2.32.2+git652.8634405 (4402) 76MB -
- Use
refresh
to 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
refresh
user@localhost$ snap refresh core --edge
- Use
changes
to 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
- Use
install
to install a new package (like you wouldapt install
)
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 qrcode-terminal
application.
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 wireless-setup.conf
file.
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.
Comments 15
I connect a nitrogen6w with the image to a regular PC monitor through HDMI cable. When booting up I see only uboot message and then went black. No other display is attached. Any quick help? Thanks!
Author
Hi,
What U-Boot version are you using? Please make sure it is a 2016.03.
https://boundarydevice.wpengine.com/display-configuration-u-boot/
Regards,
Gary
Hi Gary,
I updated to your latest uboot.
Here is the console log. Could you please take a look what was wrong?
U-Boot 2017.03-26086-g7b229e4 (Mar 29 2017 – 14:58:49 -0700), Build: jenkins-uboot_v2017.03-14
…
mount: mounting /tmpmnt_writable/system-data/var/lib/snapd/snaps/core_1267.snap on /root failed: No such file or directory
…
Author
Hi,
Can you confirm that the prebuilt image works?
The problem with your image is that the ubuntu-image tool has updated the core version (not 1267 any more) and this new version is known to fail currently.
This is being investigated by Canonical, we’ll let you know once it is fixed.
That is why, in the meantime, we recommend using the prebuilt image (not refreshing the core snap).
Regards,
Gary
Do you mean this “For the Impatient” image (ubuntu-core-nitrogen-20170314.img.gz)? It looks like it has the same problem:
…
mount: mounting /tmpmnt_writable/system-data/var/lib/snapd/snaps/core_1267.snap on /root failed: No such file or directory
…
Author
Hi,
Sorry there was indeed an issue with the prebuilt image. It has now been updated, using the latest core available.
Let us know if you have any issue with this one.
Finally, please don’t copy your log here directly but instead copy to a pastebin-like website and send us the link.
Regards,
Gary
Thanks, Gary, I am able to boot to an UI that leads me to configure the board. However, after entered email address, I got another error and can’t proceed.
Creating user failed
Error: while creating user: cannot communicate with server: Post
http://localhost/v2/creat-user: EOF
Though I have Ubuntu One account and have valid wifi/ethernet connection. Wondering why is “localhost”??
Author
Hi,
This is strange, it worked here. Is there any firewall or other restrictions on your network?
Can you reflash the sd card and try again plus disabling all the firewalls?
Regards,
Gary
Is there any update on the
Creating user failed
Error: while creating user: cannot communicate with server: Post
http://localhost/v2/creat-user: EOF
error?
I am having the same error.
Does this image support the SOM V2? I get the following error booting up. Looking at the dtb directory it does not include a kernel blob from SOM2.
reading /nitrogen-kernel_x1.snap/dtbs/imx6qp-nitrogen6_som2.dtb
** Unable to read file /nitrogen-kernel_x1.snap/dtbs/imx6qp-nitrogen6_som2.dtb **
load mmc 0:1 0x13000000 /nitrogen-kernel_x1.snap/dtbs/imx6qp-nitrogen6_som2.dtb
!!!! Error loading /nitrogen-kernel_x1.snap/dtbs/imx6qp-nitrogen6_som2.dtb
Author
Hi,
Yes indeed it was missing support for the SOM2. A fix has been pushed:
https://github.com/boundarydevices/ubuntu-core/commit/385682a3
Regards,
Gary
When booting up, I am stuck in the Profile setup. When logging into the Email account,
Creating User failed:
error: while creating user: cannot communicate with server: Post http://localhost/v2/create-user: EOF
This is strange as in the same network works fine when configuring the dragonboard410c with ubuntu core
Strangely, it was solved by swapping the SDcard.
Although swapping the SDcard solves the problem of the profile setup,
The same EOF error appears when using snap commands such as
$ snap find hello
Hi,
We uploaded a new image with stable core up to date, please try this one.
Regards