# 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:** 4

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 June 2020 21:10 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/64 "2020-06-01T21:10:02Z")

</div>

well - I'm still not quite sure why your install is so truculent.  
does the `node-red-start` and `node-red-log` command now work after a reboot and when run as root. ?

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [1 June 2020 21:42 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/65 "2020-06-01T21:42:41Z")

</div>

> [@dceejay](#):
>
> does the `node-red-start` and `node-red-log` command now work after a reboot and when run as root. ?

Well, node-red-start does sort of attempt to start node-red but it never gets beyond `"starting as root systemd service"`. Really sorry this is such a faff.

```auto
Running Node-RED install for user root at /root on raspbian

This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED ✔
  Remove old version of Node-RED ✔
  Remove old version of Node.js ✔ v0
  Update Node.js LTS ✔ Node v12.17.0 Npm 6.14.4
  Clean npm cache ✔
  Install Node-RED core ✔ 1.0.6 
  Move global nodes to local -
  Install extra Pi nodes ✔
  Npm rebuild existing nodes -
  Add shortcut commands ✔
  Update systemd script ✔
                                      

Any errors will be logged to /var/log/nodered-install.log
All done.
  You can now start Node-RED with the command node-red-start
  or using the icon under Menu / Programming / Node-RED
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started Mon 1 Jun 22:37:05 BST 2020 - Finished Mon 1 Jun 22:39:34 BST 2020

root@raspbx:~# systemctl enable nodered.service
root@raspbx:~# node-red-start

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.118: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.
 
^C
root@raspbx:~# journalctl -f -u nodered
-- Logs begin at Thu 2016-11-03 17:16:45 GMT. --
Jun 01 21:01:10 raspbx Node-RED[353]: then retry node-red-start
Jun 01 21:01:10 raspbx Node-RED[353]:  
Jun 01 22:40:10 raspbx systemd[1]: Started Node-RED graphical event wiring tool.
Jun 01 22:40:10 raspbx Node-RED[22239]: [21B blob data]
Jun 01 22:40:10 raspbx Node-RED[22239]: Node-RED is not yet fully installed. Please re-run the install script again manually.
Jun 01 22:40:10 raspbx Node-RED[22239]:  
Jun 01 22:40:10 raspbx Node-RED[22239]: bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Jun 01 22:40:10 raspbx Node-RED[22239]:  
Jun 01 22:40:10 raspbx Node-RED[22239]: then retry node-red-start
Jun 01 22:40:10 raspbx Node-RED[22239]:

```

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 08:46 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/66 "2020-06-02T08:46:20Z")

</div>

Still trying to debug this. Is it strange that NPM is not installed by the bash script?

```auto
root@raspbx:~ $ apt purge nodejs npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'npm' is not installed, so not removed
The following packages will be REMOVED:
  nodejs*
0 upgraded, 0 newly installed, 1 to remove and 125 not upgraded.
After this operation, 84.3 MB disk space will be freed.
Do you want to continue? [Y/n] y

```

What I'm finding is every time I run the bash script then type `node-red-start` it says  
`Node-RED is not yet fully installed. Please re-run the install script again manually.`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 09:32 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/67 "2020-06-02T09:32:30Z")

</div>

this is mad... ok... what does `which node-red-pi` now say... as it's the only way to get here now...

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 09:48 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/68 "2020-06-02T09:48:11Z")

</div>

`/root/.npm-packages/bin/node-red-pi`  
EDIT: [The most recent install log](https://termbin.com/1rwy)

EDIT 2: The first time I try node-red-start after 'installation' with the script it says this:

```auto
root@raspbx:~# sudo systemctl enable nodered.service
root@raspbx:~# node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.118: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.

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

then retry node-red-start

```

the second time I try it, it says this

```auto
root@raspbx:~# node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.0.118: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.

```

but neither time does the command node-red-start return

However, as before, if I run` /root/.npm-packages/bin/node-red-pi` then node-red starts successfully, but only within that session, **NOT as a service**

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 10:15 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/69 "2020-06-02T10:15:51Z")

</div>

yeah it's 99% good... but /root/.npm-packages/bin/node-red-pi is obviously not in the environment path when the service runs - it should be over in /usr/bin  
ugly - but lets try - `ln -s $(which node-red-pi) /usr/bin/node-red-pi`  
(as root)  
then retry `node-red-start`

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 10:18 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/70 "2020-06-02T10:18:02Z")

</div>

Closer

 ![dasdasdsa](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a923fc9ca56c2153cb93a6ca58eb989b60e47779.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 10:21 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/71 "2020-06-02T10:21:46Z")

</div>

hmm not really ☹

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 10:27 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/72 "2020-06-02T10:27:14Z")

</div>

