RFC: Snappy shell

Loïc Minier loic.minier at ubuntu.com
Mon Jun 15 15:50:11 UTC 2015

User experience

When you SSH into a Snappy system, you currently end up on a shell prompt.
Wouldn’t it be great to actually land in Snappy itself?

Welcome to Snappy Ubuntu Core 15.04


How do I get started?

snappy# help


 <command> [<arg>...]

Available commands

 booted              Flag that rootfs booted successfully

 build               Builds a snap package (aliases: bu)

 config              Set configuration for an installed package.

[... edited for brievety...]

 shell               Start a shell

 update              Update all installed parts

 versions            (deprecated) please use "list"

Simple commands like install, update etc. work as expected:

snappy# info

release: ubuntu-core/15.04/stable

architecture: amd64

frameworks: webdm


snappy# list -v

Name          Date       Version Developer

ubuntu-core   2015-06-11 3       ubuntu*

webdm         2015-06-11 0.9     *

generic-amd64 2015-06-11 1.1.1   *

We should revisit some commands or aliases to have a friendlier, more
rewarding user experience, e.g. update could provide some output when no
update is available and entering a shell command like ls would hint at
using help:

snappy# update

System is up-to-date!

snappy# ls

No such command; “help” for a list of commands

Configuration is only possible for snaps that have the required hook and
may be set manually by key or globally from an URL, and of course immutable
configs can’t be changed.

snappy# config

(config)# list

Name           Date       Version Developer

ubuntu-core    2015-06-11 3       ubuntu

config-example 2015-06-15 1.0.6   canonical

webdm          2015-06-11 0.9

(config)# config xkcd-webserver

No config found for this snap

(config)# config ubuntu-core

(ubuntu-core)# show

autopilot: true

timezone: Etc/UTC

hostname: localhost.localdomain

(ubuntu-core)# set autopilot false

Config set

(ubuntu-core)# exit

snappy# config config-example set -u

Config set

A new shell command is provided to start the default user’s interactive
shell or to run commands ( under “sh -c”).

Goals of snappy shell


   Deliver a slick console user experience as found when SSH-ing (or
   telnet-ing) into network equipments such as switches, routers, firewalls

   Allows restricting access to the shell while allowing for useful
   features such as update, install etc. (could be controlled by a new
   allowed-cli-commands ubuntu-core config or similar)

   Smoothes transition into a Comfy world where the regular rootfs becomes
   smaller and smaller.


This user experience would be delivered by the main “snappy” binary when
it’s launched as “snappy-cli” as the basename of argv[0]. If this feature
is not enabled by default, or from a shell, you would run “snappy cli” to
start an interactive snappy shell session. NB: cli is to avoid confusion
with the shell command to run a command or an interactive shell.

SSH integration could be done in multiple ways:


   integrate a SSH server in snappy itself; I don’t know how hard this is
   in go today; this might be a worthwhile exercise long-term to get a smaller

   configure SSH server and login to always start /bin/snappy-cli instead
   of the user’s shell, then lookup the user’s shell in the passwd database
   to run the preferred shell with “snappy shell”

   (preferred) configure the user’s shell to /bin/snappy-cli and create a
   new snappy-only ubuntu-core config for the preferred interactive shell
   (defaults to /bin/bash); drawback: this would be system-wide as we don’t
   have per-user configs

Questions? Comments? Pile on at:

Loïc Minier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snappy-devel/attachments/20150615/769ccb38/attachment-0001.html>

More information about the snappy-devel mailing list