Getting started

Ubuntu Core is ideal for IoT (Internet of Things) and embedded systems because it manages itself. Whether it’s running on a Raspberry Pi hidden for media streaming, or a Qualcomm DragonBoard tucked away in a garage to handle automation, Ubuntu Core handles application and security updates autonomously.

Ubuntu Core runs on an extensive (and growing) range of hardware, and pre-built images are available for amd64 and Raspberry Pi reference platforms. Installation on a reference platform is easy and a great way to get started with Ubuntu Core, or to explore Ubuntu Core’s features and evaluate its potential.

While Ubuntu Core can operate much like a traditional Ubuntu installation, its installation, management and deployment is directed by its snap foundations, as outlined below.

Note: See Supported platforms for more details on which images are available for which platform, and What is Ubuntu Core for more general details.

Requirements

Alongside enough storage to hold the Ubuntu Core image, installation on a Raspberry Pi also requires a screen and keyboard to navigate a few installation prompts (these aren’t needed post-installation).

Additionally, you will need an Ubuntu SSO account with associated SSH keys. This setup is required because, after Ubuntu Core has been installed, Ubuntu SSO is used to log in to your device. For help generating and importing SSH keys, see the Ubuntu community wiki.

When Ubuntu Core is up and running, if you want to access your device remotely, you’ll need an SSH client for your operating system. Linux and macOS both have clients built-in, whereas Windows users could use Ubuntu on WSL.

Choose a release

Ubuntu Core releases track a corresponding Ubuntu LTS release, and there are currently four supported versions: Ubuntu Core 22 (UC22), Ubuntu Core 20 (UC20), Ubuntu Core 18 (UC18) and Ubuntu Core 16 (UC16).

Ubuntu Core is more than a repackaged version of Ubuntu; Ubuntu Core 20 and 22, for example, offer full-disk encryption (FDE), new recovery modes and Raspberry Pi ARMv7 and ARMv8 support.

Below, we cover installing a reference image of the latest version of Ubuntu Core (UC22) on a Raspberry Pi.

Installation steps

The typical installation procedure for UC22 is as follows:

  1. Download the preferred Ubuntu Core image for your device:
    See Supported platforms for links to device support and images.
    By default, images are compressed with xz and can be expanded with:
    $ xz -d <image-name>.img.xz.
  2. Write the image to your device’s storage medium (eg. SD card for Raspberry Pi):
    We recommend using Raspberry Pi imager for Windows, macOS and Linux. You will need to select Use custom as the operating system, and use the file requester to select the image you just decompressed.
  3. Boot the device from the flashed storage and follow the on-screen prompts:
    This step is version-specific, but the installation typically asks only two questions.

After installation, see Using Ubuntu Core for a quick overview of how to work within the Ubuntu Core environment.

Raspberry Pi installation

To install UC22 on a Raspberry Pi, for example, first download the image for your device from http://cdimage.ubuntu.com/ubuntu-core/22/stable/current/.

Write the Ubuntu Core image to the SD card destined for the Raspberry Pi. As mentioned above, Raspberry Pi imager is a good tool for this.

With the image written to the SD card, connect the Raspberry Pi to a screen and keyboard, insert the SD card and power on the device. After a brief initialisation period, “Press enter to configure” will appear on the display.

Press enter to continue. The display will update to show some Ubuntu Core introductory text and a prompt to set up the network and administrator account. Press tab or cursor down to highlight OK, and press return to move on to the next step.

The next step configures the network connection. The default options will configure the ethernet port to use DHCP to connect to your local network. Use the cursor keys to navigate to the network device and ‘Enter’ to change the configuration, or select ‘Done’ to complete the process and move on to the next step.

Finally, enter the email address for your Ubuntu SSO account. This will link the SSH keys registered on the account to the new device deployment and allow you to connect without any further device configuration. The connection details are shown on the next page, and with each successive reboot, alongside SSH host key fingerprints for the device. You can now connect using SSH with your Ubuntu SSO username and the IP address of the device.

