Modprobe error when trying to enable i2c on rpi

modprobe: ERROR: …/libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.14.68/modules.dep.bin’

Been getting the above error when trying to enable i2c via Dockerfile.

Dockerfile

FROM resin/raspberry-pi-node

COPY . /app
WORKDIR /app
RUN npm install
EXPOSE 1883
CMD modprobe i2c-dev && node /app/proccess.js

1 Like

Hey @g_abhishek_agarwal

Are you using a docker-compoes file, or lettig the balena builder generate one for you? If so could you paste the service entry for this service please?

Providing the dashboard link for this device and enabling support access may also help too.

Hey @CameronDiver thanks for replying. I am using a docker-compose file since my app is a multi-container app. I’ll paste contents of the file for you here.

version: ‘2.1’
volumes:
resin-data:
services:
redis_db:
image: hypriot/rpi-redis
ports:
- 6379:6379
brain:
build: ./brain
depends_on:
- redis_db
volumes:
- resin-data:/app/db
ports:
- 1883:1883

Thanks for sending the file. What you need to do is add the label to the service which informs the supervisor to mount the kernel module directory into the container. This label is io.balena.features.kernel-modules and the documentation is available here: https://www.balena.io/docs/reference/supervisor/docker-compose/#labels.

You may also need to set the privileged flag for the container which is doing the modprobe, using privileged: true in the service definition.

2 Likes

@CameronDiver Hey I am still getting the same error despite modifying the docker-compose file.

docker-compose.yml

version: ‘2.1’
volumes:
resin-data:
services:
redis_db:
image: hypriot/rpi-redis
ports:
- 6379:6379
app:
build: ./app
privileged: true
labels:
- io.balena.features.kernel-modules
depends_on:
- redis_db
volumes:
- resin-data:/app/db
ports:
- 1883:1883

The syntax for the labels would be either

labels:
  - "io.balena.features.kernel-modules=1"

or

labels:
  io.balena.features.kernel-modules: '1'
1 Like