8

I've been looking into how to set up Ubuntu Core (the IoT version of Ubuntu) on a Raspberry Pi, and I've read about gadget snaps, which the documentation says is intended to define the device features:

The gadget snap is responsible for defining and manipulating the system properties which are specific to one or more devices that will usually look similar to one another from an implementation perspective.

What's the motivation for having a gadget snap? Can the information not be obtained through normal system features such as lshw, or is there another reason for this (perhaps security or a more declarative environment)?

The reason I ask is because if I wished to use Ubuntu Core on a different device, the pre-defined gadget snaps won't be suitable, but I'm unsure why I even need a gadget snap in the first place.

7

According to developer.ubuntu.com, there are basically two purposes:

- Declare hardware capabilities to the system

Quoting from Ubuntu Documentation:

The gadget snap is responsible for defining and manipulating the system properties which are specific to one or more devices that will usually look similar to one another from an implementation perspective. This snap must necessarily be produced and signed by the device brand, which is defined via the model assertion. The brand knows where and how that device will be used, and designs the gadget snap accordingly.

For example, the brand may know that the device is actually a special VM to be used on a particular cloud, or it may know that it is going to be manufactured in a particular factory. The gadget snap may encode the mechanisms for device initialization - key generation and identity certification - as well as particular processes for the lifecycle of the device, such as factory resets. It is perfectly possible for different models to share a gadget snap.

- Pre-allow access to snaps that need to use this hardware

Also from the Ubuntu Documentation:

The optional prepare-device hook is a script that will be called on the gadget at the start of the device initialization process, after the gadget snap has been installed. The hook will also be called if this process is retried later from scratch in case of initialization failures.

The device initialization process is for example responsible of setting the serial identification of the device through an exchange with a device service. The prepare-device hook can for example redirect this exchange and dynamically set options relevant to it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.