First steps with Ubuntu Core

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

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

You can list which snaps are installed on your Ubuntu Core system with snap list:

$ snap list
Name       Version         Rev    Tracking       Publisher   Notes
core22     20230801        864    latest/stable  canonical✓  base
pc         22-0.3          146    22/stable      canonical✓  gadget
pc-kernel  5.15.0-86.96.1  1433   22/stable      canonical✓  kernel
snapd      2.60.3          20092  latest/stable  canonical✓  snapd

The above shows the standard (and initial) set of snaps in a default Ubuntu Core 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 consult 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 snap connect command:

snap connect nano-strict:home :home

after which you can verify that you are connected to your home directory:

$ 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 snap remove command (add the --purge option to avoid making a snapshot of the snap’s data):

$ snap remove [--purge] 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 .

4 Likes

Installing nano-strict already has the :home interface connection, but I don’t want to tweak that until someone else verifies that the user does not have to set that connection manually.

I’ve just tested this, and the :home connection is not set by default.

:home is explicitly never connected by default on UC …

1 Like

Thanks for this. I’ll make a more prominent note for this on the home interface docs page.

Since there is a How-to page on testing with QEMU, perhaps a short explanation (or link) on how to connect to a QEMU session; AIUI, you’d just ssh to a given port at localhost.

Update page to UC22?

When I install nano-strict, it appears that the home interface is now auto-connect. Please confirm and update page.

Hi All,

I am new to this discourse and thanks for including me in the community.
I am trying to install ubuntu core on a plain vm using MAAS and it is not simple as it depends on various factors which are not documented. Can you share hands-on documentation of ubuntu core on a qemu vm for reference ?

Hello, and welcome to the community!

We do have a guide to running an Ubuntu Core image with QEMU:

Let us know if you can’t get this to work, of if you need extra information.

Good luck!

I just tried this on a local fresh UC22 install, and it still requires the connection to be made manually.

The home interface doc does say the interface isn’t auto-connected on UC systems, but it was good to check and make sure this doc remains current.

@degville

Well I was following the same guide to install ubuntu core 22 on a VM and the installation is successful.

Now I am trying to enable microk8s on the same without any success. I have created a separate topic for the same