Fail to start nodered.service on raspberry pi

Hi, I am having some issues with the nodered.service

Node-RED version: v1.3.5
Node.js version: v14.17.0
Linux 5.4.51+ arm LE
raspberry pi Zero W

I can start node-red-pi as user (2E3) without problems.

However when I wan to setup node red as a service through :
systemctl start nodered.service

I get this failure:
Failed to start nodered.service: Unit nodered.service has a bad unit file setting.
See system logs and 'systemctl status nodered.service' for details.

status says:

nodered.service - Node-RED graphical event wiring tool
Loaded: bad-setting (Reason: Unit nodered.service has a bad unit file setting.)
Active: inactive (dead) since Fri 2021-06-25 16:47:52 CEST; 28min ago
Docs: http://nodered.org/docs/hardware/raspberrypi.html
Main PID: 6020 (code=exited, status=0/SUCCESS)

/lib/systemd/system/nodered.service:8: Invalid user/group name or numeric ID: 2E3

My nodered.service files contains

systemd service file to start Node-RED

[Unit]
Description=Node-RED graphical event wiring tool
#After=syslog.target network.target
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=2E3 ---> ERROR ????
Group=2E3
WorkingDirectory=/home/2E3/.node-red

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"

uncomment next line if you need to wait for time sync before starting

#ExecStartPre=/bin/bash -c '/bin/journalctl -b -u systemd-timesyncd | /bin/grep -q "systemd-timesyncd.* Synchronized to time server"'

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

Use SIGINT to stop

KillSignal=SIGINT

Auto restart on crash

Restart=on-failure
RestartSec=20

Tag things in the log

SyslogIdentifier=Node-RED
#StandardOutput=syslog

[Install]
WantedBy=multi-user.target

I can not find a solution

Any ideas ?

Thx
2E3

Welcome to the forum @2E3

It is generally considered a bad idea to start a username with a digit. A number of commands will not cope with that. I imagine that this is the cause of the problem you are having.

Thx Colin, I will create a new profile and try again.

Dear @Colin

Works perfect! Thank you for the advice

1 Like

I don't want to hijack a thread, but 2E3 has closed his question (works perfect) and i want to add a question regarding the same topic.
I usually set up my raspis with the command sudo systemctl enable nodered.service.
2E3 used start instead of enable. Is there a difference between these commands?

start starts the service running.
enable says start it running each time the device boots, it does not not start it immediately.

Thank you!

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