Currernt config hook implementation scales very badly

XiaoGuo Liu xiaoguo.liu at canonical.com
Tue Feb 14 02:53:47 UTC 2017


Hi,

Today, I just followed the instructions at:

https://github.com/CanonicalLtd/ubuntu-core-docs/blob/master/en/reference/core-configuration.md

to disable ssh. However, I got the error like:

liu-xiao-guo at localhost:~$ sudo snap set core service.ssh.disable=true
error: cannot perform the following tasks:
- Run configure hook of "core" snap (/snap/core/1177/meta/hooks/configure:
62: /snap/core/1177/meta/hooks/configure: systemctl: Permission denied)

Is this a bug? It was tested on Raspberry Pi2 device, and my core system
info is like:

liu-xiao-guo at localhost:~$ snap version
snap    2.23~201702101018.git.979009c~ubuntu16.04.1
snapd   2.23~201702101018.git.979009c~ubuntu16.04.1
series  16

liu-xiao-guo at localhost:~$ snap info core
name:      core
summary:   "snapd runtime environment"
publisher: canonical
description: |
  The core runtime environment for snapd
type:        core
tracking:    edge
installed:   16.04.1 (1177) 68MB -
refreshed:   2017-02-13 04:42:55 +0000 UTC
channels:
  stable:    16.04.1 (893)  67MB -
  candidate: 16.04.1 (1083) 68MB -
  beta:      16.04.1 (1083) 68MB -
  edge:      16.04.1 (1177) 68MB -

Thanks & best regards,
xiaoguo

On Wed, Feb 1, 2017 at 6:31 PM, Oliver Grawert <ogra at ubuntu.com> wrote:

> hi,
>
> after we recently added a config hook [1] to the core snap it is now
> possible to disable ssh if you require [2] ...
>
> there is a long standing request to do the same for syslog for systems
> running from SD card, which is why i looked into trying to extend the
> existing configure script for this, which made me notice some issue...
>
> when you call "snap set core foo=bar", there is no indication at all
> for the script which variable changes a value, neither in the shell
> environment nor in the argument list.
>
> the only way to get your value is to call snapctl for every existing
> variable [3]. since you dont know what specific variable was requested
> to change the only way to reliably write it is to write *all* existing
> variables ...
>
> now, if you package something with a more complex config that you want
> completely handled via snap config this gets ugly very fast... imagine
> something like postfix with can potentially have 100s of config
> options. instead of atomically changing a single option you will
> regenerate the full config from scratch. this takes a lot longer,
> bringing the risk of a completely broken config in case of a power
> loss, beyond resulting an an awful config hook script with a large
> block of "snapctl get" calls at the top.
>
> can we extend the config hook implementation minimally so a "snap set
> core foo=bar" would at least have something like "SNAP_OPTION=foo" in
> the environment that the generating script or binary could read to
> avoid the unnecessary processing or would that break some design
> concept ?
>
> ciao
>         oli
>
> [1] http://bazaar.launchpad.net/~snappy-dev/core-snap/trunk/view/head:/
> hooks/configure
> [2] https://github.com/CanonicalLtd/ubuntu-core-docs/blob/master/en/ref
> erence/core-configuration.md
> [3] https://github.com/snapcore/snapd/wiki/hooks
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/snapcraft
>
>


-- 
XiaoGuo, Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170214/bd08a105/attachment.html>


More information about the Snapcraft mailing list