Using Ubuntu Core

First steps with Ubuntu Core

In use, the Ubuntu Core environment is much like a vanilla Ubuntu server environment managed remotely via SSH.

To connect to Ubuntu Core, use your Ubuntu SSO username and the Ubuntu Core device IP address, as promoted by Ubuntu Core if it’s connected to a display:

$ ssh <sso-username>@<device-ip-address>

You may need to optionally specifiy the location of the private SSH key linked to the Ubuntu SSO registered public key:

$ ssh -i <path-to-private-key> <sso-username>@<device-ip-address>

The main difference between a classic Ubuntu installation and Ubuntu Core is that Ubuntu Core’s system configuration, package management, and update control is entirely governed by snapd, the snap daemon.

Snap features are comprehensively explained in the Snap documentation, but we’ll cover some basic operations below:

You can list which snaps are installed with snap list:

$ snap list
Name       Version        Rev   Tracking     Publisher   Notes
core20     20             768   latest/beta  canonical✓  base
pc         20-0.4         108   20/beta      canonical✓  gadget
pc-kernel  5.4.0-47.51.1  598   20/beta      canonical✓  kernel
snapd      2.46.1         9279  latest/beta  canonical✓  snapd

The above shows the standard set of snaps in a default Ubuntu Core 20 installation. For more details on what these do, see Snaps in Ubuntu Core.

As Ubuntu Core is a minimal installation, one of the first things you might want to install is a text editor. You can search for snaps using snap find, or the Snap Store. Nano-strict is a good choice because it’s strictly confined, as required for Ubuntu Core, and useful:

$ snap install nano-strict

By default, Ubuntu Core defaults to disabling access to most resources, including writing files to your home directory.

Permissions in snap and Ubuntu Core are handled by interfaces. You can see which interfaces nano-strict needs with the snap connections command:

$ snap connections nano-strict

Interface        Plug                         Slot  Notes
home             nano-strict:home             -     -
removable-media  nano-strict:removable-media  -     -

Connecting the home interface between Ubuntu Core and nano-strict will allow you to save files to your home directory. This is accomplished with the connect command:

$ snap connect nano-strict:home :home
$ snap connections nano-strict
Interface        Plug                         Slot   Notes
home             nano-strict:home             :home  manual
removable-media  nano-strict:removable-media  -      -

After running the above command, you will be able use the nano-strict command to create and edit text files in your home directory!

The :home syntax denotes the home slot on Ubuntu Core. For more information on how to work with interfaces, see Interface management in the snap documentation.

To remove a snap from your system, along with its internal user, system and configuration data, use the remove command:

$ sudo snap remove nano-strict
nano-strict removed

For more information on how to work with snaps, including how to control daemons/servers, how to make data snapshots and how to install specific revisions, see the Snap Documentation .

2 Likes