nodes missing when pm2 started, but works with node-red start command from terminal

185 views
Skip to first unread message

TridiumControls

unread,
Jan 21, 2018, 1:46:13 AM1/21/18
to Node-RED
Hi,

*I'm rather puzzled here. I'm trying to get z-wave to work with node-red. I
followed the instructions, and got z-wave to work when I launch with
command n*
node-red
* and I get the following output. *









Welcome to Node-RED

===================



20 Jan 22:30:29 - [info] Node-RED version: v0.17.5

20 Jan 22:30:29 - [info] Node.js version: v8.9.4

20 Jan 22:30:29 - [info] Linux 4.13.0-25-generic x64 LE

20 Jan 22:30:30 - [info] Loading palette nodes

20 Jan 22:30:32 - [info] node-red-contrib-openzwave: 1.2.3

20 Jan 22:30:32 - [info] openzwave-shared: 1.4.0

initialising OpenZWave addon (/home/usermd/.node-red/node_modules/openzwave-
shared/lib/../build/Release/openzwave_shared.node)

20 Jan 22:30:32 - [info] Polymer started at /polymer

20 Jan 22:30:32 - [info] Dashboard version 2.7.0 started at /ui

20 Jan 22:30:32 - [warn]
------------------------------------------------------

20 Jan 22:30:32 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific
node

20 Jan 22:30:32 - [warn]
------------------------------------------------------

20 Jan 22:30:32 - [info] Settings file : /home/usermd/.node-red/settings.js

20 Jan 22:30:32 - [info] User directory : /home/usermd/.node-red

20 Jan 22:30:32 - [info] Flows file : /home/usermd/.node-red/flows_node-
red.json

20 Jan 22:30:32 - [info] Server now running at http://127.0.0.1:1880/

20 Jan 22:30:32 - [info] Starting flows

Initialising OpenZWave 1.4.0 binary addon for Node.JS.

OpenZWave Security API is ENABLED

ZWave device db : /usr/local/etc/openzwave

User settings path : /home/usermd/.node-red

Option Overrides : --Logging true --ConsoleOutput true --
QueueLogLevel 6 --DriverMaxAttempts 3 --NetworkKey

2018-01-20 22:30:32.944 Always, OpenZwave Version 1.4.0 Starting Up

2018-01-20 22:30:32.944 Warning, Failed - Network Key Not Set

20 Jan 22:30:32 - [info] Started flows

2018-01-20 22:30:56.405 Warning, CheckCompletedNodeQueries m_allNodesQueried
=0 m_awakeNodesQueried=0

2018-01-20 22:30:56.406 Warning, CheckCompletedNodeQueries all=0, deadFound=
0 sleepingOnly=0

2018-01-20 22:30:57.163 Warning, CheckCompletedNodeQueries m_allNodesQueried
=0 m_awakeNodesQueried=0

2018-01-20 22:30:57.164 Warning, CheckCompletedNodeQueries all=0, deadFound=
0 sleepingOnly=0

2018-01-20 22:30:57.164 Warning, CheckCompletedNodeQueries m_allNodesQueried
=0 m_awakeNodesQueried=0

2018-01-20 22:30:57.164 Warning, CheckCompletedNodeQueries all=0, deadFound=
0 sleepingOnly=1

*All is great and z-wave is working BUT when I start with pm2 start
node-red command, the z-wave nodes disappear and here is the log output
from pm2*









0|node-red | 20 Jan 22:20:42 - [info] Node-RED version: v0.17.5

0|node-red | 20 Jan 22:20:42 - [info] Node.js version: v8.9.4

0|node-red | 20 Jan 22:20:42 - [info] Linux 4.13.0-25-generic x64 LE

0|node-red | 20 Jan 22:20:43 - [info] Loading palette nodes

0|node-red | 20 Jan 22:20:45 - [info] node-red-contrib-openzwave: 1.2.3

0|node-red | 20 Jan 22:20:45 - [info] openzwave-shared: 1.4.0

0|node-red | initialising OpenZWave addon (/home/usermd/.node-red/
node_modules/openzwave-shared/lib/../build/Release/openzwave_shared.node)

0|node-red | 20 Jan 22:20:46 - [info] Polymer started at /polymer

0|node-red | 20 Jan 22:20:46 - [info] Dashboard version 2.7.0 started at /ui

0|node-red | 20 Jan 22:20:46 - [warn]
------------------------------------------------------

0|node-red | 20 Jan 22:20:46 - [warn] [rpi-gpio] Info : Ignoring Raspberry
Pi specific node

0|node-red | 20 Jan 22:20:46 - [warn] [zwave] Error: libopenzwave.so.1.4:
cannot open shared object file: No such file or directory (line:46)

0|node-red | 20 Jan 22:20:46 - [warn]
------------------------------------------------------

0|node-red | 20 Jan 22:20:46 - [info] Settings file : /home/usermd/.node-
red/settings.js

