RPI Serial hangups

I have an intelligent home security system connected to my Raspberry Pi via rs232 to /dev/tty/AMA0 using serial in and out nodes within Node-Red. Communication is fine for about a week and then either the in or out node stops communicating. Each time I resolve it by stopping and restarting Node-Red.
I cannot find any logs and have have no idea how to diagnose what is causing this. Buffer overflow?
Can anyone help me.

You can't find any logs? Or you can't find a log that helps to suggest what is happening?
If it's the former and you have installed node-RED following the suggested method on https://nodered.org/docs/hardware/raspberrypi then the script will have installed the command node-red-log

Also, when you say you restart node-red, is that exactly what you do or are you rebooting or what? How are you restarting node red?
It might also be useful if, in a terminal you run


and copy/paste the result here. You can copy from the terminal using Ctrl-Shift-C

node-red-log produces "command not found"
I installed all Node red via Pete Scargill's script.
Colin I have tried all measures including a full reboot and have found that stop- and restart of node red is enough to sort it for a few days. The terminal during restart all looks normal.
edit *** the last few lines are new. I will sort that. I don't think it is relevant.

Start Node-RED

Once Node-RED has started, point a browser at
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
30 Jan 17:49:37 - [info]
Welcome to Node-RED

30 Jan 17:49:37 - [info] Node-RED version: v0.19.4
30 Jan 17:49:37 - [info] Node.js version: v8.11.1
30 Jan 17:49:37 - [info] Linux 4.14.71-v7+ arm LE
30 Jan 17:49:43 - [info] Loading palette nodes
30 Jan 17:49:51 - [info] Dashboard version 2.13.0 started at /ui
30 Jan 17:49:52 - [info] Settings file : /home/pi/.node-red/settings.js
30 Jan 17:49:52 - [info] HTTP Static : /home/pi/.node-red/public
30 Jan 17:49:52 - [info] Context store : 'default' [module=memory]
30 Jan 17:49:52 - [info] User directory : /home/pi/.node-red
30 Jan 17:49:52 - [warn] Projects disabled : editorTheme.projects.enabled=false
30 Jan 17:49:52 - [info] Flows file : /home/pi/.node-red/flows.json
30 Jan 17:49:53 - [info] Server now running at
30 Jan 17:49:53 - [warn]

Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

30 Jan 17:49:53 - [info] Starting flows
30 Jan 17:49:54 - [info] [tcp out:telnet] connecting to localhost:7072
30 Jan 17:49:59 - [info] [tcp out:telnet] connecting to localhost:7072
30 Jan 17:50:13 - [info] Started flows
30 Jan 17:50:13 - [info] [sqlitedb:c37d97a8.1b07c8] opened /home/pi/dbs/iot.db ok
30 Jan 17:50:13 - [info] [sqlitedb:c37d97a8.1b07c8] opened /home/pi/dbs/iot.db ok
30 Jan 17:50:13 - [info] [sqlitedb:c37d97a8.1b07c8] opened /home/pi/dbs/iot.db ok
30 Jan 17:50:13 - [info] [sqlitedb:c37d97a8.1b07c8] opened /home/pi/dbs/iot.db ok
30 Jan 17:50:13 - [info] serial port /dev/ttyAMA0 opened at 9600 baud 8N1
30 Jan 17:50:13 - [info] [mqtt-broker:fc8b5c33.494e8] Connected to broker: mqtt://
30 Jan 17:50:13 - [info] [tcp out:telnet] connected to localhost:7072
30 Jan 17:50:13 - [info] [tcp out:telnet] connected to localhost:7072
30 Jan 17:50:13 - [info] [mqtt-broker:7326ac84.630d14] Connection failed to broker: mqtt://localhost:1883
30 Jan 17:50:28 - [info] [mqtt-broker:7326ac84.630d14] Connection failed to broker: mqtt://localhost:1883
30 Jan 17:50:43 - [info] [mqtt-broker:7326ac84.630d14] Connection failed to broker: mqtt://localhost:1883
30 Jan 17:50:58 - [info] [mqtt-broker:7326ac84.630d14] Connection failed to broker: mqtt://localhost:1883

Are you sure that node-red-log is not found? If so then that must be a difference between Pete Scargill's script and the official one from https://nodered.org/docs/hardware/raspberrypi
Instead you should be able to use
sudo journalctl -f -n 100 -u nodered -o cat
Assuming that works then maybe the best thing is to wait till it fails again and see what is in the log, if anything.

Colin thanks, that command does provide some info. Next time it hangs I'll try it.

I’d also suggest asking Pete to update his script to include the node-red-log command

i'm "responsible" of newer additions to Peter's script, and from last december going on we moved to official nodered install script for that part... Peter's one will just be suspended while the official one is run, then after completing will just continue installing Peter's usual collection of nodes... nothing more, take a look at line 797: https://bitbucket.org/snippets/scargill/qexexb/the-script-2019#script.sh-797

1 Like

@muggins Are you using node-red-stop and node-red-start to stop and start node-red?

What does the command
ls /usr/bin/node-red*

pi@atticPI:~ $ ls /usr/bin/node-red*
/usr/bin/node-red /usr/bin/node-red-start
/usr/bin/node-red-pi /usr/bin/node-red-stop

Well that's very odd. What does
cat /lib/systemd/system/nodered.service
give. In case you don't know you can copy out of the terminal window using Ctrl-Shift-C.

pi@atticPI:~ $ cat /lib/systemd/system/nodered.service

systemd service file to start Node-RED

Description=Node-RED graphical event wiring tool


Run as normal pi user - change to the user name you wish to run Node-RED as



uncomment and edit next line if you need an http proxy


uncomment the next line for a more verbose log output

#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS

Use SIGINT to stop


Auto restart on crash


Tag things in the log


pi@atticPI:~ $

Well everything looks ok except that you are missing node-red-log. I have no idea how that might come about.