Help with an i2c issue Sensor Init failed ->Error: EACCES: permission denied, open '/dev/i2c-1'

Hi All,
I’m a newbie in Dietpi and the linux environment. I am persisting through a few configuration issues to learn this world as its blown me away with the possibilities and level of development.
So… I am trying to get a BME280 sensor working in Node-Red on Raspi W Zero. But have what appears to be a user permission error in node red debug terminal;

'Sensor Init failed ->Error: EACCES: permission denied, open '/dev/i2c-1'

The reason I am posting in the Dietpi forum is that I had this exact issue;
https://www.raspberrypi.org/forums/viewtopic.php?t=228084 which may be a bug in the Dietpi…??

And now my i2c device appears on bus 1 0x077 when viewed with i2ctools.

root@DietPi:~# root@DietPi:~#  i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
root@DietPi:~#

But after numerous restarts I still get this error in node red.

'Sensor Init failed ->Error: EACCES: permission denied, open '/dev/i2c-1'

I have read through a few forums that have got me very close but I think my issue is a permission… The node’s page suggests I look at this page to configure i2c access, but I can’t see any information, at least it’s not near the surface…
This is the contents of my rules file;

(sudo nano /lib/udev/rules.d/60-i2c-tools.rules)

SUBSYSTEM=="i2c-dev",
KERNEL=='i2c-0"        , GROUP="i2c", MODE='0666"
KERNEL=='i2c-[1-9]*"  , GROUP="i2c", MODE='0666"

Is 666 even correct?

I’m unsure where to look next. Any ideas would be appreciated.

ls -l /dev/i2c*

returns

root@DietPi:~# ls -l /dev/i2c*
crw-rw---- 1 root i2c 89, 1 Nov 21 06:00 /dev/i2c-1

Which seems correct to me…

NastySpill
Please check: cat /etc/udev/rules.d/99-com.rules
It should contain: SUBSYSTEM==“i2c-dev”, GROUP=“i2c”, MODE=“0660”
This means all members of group i2c have full R/W access to the I2C devices.

Hence: usermod -aG i2c nodered

Since Node-RED is commonly used for this, I’ll add this step to our install script.

Done: https://github.com/MichaIng/DietPi/commit/6460c27ba51a42b5d71ebaae4c7291184cf777b7
Changelog: https://github.com/MichaIng/DietPi/commit/3918b9713f4cddfccd5ea179f9934f58c545154f

Yes that line is present;

root@DietPi:~# cat /etc/udev/rules.d/99-com.rules
SUBSYSTEM=="input", GROUP="input", MODE="0660"
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
SUBSYSTEM=="argon-*", GROUP="video", MODE="0660"
SUBSYSTEM=="rpivid-*", GROUP="video", MODE="0660"

SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
        chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
        chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
        chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
'"

KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
        ALIASES=/proc/device-tree/aliases; \
        if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
                echo 0;\
        elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
                echo 1; \
        else \
                exit 1; \
        fi\
'", SYMLINK+="serial%c"

KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
        ALIASES=/proc/device-tree/aliases; \
        if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
                echo 0; \
        elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
                echo 1; \
        else \
                exit 1; \
        fi \
'", SYMLINK+="serial%c"
root@DietPi:~#