node-red / node-red-docker

Repository for all things Node-RED and Docker related
Apache License 2.0
469 stars 382 forks source link

Problems accessing the ttyS2 #403

Closed edu-sistec closed 5 months ago

edu-sistec commented 5 months ago

Hello,

This is my 1st case here.

to help you understand my problem I will try to explain it well I'm trying to get the container node-red to grab the ttyS2. I'm using docker-compose:

  node-red:
    image: nodered/node-red
    container_name: nodered
    user: root
    group_add:
      - dialout
    ports:
      - "1881:1880"
    networks:
      - xarxa
    restart: always
    volumes:
      - /home/docker/data/nodered/:/data
    environment:
      - TZ=Europe/Madrid
    devices:
      - /dev/ttyS2

I also tried entering docker-compose:

      user: root
      group_add:
        - dialout

In the node-red I insert the palette of contrib-modbus and configure it to use the ttyS2, then the error comes out:

  ./entrypoint.sh: line 14: 7 Segmentation fault (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"

in the contender it looks like I can access the ttyS2 with: stty -a < /dev/ttyS2 result:

speed 9600 baud;stty: standard input
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc_

I am running the container on an IOT2050 basic, docker node-red the last.

Client: Docker Engine - Community Version: 24.0.7 Kernel Version: 5.10.104-cip3 Operating System: Debian GNU/Linux 11 (bullseye)

I don't understand the problem I have to access the ttyS2 device, help is possible.

Thanks in advance Edu

hardillb commented 5 months ago

This is a bug in the node-serial node on ARM, the pre-built binaries just don't work on ARM, this has been reported upstream but there has been no fix for many years. https://github.com/serialport/bindings-cpp/issues/139

The workaround is to log into the container and run npm rebuild in the /data directory

edu-sistec commented 5 months ago

Hi Ben,

thanks for answering

Yes, I have done what you mention in the thread: https://github.com/node-red/node-red/issues/3461

I have followed all the steps with the result order suced, but finally when running the contrib-modbus node the result is the same error.

I don't know what I'm doing wrong.

Edu

hardillb commented 5 months ago

Then the only other option is to try changing the node-red container for the debian based image instead of the alpine one.

Change the container line in the docker compose to point to nodered:latest-debian

edu-sistec commented 5 months ago

Hi Ben,

Thanks, I'll try it

Right now I've reset the device and I don't have it ready to test, but when I get a chance I'll try and let you know.

edu-sistec commented 5 months ago

Hi Ben

It is already working perfectly. Finally I just had to add in docker-compose that it takes the Debian version: nodered:latest-debian.

I didn't need to do npm rebuild

Thank you for your time Edu