cannot specify /sys/class/gpio/*/direction with hw-assign

Bug #1493389 reported by Jamie Strandboge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
Status tracked in Trunk
15.04
Fix Released
Critical
Unassigned
Trunk
Fix Released
Critical
Unassigned

Bug Description

This bug is basically the same as bug #1488618 except for a different path.

08:26 < rickspencer3> jdstrand, I noticed that I am getting this error when I try to use certain pins on my bbb
08:26 < rickspencer3> Sep 08 13:25:36 localhost.localdomain ubuntu-core-launcher[1090]: open /sys/class/gpio/gpio44/direction: permission denied

At this point, in snappy/hwaccess.go instead of:
  validPrefixes := []string{"/dev", "/sys/devices", "/sys/class/gpio/export", "/sys/class/gpio/unexport"}

I think we should do:
  validPrefixes := []string{"/dev", "/sys/devices", "/sys/class/gpio"}

unless someone more experienced with gpio programming can enumerate all the paths. I think it is fine to use /sys/class/gpio (or even /sys/class) since it is still the admin adding the access. When this bug is fixed, people would be allowed to do 'sudo snappy hw-assign foo /sys/class/gpio/**' and get on with their dev work. Then they can use oem yaml to be more specific (or the new hw stuff the snappy core team is working on when it comes out).

Workaround until this bug is fixed:
People encountering this can update the profile manually be editing /var/lib/apparmor/profiles/*_<pkgname>_<service/binaryname>_<version> to include this before the last '}':
  /sys/class/gpio/** rw,

Then do:
$ sudo apparmor_parser -r /var/lib/apparmor/profiles/*_<pkgname>_<service/binaryname>_<version>

This change will survive reboots but it will be lost if you reinstall/upgrade the snap or if you use hw-assign after making the change (since it regenerates the profile).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.