The key 'take home' I'm getting is that for some reason even after the installation node-red keeps reporting the installation isn't finished/complete - it wants me to rerun it manually. We-running it manually isn't something I know how to do, but I'd be very up for giving it a go!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 10:27 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/73 "2020-06-02T10:27:29Z")

</div>

Maybe another tack. Where can I get a copy of the original system image ?  
It may just be quicker if I can duplicate the whole setup.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 10:29 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/74 "2020-06-02T10:29:09Z")

</div>

Well by manually I just mean re-run the bash script as that should complete... usually the only reason we get here is if it failed for some reason - like internet connection breaks etc... but something is def odd about the underlying setup here...

but if you want to go really manual you could run `npm i -g --unsafe-perm node-red` as root (not sudo)

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 10:29 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/75 "2020-06-02T10:29:37Z")

</div>

Wow. You're a brick! [Here](http://www.raspberry-asterisk.org/downloads/). Goodness.  
What's 100% bizarre is that Node-Red WAS working fine for months and months on this self same setup. The only reason I wanted to upgrade was after making a change or two to my palette and a flow, something caused constant 100% usage and for the Pi to become unresponsive. I thought upgrading might help. Ooops.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 10:33 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/76 "2020-06-02T10:33:04Z")

</div>

Which version are you using - some of the messages above mention Stretch - but that web page says  
"Pi 1 and Pi zero models are no longer supported. Please refer to the previous Stretch based images for Pi 1 and Pi zero hardware."  
so looks like stretch may be a previous version...

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 10:37 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/77 "2020-06-02T10:37:44Z")

</div>

Think it'll be [this one](http://download.raspberry-asterisk.org/raspbx-04-04-2018.zip)

---

<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:** [2 June 2020 11:10 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/78 "2020-06-02T11:10:32Z")

</div>

> [@iDeeW](#):
>
> I'm trying to autorun Node-red on a laptop running Ubuntu 18.04.3 LTS Bionic.

I am not surprised I am having difficulty following this as that quote is from the original question.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 11:26 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/79 "2020-06-02T11:26:25Z")

</div>

it restarted at post 28

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 12:16 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/80 "2020-06-02T12:16:05Z")

</div>

OK - downloaded that image... burst to SD card.  
booted - ssh in as root  
ran `apt update && apt full-upgrade && apt autoremove`  
to update and cleanup  
ran Node-RED bash install script. saying yes to installing as root.  
ran `node-red-start`... ALL GOOD !

so yeah... not much more I can think of right now - apart from blowing it away again as we did yesterday - then installing as root (and stick with root).

and if `which node-red-pi` still insists in being under that root folder - copy (rather than link) a version over manually to ./usr/bin.

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [2 June 2020 18:17 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/81 "2020-06-02T18:17:04Z")

</div>

Hi there  
Just wanted to explain the lack of a reply. At some point today my Pi died - or rather the SD card most likely has died. I'm not really surprised - I'd been hammering it with uninstall and reinstalls of Node,NPM and Node-Red and at some point it just closed the SSH connection and when I relogged in from home I did a `reboot` to bring SSH backup it never powered back up. Guessing something somewhere is corrupt. I get a red LED but no ACT LED.  
So HUGE thanks for your help but I have every confidence once I reflash RasPBX I too will be able to install as normal. Just have no idea what was going on with that sytem which is now toast.  
Thanks - you've been brilliant.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 June 2020 18:23 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/82 "2020-06-02T18:23:54Z")

</div>

Good luck FWIW I upgraded my image to their Buster version it also works fine for me.

---

<div class="post-metadata">

**Author:** ![dclear](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dclear/32/9107_2.png) [@dclear](https://discourse.nodered.org/u/dclear)\
**Post date:** [3 June 2020 08:02 UTC](https://discourse.nodered.org/t/unable-to-start-node-red-upon-boot/17353/83 "2020-06-03T08:02:26Z")

</div>

Well, I'm amazed and delighted but I was able to bring that SD card back to life.  
The apt-get update had borked in the middle of its run and deleted most of the files from the `/boot` folder leaving only a couple of text files and an `overlay` folder. I [redownloaded](https://www.raspberrypi.org/forums/viewtopic.php?p=1318681&sid=96b572879c5383fed2ebb3f59233a2e1#p1318681) the files from [here](https://github.com/raspberrypi/firmware/tree/master/boot) and to my intense delight I'm back up and running.

I have noticed that my disk usage is somehow hovering around 98-98% and I'm wondering if that's why the script is failing to work properly (even though it initially thinks it has worked).

So I'll run some reports to see what if anything I can purge then have another go.

I'd just reimage the disk if I didn't know reconfiguring FreePBX from restoring from backups is going to be an absolute PITA. The FreePBX backup/restore is a hot mess.

This is still a very curious problem when running from the user's session works perfectly but running as a service just ...won't. 🙂 🙂

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

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