I'm using Beaglebone Black c, with Ubuntu 18.04.3 LTS running on a 16gb sd card.
I have a python script which uses the Adafruit_BBIO.GPIO module.
This script runs just fine when it is launched manually.
I want this script to run automatically when BBB boots.
So I created a systemd service for that.
The service runs the script, however, it encounters permission errors:
Code: Select all
Sep 04 10:40:34 arm python[2506]: Adafruit_BBIO: gpio_export: 66 couldn't write "/sys/class/gpio/export": 1-Operation not permitted
Sep 04 10:40:34 arm python[2506]: Adafruit_BBIO: gpio_set_direction(): 66 couldn't open '/sys/class/gpio/gpio66/direction': 2-No such file or directory
Code: Select all
GPIO.setup("P8_7", GPIO.OUT)
Mainly, I tried to change the /sys/class/gpio/export (and others) permission with chmod or chgrp - nothing worked.
This is my service:
Code: Select all
[Unit]
Description="bringup beaglebone_upstart"
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/beaglebone_upstart-start
WorkingDirectory=/home/ubuntu
[Install]
WantedBy=multi-user.target
Again - this works fine when launched manually with roslaunch... or with python <script.py>.
Does anyone has an idea how to solve it?
Thank you!