Have I misunderstood https://snapcraft.io/docs/interface-hooks?

By my reading, connect-plug-<plugname> should run once an interface has connected.

But in the specific case of ubuntu-frame’s graphics-core20 plug this doesn’t happen. (Nothing I put in the connect-plug-graphics-core20 hook ever runs.)

Hi Alan,

I think that your understanding is correct (but I’m not an expert on snapd, so I might be wrong as well). Some hints for debugging:

  1. Check that the snap really has the hook in /snap/ubuntu-frame/current/meta/hooks, with execute permissions.
  2. See what snapd says while you connect the plug. You could see snapd logs with these commands:
    sudo systemctl set-environment SNAPD_DEBUG=1
    sudo systemctl restart snapd.service
    sudo journalctl -f -u snapd

(you should see a message like “Run hook…” for every executed hook)

  1. Run snap changes, followed by snap tasks <change-id> where change-id is the number of the change corresponding to the connection setup.

Please share any interesting findings :slight_smile:

$ ls -lh /snap/ubuntu-frame/current/meta/hooks

total 20K
-rwxrwxr-x 1 alan alan 3.1K Jun 15 15:33 configure
-rwxrwxr-x 1 alan alan 3.2K Jul  6 17:07 connect-plug-graphics-core20
-rwxrwxr-x 1 alan alan  365 Jun  9  2021 install
-rwxrwxr-x 1 alan alan  365 Jun  9  2021 post-refresh
-rwxrwxr-x 1 alan alan  187 Jun 24  2021 prepare-plug-graphics-core20
Jul 06 17:09:46 octopull-PROX15-20 snapd[550584]: taskrunner.go:439: DEBUG: Running task 73972 on Do: Connect ubuntu-frame:graphics-core20 to kisak-core20:graphics-core20
Jul 06 17:09:46 octopull-PROX15-20 snapd[550584]: taskrunner.go:439: DEBUG: Running task 73974 on Do: Run hook connect-plug-graphics-core20 of snap "ubuntu-frame"
Jul 06 17:09:46 octopull-PROX15-20 snapd[550584]: daemon.go:217: DEBUG: pid=550780;uid=0;socket=/run/snapd-snap.socket; POST /v2/snapctl 285.901µs 200
Jul 06 17:09:46 octopull-PROX15-20 snapd[550584]: daemon.go:217: DEBUG: pid=550786;uid=0;socket=/run/snapd-snap.socket; POST /v2/snapctl 521.19µs 200
Jul 06 17:09:46 octopull-PROX15-20 snapd[550584]: daemon.go:217: DEBUG: pid=550808;uid=0;socket=/run/snapd-snap.socket; POST /v2/snapctl 254.073µs 200
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: taskrunner.go:439: DEBUG: Running task 73975 on Do: disable of [ubuntu-frame.daemon]
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: task.go:343: DEBUG: 2022-07-06T17:09:47+01:00 INFO task ignored
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: taskrunner.go:439: DEBUG: Running task 73976 on Do: stop of [ubuntu-frame.daemon]
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: task.go:343: DEBUG: 2022-07-06T17:09:47+01:00 INFO task ignored
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: taskrunner.go:439: DEBUG: Running task 73977 on Do: Run service command "stop" for services ["daemon"] of snap "ubuntu-frame"
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: services.go:756: DEBUG: StopServices called for ["ubuntu-frame.daemon"]
Jul 06 17:09:47 octopull-PROX15-20 snapd[550584]: daemon.go:217: DEBUG: pid=550813;uid=0;socket=/run/snapd-snap.socket; POST /v2/snapctl 924.383762ms 200

So I do see “Run hook connect-plug-graphics-core20”…

And if I change it to “exit 1” the connect fails. So something must be going wrong inside the hook.

Thanks @mardy, I am now looking for the problem in the right place.

1 Like