Switching new channel/risklevel with new plug system-files

Hello together

I’m customizing our gadget snap here, what I want to do is to change a files content, in /etc/iotedge when switching the track of the gadget (by the pre-refresh hook). This folder was created from Azures IoT Edge installer.

Therefore we added a hook into our snapcraft yaml which contains the code, and added the interface / plug for system-files to be able to write there.

Then we builded the snap successfully and uploaded it to our own store (we have a custom / private store), without creating a new version because the revision is anyway counting up automatically.

Now when we try to make a snap refresh like this:
sudo snap refresh ourgadgetsnap --channel=customtrack/beta
or
sudo snap refresh ourgadgetsnap --channel=customtrack/beta --devmode

We get the errormessage:
“Mount snap “ourgadgetsnap” (7) (installation not allowed by “config-refresh” plug rule of interface “system-files”)”

We also tried to do a snap switch first and then make a refresh. I did this because of poppys answer here: Refreshing snaps in --devmode
There he says one should have a new revision:
" You have to remove the snap (losing data) or upload a new revision and switch to that."

I cant remove a gadget snap from installation so my thought was to go for the refresh with
–devmode.

The version of the gadget snap without the hook resp. plug-connection was at risk level edge, the new one were we added the hook resp. plug has risklevel beta.

Any idea how I can switch the gadgetsnap on my test environment with this hook / plug connected so we can test our code?

Thanks for your help!

i guess you first need to have the snap declaration in the store that allows use of system-files at all for the snap …

AFAIK the declarations operate only by snap ID but not by channel or track, so even if your stable chanel doesnt use that interface the declaration needs to be there for the whole of the snaps with that same ID in all of the channels/tracks.

this likely applies to all interfaces that have allow-installation: false in their definition like:

PS: i also moved this post to the store category, so the store team can correct me if needed.

Thanks for your reply ogra

Not sure how to handle this information:
We added the plugs like this in the “root” of the snapcraft definition:

hooks:
  pre-refresh:
    plugs:
      - network
      - config-refresh

plugs:
  config-refresh:
    interface: system-files
    write:
    - /etc/iotedge

Then tried to upload it to the beta channel with our own track. So if this is already in the “root” id of the snap, and the snap itself gets a snap ID, I assume this would be correct related to your input. Or am I missing something?

I placed to request via supportticket today right after posting this to get the allowance for system-file on our gadget snap…

right, what i meant is that you will likely have to wait until this is granted because the interface is allow-installation: false

Do I need a support ticket to get approval or I can set it up in my store?

i think for this you need a support ticket …

1 Like

Nice, thanks :slight_smile: I can even see you are typing lol