Error using node-red-start script

I'm using node RED on Debian, installed it with npm and also installed the pi script.

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

If I start node RED with

node-red

it's working.
If i try to run in backround with

node-red-start

it fails with the following error code:

Started Node-RED graphical event wiring tool.
nodered.service: Failed to determine user credentials: No such process
nodered.service: Failed at step USER spawning /usr/bin/env: No such process
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 2.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 3.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 4.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 5.
Stopped Node-RED graphical event wiring tool.
nodered.service: Start request repeated too quickly.
nodered.service: Failed with result 'exit-code'.
Failed to start Node-RED graphical event wiring tool.

I tried different things from Google search but I don't get it running.
Does anybody know what's wrong?

Have you removed, or renamed, the user that was logged on when you ran the script? If so then run
systemctl status nodered
Which will tell you where nodered.service is and change all references to the old user to a valid user. Then reboot. In fact you don't need to reboot, you can run a command that will reload the service file, but I am on my phone and can't remember what it is.

Installation was done with user 'docker' which still exists.

docker@s36-debian-1:~$ systemctl status nodered
● nodered.service - Node-RED graphical event wiring tool
Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2022-03-05 23:03:14 CET; 10h ago
Docs: Redirecting…
Process: 8354 ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS (code=exited, status=217/USER)
Main PID: 8354 (code=exited, status=217/USER)
CPU: 1ms

If i try to use 'sudo node-red-start' then I get the following message

Start Node-RED

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

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 root systemd service.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 1.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 2.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 3.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 4.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=217/USER
nodered.service: Failed with result 'exit-code'.
nodered.service: Scheduled restart job, restart counter is at 5.
Stopped Node-RED graphical event wiring tool.
nodered.service: Start request repeated too quickly.
nodered.service: Failed with result 'exit-code'.
Failed to start Node-RED graphical event wiring tool.

Sorry, I don't know what's wrong. Is user 'docker' unable to access 'lib/systemd/system/nodered.service' ???

There is a/ on the front of that.

That is an unusual name for a user, but assuming that is a normal user it should not matter.

If you logon as user docker and run
node-red
does it start?

How can I remove the / in the front of lib/systemd/system/nodered.service?

Yes, with user docker it is possible to start node-RED with node-red

I meant that the file you have to look in is /lib/systemd/system/nodered.service

Can you paste the contents of that file please?

OK - now I found the mistake, I didn't change the username in the file to the correct user. I changed the user in the file (in the [service] part) an now it's working!!!

Thanks

# systemd service file to start Node-RED

[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html

[Service]
Type=simple
# Run as normal pi user - change to the user name you wish to run Node-RED as
User=username
Group=groupname
WorkingDirectory=/home/username

Nice=5
Environment="NODE_OPTIONS=--max_old_space_size=256"
# uncomment and edit next line if you need an http proxy
#Environment="HTTP_PROXY=my.httpproxy.server.address"
# uncomment the next line for a more verbose log output
#Environment="NODE_RED_OPTIONS=-v"
#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
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target

That should have been setup by the install script. I imagine the install log is long gone so it is difficult to know why that might have happened. Unless you fetched that file again for some reason.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.