The snapd-control interface

The snapd-control interface enables snap management, such as snap installation, removal and refresh-control by communicating with the snapd daemon.

Due to its ability to permit the installation any snap at potentially any confinement level, snapd-control is primarily intended to be used by brand store owners as they will typically already have full access to their devices.

Consequently, consumers of this interface require approval for distribution via the Snap Store, and this approval is only likely to be given under strict and specific circumstances.

Interface documentation:

See Interface management and Supported interfaces for further details on how interfaces are used.


Developer details

Auto-connect: no
Super-privileged: yes

Attributes :

  • refresh-schedule (plug): can be set to managed to signal an intention to permit only manual refreshes for the snap:

    plugs:
        snapd:
            interface: snapd-control
            refresh-schedule: managed
    

    Permitting only manual refreshes is a 3 stage process with the above being the first stage. The second stage is to connect the interface, effectively granting permission for refresh management while the third is to set the following core system setting:

    sudo snap set system refresh.timer=managed 
    

    The last step activates the manual-only refresh option, skipping upcoming refresh attempts. These values are rechecked and reconfirmed before every future refresh attempt. If any of the steps stop being true, the snap refresh proceeds.

Code examples

The source code can be found in the snapd repository: snapd/interfaces/builtin/snapd_control.go at master · canonical/snapd · GitHub

The test code for the interface is in the snapd repository: snapd/interfaces/builtin/snapd_control_test.go at master · canonical/snapd · GitHub

Hi @degville,

It seems like sudo snap set core refresh.schedule=managed was deprecated and should only be used with versions of snapd older than 2.31 as mentioned here => https://snapcraft.io/docs/keeping-snaps-up-to-date#heading--controlling-updates

It needs to be replaced with snap set system refresh.timer="managed"

Thanks, Bugra

With snapd-2.5, you now have “snap refresh --hold” to put an indefinite hold on refreshes. Not sure where that should be covered.

Hi @degville,

We are mentioning about the disablement of auto-updates in the snapd-control interface definition page which makes it harder to understand for most of the developers.

I would suggest moving this section to Managing updates | Snapcraft documentation page and add a section which defines how to disable auto-updates for the devices that are using Ubuntu Core. Maybe, we could also have this page within ubuntu-core docs. Also, we must mention that refresh.timer=managed configuration only works with snaps that have assertion files as well as the interface configuration described above. Otherwise, the developers might see errors like;

(Run configure hook of "core" snap) failed: run hook "configure": cannot set schedule to managed

Thanks, Bugra

Hi @bugraaydogar - sorry for the long delay on this. I added the note about the assertions, but do you still think something on disabling auto-updates would still be valuable (especially for core)?