0

I try to run owfs inside a docker container to parse 1-wire temperature values. When running

owfs -C -uall -m /mnt/1wire --allow_other

inside the container I receive this error Segmentation fault (core dumped)

On the host system, I can run the same setup & command without problems so far: I don't know how I to debug it to find the error/solution and would appreciate hints/solutions!

My setup is the following, Dockerfile:

FROM python:3.8-slim-buster
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get upgrade -y
    
COPY ds2490 /etc/modeprobe.d/ds2490
RUN apt-get install owfs -y
RUN apt-get install libtool automake libftdi-dev libusb-dev libusb-1.0.0-dev uthash-dev -y
RUN apt-get install usbutils -y

COPY owfs.conf /etc/owfs.conf
COPY fuse.conf /etc/fuse.conf
RUN mkdir /mnt/1wire

WORKDIR onewire
COPY ./docker_entrypoint.sh ./docker_entrypoint.sh
RUN chmod +x ./docker_entrypoint.sh
COPY ./parse_onewire.py ./parse_onewire.py
RUN chmod +x parse_onewire.py

ENTRYPOINT ./docker_entrypoint.sh

docker-compose.yml:

version: "3"
services:
  onewire_parser:
    container_name: 'onewire'
    build: .
    volumes:
      - /dev/bus/usb:/dev/bus/usb
    privileged: true
    stdin_open: true
    tty: true
    restart: unless-stopped

ds2490:

blacklist ds2490
blacklist ds9490r
blacklist wire

fuse.conf:

#Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#

user_allow_other

owfs.conf:

######################## SOURCES ########################
# With this setup, any client (but owserver) uses owserver on the
# local machine...
! server: server = localhost:4304
# ...and owserver uses the real hardware, by default fake devices
# This part must be changed on real installation
#server: FAKE = DS18S20,DS2405
# USB device: DS9490
server: usb = all
# Serial port: DS9097
#server: device = /dev/ttyS1
# owserver tcp address
#server: server = 192.168.10.1:3131
# random simulated device
#server: FAKE = DS18S20,DS2405
######################### OWFS ##########################
mountpoint = /mnt/1wire
allow_other
####################### OWHTTPD #########################
http: port = 2121
####################### OWFTPD ##########################
ftp: port = 2120
####################### OWSERVER ########################
server: port = localhost:4304

docker_entrypoint.sh:

#!/bin/bash
owfs -C -uall -m /mnt/1wire --allow_other
nopact
  • 195
  • 2
  • 12
  • I'm not familiar with this particular tool, but I see the `modprobe` reference and sense trouble: a Docker container almost can't install Linux kernel modules at all (the image would need to include a full C tool chain and kernel headers, and then get rebuilt any time the host kernel changed at all). A virtual machine with an isolated kernel could be a better match for this, or if you need to access the host kernel and host hardware, run this outside any sort of isolation system. – David Maze Nov 08 '21 at 11:23
  • The container should run on a Raspi, so a VM is not an option. To my understanding I'm not "installing" Linux Kernel Modules, but just copying a file inside modprobe.d folder. The container might not be able to handle this? On my the host system, I had to "blacklist" some devices (done with ds2490 file inside modprobe.d) to make it work. Is there a way to achieve it inside the container? – nopact Nov 08 '21 at 11:34
  • I just tried it without `COPY ds2490 /etc/modeprobe.d/ds2490 ` Unfortunately same problem – nopact Nov 08 '21 at 11:37

1 Answers1

0

I'm not quite sure why, but changing the mount direction from /mnt/1wire to /opt/1wire solved the issue. I left everything else as mentioned in the original post.

Maybe someone can explain this?

nopact
  • 195
  • 2
  • 12