According to this post, the issue of certain devices not showing might be due to a missing package linux-modules-extra-raspi.
Can you share your application Dockerfile?
I have tried about linux-modules-extra-raspi. But it seem don’t help.
Here is my Dockerfile
FROM balenalib/%%BALENA_MACHINE_NAME%%:bullseye-build as build
ARG APP_DIR=/usr/src/app
ARG APP_NAME=lw231-sensor-node-c
ARG OUTPUT_DIR=/usr/src/output
ARG PREPARE_DIR=/usr/src/preparing
WORKDIR $PREPARE_DIR
RUN mkdir -p $OUTPUT_DIR
# Download, make and install IBM IoT library.
RUN git clone https://github.com/burin-mdt/iot-c.git
RUN git --git-dir=./iot-c/.git checkout ce64bc7
RUN make -C iot-c/
RUN make -C iot-c/paho.mqtt.c install
RUN mkdir -p $OUTPUT_DIR/usr/local/lib/
RUN mkdir -p $OUTPUT_DIR/usr/local/bin/
#RUN make DESTDIR=$OUTPUT_DIR -C iot-c/paho.mqtt.c/ install
WORKDIR $PREPARE_DIR
# Install iot-c to build env.
RUN cp iot-c/build/*.so* /usr/local/lib/
RUN cp iot-c/src/wiotp/sdk/*.h /usr/local/include/
# Install iot-c to output.
RUN mkdir -p $OUTPUT_DIR/usr/local/lib/
RUN cp iot-c/build/*.so* $OUTPUT_DIR/usr/local/lib/
# Install paho.mqtt.c to build env.
RUN cp iot-c/paho.mqtt.c/build/output/*.so* $OUTPUT_DIR/usr/local/lib/
# Install paho.mqtt.c to output.
RUN cp iot-c/paho.mqtt.c/build/output/*.so* /usr/local/lib
# Install cJSON library.
RUN git clone https://github.com/burin-mdt/cJSON.git
WORKDIR /usr/src/preparing/cJSON
RUN git checkout v1.7.12
RUN make all
RUN make install
RUN make DESTDIR=$OUTPUT_DIR install
WORKDIR $PREPARE_DIR
RUN apt-get update && apt-get -y install libmodbus-dev libcurl4-openssl-dev cmake
WORKDIR $APP_DIR
# Copies the package.json first for better cache on later pushes
COPY . ./
# This install npm dependencies on the balena build server,
# making sure to clean up the artifacts it creates in order to reduce the image size.
RUN mkdir build
RUN cd build && cmake ../ && make
FROM balenalib/%%BALENA_MACHINE_NAME%%:bullseye
ARG APP_DIR=/usr/src/app
ARG APP_NAME=iot-node
ARG OUTPUT_DIR=/usr/src/output
ARG PREPARE_DIR=/usr/src/preparing
RUN apt-get update && apt-get -y install libmodbus5 libcurl4-openssl-dev
COPY --from=build $OUTPUT_DIR/ /
WORKDIR $APP_DIR
COPY --from=build $APP_DIR/build/$APP_NAME ./$APP_NAME
CMD ./iot-node
It took a little to get around to checking this.
Your problem is that you’re missing an entry in your Dockerfile: ENV UDEV=1.
As explained here, that environment variable is used to decide whether to mount /dev in your container.
Thanks for your answer.
I have tried with ENV UDEV=1 already.
It’s work only when the new USB to Serial attached.
But the one that already attached before container started, it’s won’t be seen in the container.
Hi,
When I tried it here with my fin-cm3 and a random USB to Serial adapter, it seemed to work fine from container boot. Note that I don’t have your iot-node project, so I skipped that part and jumped straight to a balena-idle instead.
Can you maybe share which serial device specifically gives you this issue?
Something that might also help, is to show us the logging from Host and Container when the device does not get mounted properly. journalctl --all --merge --no-pager and/or dmesg should be fine.