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

**URL:** https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610
**Category:** Troubleshooting
**Created:** [21 November 2019 22:17 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610 "2019-11-21T22:17:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![NastySpill](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/a4c791/32.png) [@NastySpill](https://dietpi.com/forum/u/NastySpill)
#### Post date: [21 November 2019 22:17 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610/1 "2019-11-21T22:17:09Z")

</div>

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;

```nohighlight
'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](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.

```nohighlight
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.

```nohighlight
'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](https://www.npmjs.com/package/node-red-contrib-bme280) suggests I look at [this page](https://github.com/fivdi/i2c-bus) 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)

```nohighlight
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.

---

<div class="post-metadata">

### Author: ![NastySpill](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/a4c791/32.png) [@NastySpill](https://dietpi.com/forum/u/NastySpill)
#### Post date: [21 November 2019 22:21 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610/2 "2019-11-21T22:21:45Z")

</div>

```nohighlight
ls -l /dev/i2c*

```

returns

```nohighlight
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…

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [22 November 2019 16:33 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610/3 "2019-11-22T16:33:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [22 November 2019 17:08 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610/4 "2019-11-22T17:08:13Z")

</div>

Done: [https://github.com/MichaIng/DietPi/commit/6460c27ba51a42b5d71ebaae4c7291184cf777b7](https://github.com/MichaIng/DietPi/commit/6460c27ba51a42b5d71ebaae4c7291184cf777b7)  
Changelog: [https://github.com/MichaIng/DietPi/commit/3918b9713f4cddfccd5ea179f9934f58c545154f](https://github.com/MichaIng/DietPi/commit/3918b9713f4cddfccd5ea179f9934f58c545154f)

---

<div class="post-metadata">

### Author: ![NastySpill](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/n/a4c791/32.png) [@NastySpill](https://dietpi.com/forum/u/NastySpill)
#### Post date: [25 November 2019 03:32 UTC](https://dietpi.com/forum/t/help-with-an-i2c-issue-sensor-init-failed-error-eacces-permission-denied-open-dev-i2c-1/3610/5 "2019-11-25T03:32:07Z")

</div>

Yes that line is present;

```nohighlight
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:~#

```
