# modprobe: FATAL: Module i2c\_dev not found in directory /lib/modules/6.1.35-yocto-standard

**URL:** <https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357>\
**Category:** Product support\
**Created:** [September 13, 2024, 5:58am UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357 "2024-09-13T05:58:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptuna](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@ptuna](https://forums.balena.io/u/ptuna)\
**Post date:** [September 13, 2024, 5:58am UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357/1 "2024-09-13T05:58:00Z")

</div>

Hello,  
I am trying to get an i2c device to work on an image, and I’ve already tried the tips in here:

> [@modprobe: FATAL: Module i2c-dev not found in balena OS](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-balena-os/359459):
>
> Hello, I want to use the I2C device in Docker Container. (My Device is RaspberryPi3) When I using RUN modprobe i2c-dev, is failing to start with the following error message: modprobe: FATAL: Module i2c-dev not found in directory /lib/modules/5.15.32-v7l+ My full Dockerfile: FROM balenalib/raspberrypi3-python:3.7-latest ENV PYTHONUNBUFFERED RUN pip install -r ./requirements.txt CMD modprobe i2c-dev && python /app/app.py All input much appreciated, thanks!

I’ve attached my dockerfile.template, dockerfile-compose.yaml and udev-rules.

What am I getting wrong here? The fatal error (in the title of this post) happens as soon as the installer for daqhats tries to read DAQ HAT EEPROMs over i2c:  
[data\_kit\_srv] make: Leaving directory ‘/usr/src/app/daqhats/examples/c’  
[data\_kit\_srv] Reading DAQ HAT EEPROMs  
[data\_kit\_srv] modprobe: FATAL: Module i2c\_dev not found in directory /lib/modules/6.1.35-yocto-standard

I’ve previously had a similar config work with i2c when interfacing with sparkfun-qwiic devices, so I really don’t understand what the root of the issue is here.

Docker compose file:

```auto
version: '2'
services:
  data_kit_srv:
    labels:
      io.balena.features.kernel-modules: 1
    build: .
    privileged: true
    # command: modprobe i2c-dev && python3 test
    devices:
      - /dev/i2c-1:/dev/i2c-1
      - /dev/mem:/dev/mem
      - /dev/gpiomem:/dev/gpiomem
    environment:
      - "UDEV=1"
    ports:
      - "5555:5555"
    volumes:
    - /lib/modules:/lib/modules
    cap_add:
    - “ALL”

```

Dockerfile.template:

```auto
FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3.10

# Install any dependencies if required
# RUN apt-get update && apt-get install -y your-dependencies

RUN install_packages git gcc make python3-dev libc-dev
RUN apt-get update && apt-get install -y python3-smbus i2c-tools

WORKDIR usr/src/app

COPY requirements.txt requirements.txt

COPY udev-rules/90-i2c.rules /etc/udev/rules.d/90-i2c.rules

RUN cd ~
RUN git clone https://github.com/mccdaq/daqhats.git
RUN cd daqhats && chmod +x ./install.sh && ./install.sh

RUN pip3 install -r requirements.txt

# Copy all all files in root to the working directory
COPY . ./

#ensure plugged dynamic hardware devices show up in the container
ENV UDEV=1

CMD ["python","-u","src/data_kit_comms.py"]

```

and 90-i2c.rules:

`SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0666"`

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [September 13, 2024, 6:58pm UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357/2 "2024-09-13T18:58:53Z")

</div>

What type of device are you using?

---

<div class="post-metadata">

**Author:** ![ptuna](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@ptuna](https://forums.balena.io/u/ptuna)\
**Post date:** [September 15, 2024, 8:27pm UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357/3 "2024-09-15T20:27:53Z")

</div>

This is on a Raspberry Pi 4, and with BalenaOS 4.0.26, development variant

---

<div class="post-metadata">

**Author:** ![ptuna](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@ptuna](https://forums.balena.io/u/ptuna)\
**Post date:** [September 19, 2024, 8:43am UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357/4 "2024-09-19T08:43:43Z")

</div>

Update: I got around this by deploying a desktop container and running the same commands to clone the git repo and run its install script (which uses the I2C drivers) from here: [GitHub - balena-io-examples/balena-ros2-foxy-desktop: An installation of ROS2 Foxy in a container, with a full desktop environment, ready to deploy on balena devices.](https://github.com/balena-io-examples/balena-ros2-foxy-desktop/tree/main)

However, I tried to modify my own Dockerfile to use the same build  
FROM balenalib/aarch64-ubuntu:focal  
ARG DEBIAN\_FRONTEND=noninteractive

and when I run balena push I see the same problem happen (modprobe: FATAL: Module i2c\_dev not found in directory /lib/modules/6.1.35-yocto-standard)

What is the difference between these two methods? What’s the recommended approach here?

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [September 26, 2024, 1:55am UTC](https://forums.balena.io/t/modprobe-fatal-module-i2c-dev-not-found-in-directory-lib-modules-6-1-35-yocto-standard/371357/5 "2024-09-26T01:55:26Z")

</div>

Are you using `balena push` to the balena builders? If so, the install.sh is trying to run there where there is no I2C device. It probably needs to be moved out of the Dockerfile. You would need to create your own tiny start script that runs the install.sh file and then pauses, then runs your data\_kit\_comms Python script so install.sh runs on your device and not the builder. When you ran it manually in the container successfully, it was on the device, correct? Hopefully I’m understanding your problem/workaround correctly so feel free to provide more details if that’s not the case!