Testing Ubuntu Core with QEMU

You can test Ubuntu Core without specific hardware from within a virtual machine.

To test Ubuntu Core with QEMU (https://www.qemu.org/) on Ubuntu, first install the qemu-kvm package and verify that your system is capable of running hardware-accelerated KVM virtual machines with the kvm-ok command:

$ sudo apt install qemu-kvm
$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
$

To ensure compatibility with the required UEFI features in Ubuntu Core 22, also install the OVMF package:

$ sudo apt install ovmf

The exact command to run will depend on your host hardware capabilities, such as available memory and CPU cores, but the following should work in the majority of cases:

$ qemu-system-x86_64 \
    -enable-kvm \
    -smp 2 \
    -m 1500 \
    -cpu host \
    -netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 \
    -device virtio-net-pci,netdev=mynet0 \
    -drive file=pc.img,format=raw \
    -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on

In the above command, the Ubuntu Core image is called pc.img and we forward the virtual SSH port 22 to port 8022 on the host, and 80 to 8090 for any web server application you wish to install in the VM. To access this configuration from your host machine, type the following:

$ ssh <your key> <SSO identity>@localhost -p 8022

There is a typo on this page , look for

-netdev ser

It should be

-netdev user

BTW any plan to support non UEFI x86_64 devices ?

cc: @lool

Typo fixed, thank you!

1 Like

You’re welcome,

I think there is an other doc page that should be fixed,
It miss the UEFI file arg… or maybe it can just redirect to the reference documentation page.

BTW may I suggest also to add

-cpu host

To prevent this message:

qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]

It works without, but it can be misleading.

cc: @lool

1 Like

It seems the getting started and documentation is no longer correct as snap install nano throws an error.

root@nuc:~# cat /etc/os-release 
NAME="Ubuntu Core"
VERSION="20"
ID=ubuntu-core
PRETTY_NAME="Ubuntu Core 20"
VERSION_ID="20"
HOME_URL="https://snapcraft.io/"
BUG_REPORT_URL="https://bugs.launchpad.net/snappy/"

root@nuc:~# snap list
Name       Version        Rev    Tracking       Publisher   Notes
bluez      5.48-3         284    latest/stable  canonical✓  -
core       16-2.51.3      11420  latest/stable  canonical✓  core
core18     20210722       2128   latest/stable  canonical✓  base
core20     20210702       1081   latest/stable  canonical✓  base
nextcloud  21.0.3snap2    28417  latest/stable  nextcloud✓  -
pc         20-0.4         115    20/stable      canonical✓  gadget
pc-kernel  5.4.0-81.91.1  811    20/stable      canonical✓  kernel
snapd      2.51.3         12704  latest/stable  canonical✓  snapd

root@nuc:~# snap install nano
error: snap "nano" requires classic confinement which is only available on classic systems

root@nuc:~# sudo snap install nano-strict
nano-strict 5.2+pkg-353f from 林博仁(Buo-ren, Lin) (brlin) installed

Thanks for highlighting this issue. This part of the tutorial has moved to Using Ubuntu Core, but we also updated the example to use nano-strict (as your suggested example shows). Thanks!

This page is confusing as it starts off talking about installing on RPi, but switches into a QEMU example that clearly is targeting Intel x86 64.

Should that last SSH command to log into the QEMU session not be connecting to “localhost”?

1 Like

The link entitled “Supported Platforms” actually takes you to “System Requirements”.

You might want to drop UC16 and UC18 from the list of supported releases.

UC16 is supported until 2026, UC18 until 2028 (unlike for classic there is no 5y/10y separaton
of community vs commercial support here), so both are fully supported for a full 10y…

…what is not supported by snapcraft anymore is building snaps for their bases and that should be mentioned…

1 Like

Given that the QEMU page is coming up in the order of pages, I’m not sure it’s worth covering here in any detail at all; just point at the QEMU page.