GPIO export problem

I’m running Debian 10 on my Beaglebone Blue (uname -a output: Linux beaglebone 4.19.94-ti-rt-r59 #1buster SMP PREEMPT RT Mon Feb 8 19:17:21 UTC 2021 armv7l GNU/Linux)

I’m having a strange problem with the GPIO sysfs. I’d like to turn on the servo power, so I am exporting gpio80. The problem is that it won’t stay exported – the /sys/class/gpio/gpio80 directory vanishes and reappears without apparent cause after I have exported it. dmesg contains no useful information. Any suggestions for where to hunt down the cause of this problem?

As I recall, doing a second export will cause the exported interface to go away. Yep…

Any chance you exported a second time?

For example, if I run ‘watch ls /sys/class/gpio’, it switches back and forth between no gpios exported; 5, 65, and 105 exported; 5, 65, 80, and 105 exported; and finally just 80 exported (desired state). Is there any logging I might be able to use to hunt down what’s causing it?

It toggles on and off – i.e. if I run ‘ls /sys/class/gpio’ repeatedly while do no other actions, /sys/class/gpio/gpio80 disappears and reappears at irregular intervals.

Also, the bug you reference is years old… is there any plan to fix it?

Derp, figured it out once I tailed /var/log/daemon.log. I had a zombie user level systemctl service that was repeatedly poking /sys/class/gpio/export.

Can you share what sort of systemctl service was running? Why it was running? How did it get there? Is it on all systems perhaps?