Using Ubuntu Core

Ubuntu Core is designed for IoT and embedded environments, from a single device to a factory deployment of thousands. But it's also a great platform for experimentation and project building.

For more details on which platforms are supported, and for links to installation guides, see Supported platforms.

Accessing an Ubuntu Core system

Access to a self-deployed Ubuntu Core system is via the networking configuration and SSH key linked to the Ubuntu SSO account used to set up the system.

If you have a display connected to your device, it will display the account and IP address, alongside host key fingerprints, upon successful boot:

Ubuntu Core 20 on 10.0.2.15 (tty1)
The host key fingerprints are:

    RSA     SHA256:PaSE+kKJLKSDREKJeiKLKJeJ3JKLKJEEKJ
    ECDSA   SHA256:wIKSDFLKsdlkfsjDFSdfujsdf83kljSDdD
    ED25519 SHA256:7JSDFSDkdsS3KJKSDsdflkfSDFLJKDSs39

To login:

    ssh <sso-id>@10.0.2.15

Personalize your account at https://login.ubuntu.com.

By default, you can only access your deployed Ubuntu Core system from SSH, and not physically from the device itself. See System user for details on how to create a system user with local login on systems that allow _classi_confinement (notably, not Ubuntu Core 20).

User environment

The Ubuntu Core user environment operates much like a traditional Ubuntu environment with the exception that you can only install and configure your system through snap packages.

To see which snap packages are installed, type snap list:

$ snap list
Name       Version               Rev   Tracking     Publisher   Notes                                                                            
core20     20                    634   latest/edge  canonical✓  base                                                                             
pc         20-0.4                101   20/beta      canonical✓  gadget                                                                           
pc-kernel  5.4.0-31.35           502   20/beta      canonical✓  kernel                                                                           
snapd      2.45+git396.g5c3995e  7790  latest/edge  canonical✓  snapd

See Snaps in Ubuntu Core for more details on what these snaps do and how they're used.

To install a new snap package, type snap install <snap-name>:

$ snap install nextcloud
nextcloud 18.0.4snap1 from Nextcloud✓ installed

Use the remove argument to remove a snap.

Snap documentation: to learn more about how snaps work, and how to use, see the Snap documentation.

Configuring a snap

You can view and set specific configuration options for a snap with the get and set commands:

$ snap get nextcloud
Key        Value
mode       production
nextcloud  {...}
php        {...}
ports      {...}
private    {...}

$ snap get nextcloud ports
Key          Value
ports.http   80
ports.https  443

$ sudo snap set nextcloud ports.http=81

Setting snap options: for more details on setting snap-specific options, see Managing snap configuration.

Managing a snap service or daemon

If a snap provides one or more services, they can be listed with the services command:

snap services nextcloud
Service                    Startup  Current  Notes
nextcloud.apache           enabled  active   -
nextcloud.mdns-publisher   enabled  active   -
nextcloud.mysql            enabled  active   -
nextcloud.nextcloud-cron   enabled  active   -
nextcloud.nextcloud-fixer  enabled  active   -
nextcloud.php-fpm          enabled  active   -
nextcloud.redis-server     enabled  active   -
nextcloud.renew-certs      enabled  active   -

Use start and stop to control whether a service is running:

$ snap stop nextcloud.apache
Stopped.

To prevent a service from starting on the next boot, use the --disable option:

$ snap stop --disable nextcloud.apache

The inverse of the above is start --enable to start a service and enable it at boot time:

$ snap start --enable nextcloud.apache

Accessing logs

If you need to see the log output for a snap’s services, use the logs command:

$ snap logs nextcloud
2020-05-14T10:50:57Z systemd[1]: Stopping Service for snap application nextcloud.apache...
2020-05-14T10:50:57Z nextcloud.apache[49131]: No certificates are active: using HTTP only

Adding the -f option will keep log output open so you can follow new entries as they occur:

$ sudo snap logs nextcloud -f

Service management: for more details on starting and stopping services, see Service management.

© 2020 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.