System options


#1

The core snap offers a few configuration options which allow customization of how the system works.

A configuration option of the core snap can be set via the snap set command as for any snap:

$ snap set core some.option="some value"

The current value of an option can be retrieved via the snap get command:

$ snap get core some.option

Since snapd 2.32.5 system can be used instead of core in snap get|set commands.

$ snap set system some.option="some value"
$ snap get system some.option

The following configuration options are currently supported:

refresh.timer

Allows defining the refresh schedule within a month. Takes priority over refresh.schedule.

For example, to specify updates only between 4:00-7:00 in the morning and 19:00-22:00 in the evening:

$ sudo snap set core refresh.timer=4:00-7:00,19:00-22:10 
$ sudo snap set system refresh.timer=4:00-7:00,19:00-22:10  # since 2.32.5

Examples of possible refresh timers:

  • mon,10:00,,fri,15:00
    Mondays at 10:00, Fridays at 15:10
  • mon,fri,10:00,15:00
    Mondays at 10:00 and 15:00, Fridays at 10:00 and 15:00
  • mon-wed,fri,9:00-11:00/2
    Monday to Wednesday and on Friday, twice between 9:00 and 11:10
  • mon,9:00~11:00,,wed,22:00~23:00
    Mondays, some time between 9:00 and 11:00, and on Wednesdays, some time between 22:00 and 23:00
  • mon,wed
    Monday and on Wednesday, at 0:00
  • mon2-wed2,23:00-24:00
    Monday through Wednesday on the 2nd week of the month, between 23:00 and 24:00
  • fri5,23:00-01:00
    Last Friday of the month, from 23:00 to 1:00 the next day

Available since snapd 2.31.

refresh.schedule

Allows defining the refresh schedule within a 24h window.

For example, to specify updates only between 4:00-7:00 in the morning and 19:00-22:00 in the evening:

$ sudo snap set core refresh.schedule=4:00-7:00/19:00-21:00
$ sudo snap set system refresh.schedule=4:00-7:00/19:00-21:00  # since 2.32.5

Note that a refresh may happen outside the scheduled window if the last refresh happened too far behind.

Available since snapd 2.25.

refresh.metered

Control over refreshes when system’s default connection is metered, eg. a LTE link with a limited data plan. Note that the proper detection requires NetworkManager to be available. Refresh is allowed on such connections by default.

To hold refreshing snaps when on a metered connection:

$ sudo snap set system refresh.metered=hold

To allow refreshing:

$ sudo snap set system refresh.metered=null

Available since 2.33.

refresh.retain

Control over the maximum number of revisions of a snap that should be kept on the system. Defaults to 3. Cannot currently be set lower than 2.

Available since 2.34.

proxy.{http,https,ftp}

These options may be set to change the proxies to be used by the system when communicating with external sites that speak the respective protocols.

Available since snapd 2.28.

service.ssh.disable

May be set to true for disabling the SSH service at startup.

Available since snapd 2.22.

system.power-key-action

Defines the behavior of the system when the power key is pressed.

May be set to one of:

  • ignore
  • poweroff
  • reboot
  • halt
  • kexec
  • suspend
  • hibernate
  • hybrid-sleep
  • lock

Available since snapd 2.23.

pi-config

Changes various settings that land onto Rasperry Pi’s traditional config.txt file.

The following options are currently available for tuning:

  • pi-config.disable-overscan
  • pi-config.framebuffer-width
  • pi-config.framebuffer-height
  • pi-config.framebuffer-depth
  • pi-config.framebuffer-ignore_alpha
  • pi-config.overscan-left
  • pi-config.overscan-right
  • pi-config.overscan-top
  • pi-config.overscan-bottom
  • pi-config.overscan-scale
  • pi-config.display-rotate
  • pi-config.hdmi-group
  • pi-config.hdmi-mode
  • pi-config.hdmi-drive
  • pi-config.avoid-warnings
  • pi-config.gpu-mem-256
  • pi-config.gpu-mem-512
  • pi-config.gpu-mem

Please see the Raspberry Pi documentation for details on their meanings.


Disabling automatic refresh for snap from store
Special casing the core configuration
Refresh-schedule via core config
Using the forum to host documentation
Disabling automatic refresh for snap from store
Documentation outline
Launcher items disappear and reappear on refresh
Released: snapd 2.23.6
#2

I’ve transformed the post into a wiki, reformatted the options to be a bit more readable, and fixed them so that they use dashes instead of underscores which is what’s supported.

@mvo Hopefully I’m not mistaken about your intent here.


#3

It would be great if we can get all these added to https://docs.ubuntu.com/core/en/reference/core-configuration which also has an explanatory description of each available option.

Also why do we have device specific options on the core snap? What does happen if I set pi-config.disable-overscan on a device not a pi? Will I see default values for those?


#4

i guess long term that should move to the gadget snaps … and we are still missing a lot of options that will make users still edit the file by hand.


#5

@morphis This page should be removed and link here instead. This is a pattern we should try to replicate with other pages in the documentation. We’ll have many more contributing eyes here, and everyone is able to immediately fix broken documentation, take feedback, and improve it right then.

@davidcalle Can you help us with that?

@ogra Before we move this out of core, we need to have a better picture of how gadget updates are taking care of boot assets, etc. We don’t want to hand off control of these sensitive configuration files before we do that as depending on how we do these updates we might brick devices in the field. Note that having it in core already allows gadgets to tune these options nevertheless.


#6

yup, fully agreed, but what will the migration path for vendors that start using this in their images today be ?
if we move it later we somehow need to move their products too, to not break them with a core update that suddenly does not have that feature anymore …


#7

There’s no reason for us to break the support in core.


#9

Included refresh.schedule and transformed it into something more prosaic.


#10

What time zone is refresh.schedule in? I would have assumed the system time zone, but snap changes for example shows timestamps in UTC.


#11

The proposed implementation is using system’s local time.