# Unable to start Node-red upon boot

**URL:** <https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353>\
**Category:** General\
**Created:** [31 October 2019 05:50 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353 "2019-10-31T05:50:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 05:50 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/1 "2019-10-31T05:50:08Z")

</div>

I'm trying to autorun Node-red on a laptop running Ubuntu 18.04.3 LTS Bionic.  
I followed below web page...

> **[How to install and configure Node-RED on Ubuntu 16.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-connect-your-internet-of-things-with-node-red-on-ubuntu-16-04)**
>
> Node-RED is a switchboard for the Internet of Things, a visual tool that helps you connect your favorite apps, websites, and hardware together to do new and useful things. Node-RED has a powerful and flexible interface, and a large open source...

"node-red" command works.  
But I can get Node-red to run on boot!  
Can anyone help me troubleshoot this, please?

Thank  
IDeeW

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 05:51 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/2 "2019-10-31T05:51:42Z")

</div>

I also tried below solution but the issue is still there...

> [@"sudo systemctl enable nodered.service" in ubuntu fail?](https://discourse.nodered.org/t/sudo-systemctl-enable-nodered-service-in-ubuntu-fail/16556):
>
> Hello all , follow the instruction by "[https://nodered.org/docs/getting-started/raspberrypi](https://nodered.org/docs/getting-started/raspberrypi)". I have run: bash \<(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodere sudo systemctl enable nodered.service but failed . The log : ubuntu 16.04 npm 6.9.0 node-red v10.16.3 I have searched for some similar issue in forum,but still can not find a solution. Is there any suggestion ? Thanks.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 07:20 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/3 "2019-10-31T07:20:08Z")

</div>

If you install node red using the pi install script, which also works on Ubuntu, that will setup the systemd script for you. Doing this will not destroy your existing flows, though I am sure you have backups anyway.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 08:46 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/4 "2019-10-31T08:46:39Z")

</div>

> [@iDeeW](#):
>
> I followed below web page..

That tutorial says that it installs nodejs version 4.x, which went out of support years ago You need at least 10.x to run the current node red version.

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 15:29 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/5 "2019-10-31T15:29:33Z")

</div>

Ok. Let me try the Pi scripts.  
Trying out Node-Red for the first time. So no existing flows to back up..  
will update the results...

Thanks

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 15:33 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/6 "2019-10-31T15:33:33Z")

</div>

this is what happens after I run "node-red" command

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/34c70afbce2bd74fb8b6f9ce21146ca21f448328.png)

But "sudo systemctl start node-red" will not run Node-red.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/469204422394bbf17a07fbe08a3082641a22a43c.png)

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [31 October 2019 15:39 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/7 "2019-10-31T15:39:35Z")

</div>

It does run node-red, but in the background. `node-red-start` is like an alias that combines the background starting with viewing the log file. See `sudo systemctl status nodered` to verify that it runs. Or `node-red-log` to view the logs at any time.  
To have it start on boot, `sudo systemctl enable nodered`.

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 15:54 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/8 "2019-10-31T15:54:57Z")

</div>

ok. I enabled it.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/21ac46fb7355ef26ebee13098be9bfe5efde37fa.png)

But still nothing after reboot.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a0a2a16498550d453be8b6609efba0e68d7fb0ee.png)

Thanks

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [31 October 2019 15:55 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/9 "2019-10-31T15:55:39Z")

</div>

and what does `node-red-log` say? or `sudo systemctl status nodered` for that matter?

Here's what it looks like on my ubuntu server 19.10, installed through the script and set to run on boot through `sudo systemctl enable nodered`.

 ![12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/427a7b2bffc16b8e86be58408aa1f2421249de14.png) ![31](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/fab97ff77d6b743e0fb37ac36665086e6aae0fcf.png)

if it didn't start because of an error, it will show in the status command

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 15:59 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/10 "2019-10-31T15:59:14Z")

</div>

ohh...  
This is whats on mine.....☹

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/783594e6efb243932710cb9004c6bcaa0ff33056.png)

node-reg-log.....nothing!  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4a297641ff4fc59b357b304dd5acf8b0b2ae5597.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 16:52 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/11 "2019-10-31T16:52:36Z")

</div>

What does `node-red-start` show. That should start it with systemd and then show the startup messages

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 16:56 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/12 "2019-10-31T16:56:39Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/971976136656c6d8b00365a0feae39a70110d630.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 17:18 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/13 "2019-10-31T17:18:46Z")

</div>

Odd, post here `/lib/systemd/system/nodered.service` I suspect there is an issue there. Can you copy/paste logs and file contents rather than screenshot, it is much easier to deal with? Thanks.

**[Edit]** Also what do  
`ls -l /usr/bin/env`  
and  
`which env`  
show?

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 17:41 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/14 "2019-10-31T17:41:45Z")

</div>

I have the script on the below path

```auto
/etc/systemd/system/node-red.servic

```

