Auto connect of plug-slot not happening despite entry in gadget.yaml

I have in my gadget.yaml an entry to connect my snap’s network-control and network-observe plugs, But despite this, these connections are not happening automatically when the device boots or I refresh my gadget snap.

Snippet (gadget.yaml):

         # My snap
       - plug: <my snap id>:network-observe
         slot: <snapd id>:network-observe
         # My snap
       - plug: <my snap id>:network-control
         slot: <snapd id>:network-control

Snippet(My snap):

plugs: [network-control, network-observe]

Snippet(snap connections ):

network-control <my snap>:network-control - -
network-observe <my snap>:network-observe - -

Anything wrong in my gadget.yaml?

both are system provided interfaces and as such do not need a slot declaration (similar to snap connect where you do not need to define core:network-control (or system:network-control) as target slot) …

also note that the gadget checks interface availability against the snap declaration from the store so the snap in the store needs to have these interfaces.

i.e. you need to have uploaded it with them.
adding an interface to a local build of a snap when this is not known by the store version yet and sideloading this local snap from ubuntu-image wont work …


My bad. I should I have mentioned that my snap is from store.

One interesting thing is auto connection happening when I build full image with ubuntu-image
But when I start with a old gadget and my snap on device and then do a snap refresh for both, auto connections do not happen.

did you reboot after the refresh ?

It looks like you’ve got stray dashes at the start of the slot: lines. Try removing those, but keeping the indentation, like:

- plug: <snap1>:network-observe
  slot: <snap2>:network-observe

You want one item in the list with both plug and slot keys, rather that two items in the list with one key each.

Yes, restarted. But no still auto connection.

Made a typo while pasting here. But actual gadget.yaml is in the format that you mentioned here.

1 Like

Any other suggestions?