I am somewhat of a newbie, so please let me know if there is a way I can go about this better.

I'm working on doing some LED coding (WS8201 strip) with node.js and it appears I am having trouble accessing /dev/mem. I have spent hours on this and tried pretty much every I can find regarding permission issues. (here, here, here, and many other places)

My issue is regarding this tutorial. During the install section I am receiving the following error regarding permission.

cat >/etc/udev/rules.d/20-gpiomem.rules <<EOF
SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="gpio", MODE="0660"
-bash: /etc/udev/rules.d/20-gpiomem.rules: Permission denied`

I went ahead and tried running some test code anyways and received the following error.

bcm2835_init: Unable to open /dev/mem: Permission denied
return bindfunc(optarg);
Error: Could not initialize bcm2835 GPIO library` 

I am unsure if these errors are directly related or what to do from here since I've tinkered with permission settings for hours and nothing seems to work. I appreciate the help and please let me know if there is additional information needed!

Thank you

  • I can't help with java BUT /dev/mem requires root permission - for compiled c code this can be managed but python requires programs to be run with sudo. pigpio has access, but I do not know if helps with java. /dev/gpiomem provides access to members of group gpio
    – Milliways
    Oct 7, 2018 at 3:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.