volkszaehler / mbmd

ModBus Measurement Daemon - simple reading of data from ModBus meters and grid inverters
BSD 3-Clause "New" or "Revised" License
241 stars 85 forks source link

Permission denied for /dev/ttyUSB0 when use Docker #347

Open chrissooo opened 3 months ago

chrissooo commented 3 months ago

Hi,

My Setup:

Start docker with following comman (also try privillage):

sudo docker run --privileged -p 8080:8080 --device=/dev/ttyUSB0 volkszaehler/mbmd run -a /dev/ttyUSB0 -d ORNO1p:1 --comset 8E1

After start following errors i see:

2024/09/01 10:20:49 mbmd 0.13 (fa6b574)
2024/09/01 10:20:49 config: creating RTU connection for /dev/ttyUSB0 (9600baud, 8E1)
2024/09/01 10:20:49 config: declared device ORNO1p:1.0
2024/09/01 10:20:49 httpd: starting api at 0.0.0.0:8080
2024/09/01 10:20:49 initialized device ORNO1p1.1: {ORNO1p ORNO1p ORNO WE-514 & WE-515    0}
2024/09/01 10:20:49 device ORNO1p1.1 did not respond (1/3): read failed: permission denied
2024/09/01 10:20:50 device ORNO1p1.1 did not respond (2/3): read failed: permission denied
2024/09/01 10:20:51 device ORNO1p1.1 did not respond (3/3): read failed: permission denied
2024/09/01 10:20:52 device ORNO1p1.1 is offline
2024/09/01 10:20:54 device ORNO1p1.1 is offline - reactivating
2024/09/01 10:20:54 device ORNO1p1.1 did not respond (1/3): read failed: permission denied
2024/09/01 10:20:55 device ORNO1p1.1 did not respond (2/3): read failed: permission denied

When i download the nbmd binary fpr my pi and start it with the same Parameter for example:

./mbmd run -a /dev/ttyUSB0 -d ORNO1p:1 --comset 8E1

its work without problems.

can you help me, i make something wrong maybe?

chrissooo commented 3 months ago

A little Update and the solution. I have build the Docker Image new from Dockerfile from this repository, and then its work. Maybe becource newer version of alpine? Is it possible to rebuild and push it to docker to get a working Version from docker pull?