Snap enable failure

It looks like that doing a disable/enable on a snap with gpio plugs fails on enable: gpio are not exported before security profiles update.

If gpio is exported manually before snap enable, issue is not seen: sudo echo 192 > /sys/class/gpio/export

vtinelli@fe014e5031585858581367183b0483df:~$ snap disable private-snap
private-snap disabled

vtinelli@fe014e5031585858581367183b0483df:~$ snap enable private-snap
error: cannot perform the following tasks:

  • Setup snap “private-snap” (x1) security profiles (cannot setup apparmor for snap “private-snap”: cannot obtain apparmor specification for snap “private-snap”: lstat /sys/class/gpio/gpio192: no such file o
    r directory)
  • Setup snap “private-snap” (x1) security profiles (cannot obtain apparmor specification for snap “private-snap”: lstat /sys/class/gpio/gpio192: no such file or directory)

I had the same result when disabling then enabling a snap that uses gpio interface (pi3).

@ogra?

As i understand it the gpio interface should do that call itself from a line in the snaps systemd unit:

sounds like an issue with that interface or the ordering of bits that are executed during dis/enable … @jdstrand any ideas ?

I think I grok the issue now. Let me think about a possible fix.

EDIT: I sent a proposed fix to https://github.com/snapcore/snapd/pull/5721

1 Like