One of the requests we get from integrators is to allow to update assets in the gadget snap. The gadget snap is currently updated (like any other snap).
I propose we add a new yaml key under “content” that allows to specify “auto-refresh: true” as an opt-in. If snapd finds content with this option it will copy those files from the gadget snap to the target filesystem if the files are different.
There is also the idea of adding more semantic descriptions for this.
well, depends with regard to that specific bug … on a pi install you might manually modify things like config.txt or cmdline.txt for specific system related bits (fixed HDMI resolution etc), blindly overwriting such files seems like a bad idea in that case.
we could allow a file blacklist “never-touch: […]”
add a checksum test, update only if the file is original (but then we should notify the user)
or we actually parse the file and carry changes over
in general it seems like a good plan for all bootloader binaries though.
A short status update for those who are interested.
There is a bunch of open pull requests, some with reviews. The whole end-to-end update is functional, but still lives in a branch within my snapd fork. What works/status:
update of filesystem structures
dropping new files at the right mount point
optionally preserving explicitly listed entries
update of bare structures
completely replace the content of bare structure
only modified content is updated
gadget assets update is followed by a reboot
failure to deploy the contents (be it filesystem or raw images) does a complete rollback, so the update does not stay half applied
there is no undo of boot assets installation
Limitations:
structures need to be named in order to be found during update
using name: <foo> or filesystem-label: <foo>
bare structures need to have a partition entry
eg. the update will not be able to identify a structure of type bare (or legacy mbr)
there are possible options to mitigate this, eg. look at other structures from the volume, assume writable is on the same device or have an explicit configuration entry with device name
I would be wary of any heuristics in identifying the device/partition
Open questions:
handling of update when it is removed in subsequent revision of gadget YAML
device is at rev 1, say rev 2 has a structure with update field, so gadget assets update is applied, but then update is dropped in rev 3 (@mvo@pedronis maybe we should have a chat about this)
do we need to reboot after updating gadget assets
Bonus:
a tool to generate images, dubbed snap-image (strawman)
takes a prepared rootfs (snap prepare-image), volume name and any additional partitions and creates a bootable image
Great information about gadget update mechanism, in order to let more people know / howto, I’ve edited the doc for the gadget about asset updates feature by adding new section after content:
Can you review the yaml syntax to make sure my understanding is correct or not?
Thanks.