Hook's plugs not taken into account on install


I have two snaps that share content through a plug/slot. Snap snap-A is the consumer of snap-B.

Snapcraft YAML file for snap-A contains:

     content: interface
      - network
      - network-bind

snap.A includes a hook called prepare-slot-name that will do some job upon connection, and it needs network and network-bind plugs.

The hook is added through a part and not stored in the snap/hooks-directory.

Snapcraft YAML file for snap-B contains:

    content: interface

and has a hook called connect-plug-name which doesn’t need any plugs.

Snap will auto-connect the snaps if one or the other is already installed in the system, as they’re from the same publisher.

But prepare-slot-name will fail when installing snap-A but only if snap-B is already installed. I see in the journal the following:

SECCOMP auid=4294967295 uid=0 gid=0 ses=4294967295 pid=1346908 comm="gpg-agent" exe="/snap/snap-A/40/usr/bin/gpg-agent" sig=0 arch=c000003e syscall=49 compat=0 ip=0x7f7e467cf13b code=0x50000`

For what I’m aware of is syscall 49 = sys_bind and should be allowed by using the plug network-bind.

However… If I first install snap-A, then snap-B they will auto-connect successfully and complete the installation.

So I’m simply wondering why the hook’s plugs aren’t taken into account on auto-connect, during the installation process of snap.A.

I’ve tried adding the plugs network and network-bind to the install-hook too, as this happens during installation and not manually connected, without any luck.

Any help on this would be highly appreciated. Thank you in advance!

I’ve tried adding network and network-bind to the global plugs too:


No success!

snapctl is-connected network and snapctl is-connected network-bind within prepare-slot-name returns 0 = success.