Rpi4 - Persist ownership and permissions of /dev/gpiomem

i want to run scripts with my default (non root) user using the GPIOs from my Raspberry Pi 4.

I've done some research on the forum and found this helpful post:
Everything works fine, except of -> after reboot/restart ownership and permission of /dev/gpiomem are reset back to root only.
When i logout and log back in the permissions and so on are correct.
Only on reboot the issue occurs.

My workaround for this issue was to add an autostart systemd service according to this post:

Now, on system startup/reboot ownership and permissions of /dev/gpiomem are fine.
But my question is:
Is this the right way to do it? Or what is the correct way? Cause my way is not persisting ownership and permissions - it is reset it to the values i want on every reboot...

OS-Type is 64bit
Raspberry Pi 4
Output of uname -r:

Looks good to me.

ok - thanks :blush:

I think that an udev rule could be another solution :
First you should always create a dedicated group

sudo groupadd gpio
sudo usermod -a -G gpio your_user_name

Then create a file in /etc/udev/rules.d , i.e. 10-gpio.rules


This topic was automatically closed after 90 days. New replies are no longer allowed.

Forum kindly sponsored by