Installing Ubuntu Core 20 on a Raspberry Pi

Ubuntu Core runs on a large 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 quickly get started with Ubuntu Core, or to explore Ubuntu Core’s features and evaluate its potential.

Below, we cover how to install a reference image of the latest version of Ubuntu Core, UC20, on a Raspberry Pi 2, 3 or 4. It’s easy to do and requires no previous Ubuntu Core experience.

At the end of this tutorial, you’ll be able to connect to your Raspberry Pi, install and configure applications, safe in the knowledge that Ubuntu Core will automatically keep your device updated and secure.


Ubuntu Core 20 on other platforms:

Installation is very similar across each supported Ubuntu Core 20 device. See Supported platforms for a list of which images are available for which platforms.

Requirements

This tutorial is suitable for anyone with an interest in Ubuntu Core - no prior knowledge necessary, but you will need a few things first:

  • A Raspberry Pi model 2, 3, or 4.
  • A macOs, Windows or Linux computer with a microSD card reader.
  • 4GB+ microSD card (this will be erased, so make sure it’s backed up).
    As Raspberry Pi 2 uses larger SD cards, we’ll assume it’s using an SD card adaptor with a microSD card.
  • Connected screen and keyboard for installation.
  • An Ubuntu SSO account with associated SSH keys.

Alongside enough storage to hold the Ubuntu Core image, you will need a screen and keyboard connected to the Raspberry Pi. These are needed to navigate a few installation prompts, but neither are needed after setup has completed.

An Ubuntu SSO account is also required because it’s used to mediate a connection to your Raspberry Pi after installation. It does this with SSH, and that’s why you also need an SSH key associated with your Ubuntu SSO account. For help importing SSH keys to your Ubuntu SSO account, see the Ubuntu community wiki.

After 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 can use Ubuntu on WSL.

Step 1: Write the image to a microSD card

We’re going to use the Raspberry Pi Foundation’s Raspberry Pi Imager to write the Ubuntu Core image to the microSD card. Raspberry Pi Imager both downloads and safely installs an image to your microSD card.

Download and install Raspberry Pi Imager from one of the following locations:

After its installed and running, you will see its main window showing buttons for the three step download and write process:

Raspberry Pi Imager

  1. Select Choose OS and a pop-up list appears. Now select Other general purpose OS followed by Ubuntu and finally either Ubuntu Core 20 RPi 2/3/4 or Ubuntu Core 20 RPi 3/4. Select the latter for the later devices.

image

  1. Select Choose Storage and insert your microSD if you haven’t already. Now select the device from the list.

image

  1. Finally, select Write. A warning will state that all data on your selected device will be erased, so it’s worth double checking your selection was correct. Select Yes if you’re sure. You may then be asked for your password before the download, write and verification processes begin.

When the process has finished, Raspberry Pi Imager will proclaim “Write Successful” and you can remove the card from the reader. It’s now ready to be inserted into your Raspberry Pi.

Step 2: Boot Ubuntu Core for the first time

You can now insert the microSD card (or SD card for Raspberry Pi 2 users) into your powered-off Raspberry Pi and power-on the device.

From this point, it can take around five minutes for the system to instantiate itself. You will see typical Linux output on the screen, periods where there’s just a flashing cursor, and messages like Installing the system, please wait for a reboot. When this process has finished, you will see the following:

Press enter to configure.

Press Enter and you will see a small menu with a single item:

Configure the network and setup an administrator account on this all-snap Ubuntu Core system.

Press Enter again and you will be taken to the network setup page:

Step 3: Configure a network connection

Network access is a requirement for Ubuntu Core, at least initially, and you have a choice about whether to use a wired connection (Ethernet) or Wi-Fi, if your Raspberry Pi supports it.

Wi-Fi (recommended)

This is the most common option. If you have a device with Wi-Fi capabilities, such as a Raspberry Pi 3 or 4, it will appear as a separate network device called wlan0 beneath any Ethernet devices.

To configure Wi-Fi, press the cursor up key until wlan0 is selected and press Enter. You will see a small menu and you need to select Edit Wifi.

After selecting Edit Wifi, you will see the network interface configuration panel for Wi-Fi. If you know the name of the Wi-Fi network you wish to connect to, it can be entered directly, or cursor down to Choose a visible network and select a network from a list of those that have been detected.

Finally, enter the Wi-Fi password and select Save to complete the configuration. You will be returned to the previous menu and your device will attempt to connect to the network. If successful, you will see its IP address to the right of DHCPv4.

For advanced network configuration, such as setting a static IP address, select the wlan0 device again, and choose edit IPv4 from the menu.

When you’ve finished configuring your network settings, select Done and press enter on the Network connections page to move on to the final step.

Ethernet

If an Ethernet cable is connected to your device, a network connection will attempt to be automatically negotiated and, if this is successful, you will see an IP address for the device after the DHCPv4 entry in the Network connections page. In this case, you don’t need to do anything further:

To configure an Ethernet connection manually, select the eth0 device and select Edit IPv4 from the small menu that appears. By default, the network device will be configured to use Automatic (DHCP), which is why the connection attempts to automatically configure itself. Press Enter to reveal two further options, Manual and Disabled:

Selecting Manual will allow you to configure your Ethernet connection manually by entering values for your subnet mask value (using CIDR xx.xx.xx.xx/yy notation), the static IP address of your device, the network gateway, and the name servers you wish to use:

Select Save to apply those changes and for the connection to be attempted. You can now proceed to the next step by pressing Done.

Step 4: Add Ubuntu SSO details

This is the final step before completing the Ubuntu Core setup and you simply need to enter the email address linked to your Ubuntu SSH account.

As mentioned earlier, your account is used to link its registered SSH keys to the new device deployment and allow you to connect without any further device configuration.

With your username registered across the network, you will see a message similar to the following:

This device is registered to <ubuntu-sso-email-address>

Remote access was authenticated with SSO user <username>.
Public SSH keys were added to the device for remote access.

<ubuntu-sso-email-address> can connect remotely to this device via SSH:

ssh <username>@<ip-address>

Everything is now configured and you’re ready to connect to the device.

Step 5: Connect to the device

Each time the device starts up, if a display connected it will show its various addresses and the account linked to the device:

image

You can now connect to your Ubuntu Core machine with the ssh command and your username followed by the IP address of your device:

$ ssh account@10.0.2.15
The authenticity of host '10.0.2.15 (10.0.2.15)' can't be established.
ECDSA key fingerprint is SHA256:EiZUZG50l1Dvr1/aR940EX/lKW4qLfkRiMaMFwuzuf8
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.0.2.15' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1042-raspi aarch64)
[...]

As shown above, the first time you connect to a new device you will be asked to accept its authenticity. You can check the ECDSA key fingerprint against the finger print shown on the screen after a first reboot. ECDSA is the second one listed.

Congratulations! You have successfully downloaded, installed, and connected to Ubuntu Core 20 on your Raspberry Pi. See First steps with Ubuntu Core for an introduction to using your new Ubuntu Core installation.

1 Like

Typo in the command line

-netdev ser,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 \

Should be:

-netdev user,id=mynet0,hostfwd=tcp::8022-:22,hostfwd=tcp::8090-:80 \
1 Like

good spot - I’ve just fixed it. Thank you!

What do we do if we connect to the ssh key and it asks for a password?

how to install ubuntu core on a Raspberry Pi when I don’t have a monitor/keyboard pair connected to it?

Thanks!