I added the .txt to the end  
[node-red.service.txt](https://discourse.nodered.org/uploads/short-url/oM4bMZ2uMvyJ84ic2TtAzgi0gUd.txt) (380 Bytes)

* * *

> indika@WEERAServer:~$ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at [http://192.168.0.96:1880](http://192.168.0.96:1880)  
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](http://flows.nodered.org)  
[sudo] password for indika:

## Starting as a systemd service. nodered.service: Service hold-off time over, scheduling restart. 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: 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: Service hold-off time over, scheduling restart. 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: 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: Service hold-off time over, scheduling restart. 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: 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: Service hold-off time over, scheduling restart. 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: 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: Service hold-off time over, scheduling restart. 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.

* * *

> indika@WEERAServer:~$ sudo systemctl status nodered

[sudo] password for indika:  
● 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 Thu 2019-10-31 12:55:58 EDT; 45min ago  
Docs: [Redirecting…](http://nodered.org/docs/hardware/raspberrypi.html)  
Process: 1362 ExecStart=/usr/bin/env node-red-pi $NODE\_OPTIONS $NODE\_RED\_OPTIONS (code=exited, status=217/USER)  
Main PID: 1362 (code=exited, status=217/USER)

Oct 31 12:55:58 WEERAServer systemd[1]: nodered.service: Service hold-off time over, scheduling restart.  
Oct 31 12:55:58 WEERAServer systemd[1]: nodered.service: Scheduled restart job, restart counter is at 5.  
Oct 31 12:55:58 WEERAServer systemd[1]: Stopped Node-RED graphical event wiring tool.  
Oct 31 12:55:58 WEERAServer systemd[1]: nodered.service: Start request repeated too quickly.  
Oct 31 12:55:58 WEERAServer systemd[1]: nodered.service: Failed with result 'exit-code'.  
Oct 31 12:55:58 WEERAServer systemd[1]: Failed to start Node-RED graphical event wiring tool.  
indika@WEERAServer:~$

* * *

> indika@WEERAServer:~$ node-red

31 Oct 13:43:31 - [info]

# Welcome to Node-RED

31 Oct 13:43:31 - [info] Node-RED version: v1.0.2  
31 Oct 13:43:31 - [info] Node.js version: v8.10.0  
31 Oct 13:43:31 - [info] Linux 4.15.0-66-generic x64 LE  
31 Oct 13:43:33 - [info] Loading palette nodes  
31 Oct 13:43:43 - [info] Settings file : /home/indika/.node-red/settings.js  
31 Oct 13:43:43 - [info] Context store : 'default' [module=memory]  
31 Oct 13:43:43 - [info] User directory : /home/indika/.node-red  
31 Oct 13:43:43 - [warn] Projects disabled : editorTheme.projects.enabled=false  
31 Oct 13:43:43 - [info] Flows file : /home/indika/.node-red/flows\_WEERAServer.json  
31 Oct 13:43:43 - [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.

31 Oct 13:43:43 - [info] Starting flows  
31 Oct 13:43:43 - [info] Started flows  
31 Oct 13:43:43 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 17:53 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/15 "2019-10-31T17:53:45Z")

</div>

> [@iDeeW](#):
>
> I have the script on the below path
> 
> ```auto
> /etc/systemd/system/node-red.servic
> 
> ```

That is not the right service file. Look at the `systemd status` output and you will see it is where I suggested. Also the one you have posted is node-red.service, whereas the correct one is nodered.service.  
Sorry, I didn't mean you to repost all the stuff you had already posted, I just meant for the future, the systemd script for example. I you click the \</\> button above the edit box when posting and paste the text there it will stop the forum from reformatting it.

Also what do  
`ls -l /usr/bin/env`  
and  
`which env`  
show?

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 17:56 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/16 "2019-10-31T17:56:37Z")

</div>

```auto
indika@WEERAServer:~$ ls -l /usr/bin/env
-rwxr-xr-x 1 root root 35000 Jan 18 2018 /usr/bin/env
indika@WEERAServer:~$ which env
/usr/bin/env
indika@WEERAServer:~$

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 17:56 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/17 "2019-10-31T17:56:39Z")

</div>

Also make sure you `systemctl disable node-red` or it will be trying to run that one on boot as well as nodered.service.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 17:59 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/20 "2019-10-31T17:59:27Z")

</div>

Well env looks alright, so I think it is back to the systemd script, if you can find the right one. It must be there as systemd status found it.

---

<div class="post-metadata">

**Author:** ![iDeeW](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ideew/32/13856_2.png) [@iDeeW](https://discourse.nodered.org/u/iDeeW)\
**Post date:** [31 October 2019 18:11 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/21 "2019-10-31T18:11:55Z")

</div>

found it under "/lib/systemd/system/"  
[nodered.service.txt](https://discourse.nodered.org/uploads/short-url/tMA7cEIhS8gxfp8mAgL4gu5Oxqb.txt) (917 Bytes)

Thanks

[edit]  
YES....that's it...  
everything is working as soon as I change the user & group to "indika".....

Thanks u so much Colin and everyone.

....can not reply my daily limit is over....

Below is the log `/var/log/nodered-install.log`

```auto
***************************************

Started : Thu Oct 31 00:01:23 EDT 2019
Running for user indika at /home/indika
Failed to stop nodered.service: Unit nodered.service not loaded.
Found global nodes: :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package nodered
Now install nodejs
Updating nodejs v0
Not using nodesource.list

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
Grab the LTS bundle

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Err:4 http://plex.r.worldssl.net/PlexMediaServer/ubuntu-repo lucid InRelease
  Could not resolve 'plex.r.worldssl.net'
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Fetched 252 kB in 2s (150 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
15 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://plex.r.worldssl.net/PlexMediaServer/ubuntu-repo/dists/lucid/InRelease Could not resolve 'plex.r.worldssl.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 October 2019 18:20 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/22 "2019-10-31T18:20:12Z")

</div>

Well that is very odd, the install script has not put your user name in the script. I presume you were logged in as your normal user when you ran the script, and didn't use sudo. Whatever, to fix it edit that file and change the user and group from pi to your user name (indika). Then so that systemd will reload it  
`sudo systemctl daemon-reload`  
then  
`node-red-start`  
Assuming that fixes it I would like to understand what went wrong. Can you post the install log please, `/var/log/nodered-install.log`

**[Edit]** Oh, change the Working Directory too.

[Next page](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353.md?page=2)