0|node-red | 20 Jan 22:20:46 - [info] User directory : /home/usermd/.node-
red

0|node-red | 20 Jan 22:20:46 - [info] Flows file : /home/usermd/.node-
red/flows_node-red.json

0|node-red | 20 Jan 22:20:46 - [info] Waiting for missing types to be
registered:

0|node-red | 20 Jan 22:20:46 - [info] - zwave-controller

0|node-red | 20 Jan 22:20:46 - [info] - zwave-in

0|node-red | 20 Jan 22:20:46 - [info] Server now running at http:
//127.0.0.1:1880/

0|node-red |
*and z-wave nodes are missing. Sounds like a permission issue, but not sure
where to start. *

*here is pm2 config. *









usermd@node-red:~/.node-red$ pm2 info node-red

Describing process with id 0 - name node-red

┌───────────────────┬─────────────────────────────────────────────┐

│ status │ stopped │

│ name │ node-red │

│ restarts │ 0 │

│ uptime │ 0 │

│ script path │ /usr/bin/node-red │

│ script args │ N/A │

│ error log path │ /home/usermd/.pm2/logs/node-red-error-0.log │

│ out log path │ /home/usermd/.pm2/logs/node-red-out-0.log │

│ pid path │ /home/usermd/.pm2/pids/node-red-0.pid │

│ interpreter │ node │

│ interpreter args │ N/A │

│ script id │ 0 │

│ exec cwd │ /home/usermd │

│ exec mode │ fork_mode │

│ node.js version │ 8.9.4 │

│ watch & reload │ ✘ │

│ unstable restarts │ 0 │

│ created at │ 2018-01-20T16:18:38.654Z │

└───────────────────┴─────────────────────────────────────────────┘




TridiumControls

unread,
Jan 21, 2018, 1:48:52 AM1/21/18
to Node-RED
hmm, some how google groups changed the formatting, and now my comments got jumbled with the terminal output.

On Saturday, January 20, 2018 at 10:46:13 PM UTC-8, TridiumControls wrote:
Hi,

I'm rather puzzled here. I'm trying to get z-wave to work with node-red. I
followed the instructions, and got z-wave to work when I launch with
command node-red  and I get the following output. *

Dave C-J

unread,
Jan 21, 2018, 6:36:20 AM1/21/18
to node...@googlegroups.com
Is the PM2 running Node-RED as the user that you installed the nodes with , or as root... I would guess by default it will be root...  I don't know enough PM2 to tell you how to set it to call Node-RED as your user - but that is what it needs to do. Maybe from here - http://pm2.keymetrics.io/docs/usage/startup/

TridiumControls

unread,
Jan 21, 2018, 10:35:50 AM1/21/18
to Node-RED
PM2 is running under my user and I used my user to install the nodes. I tried also using systemd instead of pm2 and same thing happens, here's my systemd startup script.  I tried the link you provided, but can't get it to work. Is there a way to figure out what user I installed a node? 

I tried starting pm2 as the root user, and z-wave nodes are missing, only way to get the z-wave nodes back is to launch from my logged in user and type in terminal
node-red

Then it starts up and all works. I also tried re-installing the node as my user, and install went without a hitch, and the node is in node_modules folder same permissions as all the other nodes. 

What method are you using to auto start node-red?












# It works on Debian/Raspbian Jessie.


# If you have Debian/Rapbian Wheezy and want to use this script with systemd


# follow the information here : https://wiki.debian.org/systemd




# To easily download, install and set at startup:


# wget -O /tmp/download https://gist.github.com/Belphemur/3f6d3bf211b0e8a18d93/download && sudo tar -zxf /tmp/download --strip-components 1 $




# To consult the log : journalctl -u Node-RED


[Unit]


Description=Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.


After=syslog.target network.target


Documentation=http://nodered.org/




[Service]


Environment="NODE_OPTIONS=--max-old-space-size=128"


Environment="NODE_RED_OPTIONS=-v"


#Full Path to Node.js


ExecStart=/usr/bin/node-red


WorkingDirectory=/home/usermd/.node-red/


# User/Group that launches node-RED (it's advised to create a new user for Node-RED)


# You can do : sudo useradd node-red


# then change the User=root by User=node-red


User=usermd


Group=usermd


Nice=10


SyslogIdentifier=Node-RED


StandardOutput=syslog


# Make Node-RED restart if it fails


Restart=on-failure


# Node-RED need a SIGINT to be notified to stop


KillSignal=SIGINT




[Install]


WantedBy=multi-user.target



TridiumControls

unread,
Jan 21, 2018, 10:45:36 AM1/21/18
to Node-RED
nvm, changing the pm2 startup user from my user to root, fixed it. still need to figure out why I need root to launch node-red just for this node, 





On Sunday, January 21, 2018 at 3:36:20 AM UTC-8, Dave C-J wrote:
Reply all
Reply to author
Forward
0 new messages