OpenSprinkler, Rpi GPIO access

Trying to debug an issue with raspberry pi, docker(balena) container, gpio access.

Specifically I am working with the opensprinkler, v1.4.3

In the opensprinkler gpio.cpp module there is a gpio function that I believe is failing (see log files bellow). I have edited the logs for clarity but in the full output you would see ....(-0800) failed to open gpio running ad infinitum (again and again).

The balena.io docs talk about it here, at least I believe thats the case based on the gpio.cpp functions references to the /sys/…

I made sure cap_add: - SYS_RAWIO is in my docker-compose file, are there any other suggestions for how the OpenSprinkler compiled firmware access to GPIO from within the (balena) container?


Here is my project repo: <https://github.com/kanr/balena-opensprinkler>

Here are the relevant log files


10.11.18 10:43:02 (-0800) Installed service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:02 (-0800) Starting service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:05 (-0800) Failed to start service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b' due to '(HTTP code 500) server error - linux runtime spec devices: error gathering device information while adding custom device "/sys": not a device node '

10.11.18 10:43:05 (-0800) Downloading image 'registry2.balena-cloud.com/v2/4f73ca428f5742058cac697a0b2e66ad@sha256:5c78037509be02cafe751a81fa8f02f81dee22dbb9ffcfedfb966de5b222fb07'

10.11.18 10:43:06 (-0800) Installing service 'opensprinkler registry2.balena-cloud.com/v2/4f73ca428f5742058cac697a0b2e66ad@sha256:5c78037509be02cafe751a81fa8f02f81dee22dbb9ffcfedfb966de5b222fb07'

10.11.18 10:43:06 (-0800) Failed to install service 'opensprinkler registry2.balena-cloud.com/v2/4f73ca428f5742058cac697a0b2e66ad@sha256:5c78037509be02cafe751a81fa8f02f81dee22dbb9ffcfedfb966de5b222fb07' due to '(HTTP code 404) no such container - No such image: registry2.balena-cloud.com/v2/4f73ca428f5742058cac697a0b2e66ad@sha256:5c78037509be02cafe751a81fa8f02f81dee22dbb9ffcfedfb966de5b222fb07 '

10.11.18 10:43:07 (-0800) Downloaded image 'registry2.balena-cloud.com/v2/4f73ca428f5742058cac697a0b2e66ad@sha256:5c78037509be02cafe751a81fa8f02f81dee22dbb9ffcfedfb966de5b222fb07'

10.11.18 10:43:37 (-0800) Installing service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:38 (-0800) Installed service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:38 (-0800) Starting service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) Started service 'opensprinkler sha256:f3bcbe5c422995917c8b48660e91987695a9ab17d9e03fa89964bf915d14a76b'

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open gpio edge for writing

10.11.18 10:43:40 (-0800) failed to open gpio value for reading

10.11.18 10:43:40 (-0800) failed to open export for writing

10.11.18 10:43:40 (-0800) failed to open gpio

10.11.18 10:43:40 (-0800) /OpenSprinkler/

10.11.18 10:43:41 (-0800) resetting options...network established.

10.11.18 10:43:41 (-0800) failed to open gpio

10.11.18 10:43:41 (-0800) weather server ip:port - 54.191.103.237:80

UPDATE:

I fixed it by adding a couple more things to my dockerfile.

    privileged: true
    labels:
      io.resin.features.kernel-modules: '1'

Everything now builds correctly, I am moving on to physical testing.

thanks, and I will keep this thread updated when I confirm everything is working. I would be happy to do a write up if there is interest and you can help me confirm what the issue was.

I know that the opensprinkler firmware is using the sysfs kernel module, so was the issue that I needed to enable kernel-modules?