# Raspberry Pi - start service at boot - clarification

**URL:** https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109
**Category:** General
**Created:** [31 January 2021 13:33 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109 "2021-01-31T13:33:43Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Pi-DD](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pi-dd/32/36265_2.png) [@Pi-DD](https://discourse.nodered.org/u/Pi-DD)
#### Post date: [31 January 2021 13:33 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/1 "2021-01-31T13:33:43Z")

</div>

The installation notes for Raspberry pi explain the need to start node-red with the specific Pi command and pass the parameter that tells Node.js to free up space earlier than it would normally do.

```auto
node-red-pi --max-old-space-size=256

```

But it does not explain whether you need, or how, to do the same thing if you set it up as a service to start at boot.

Could somebody clarify if it is wise/necessary to use the special Pi command in that case, and if so - how.

Thanks

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [31 January 2021 13:40 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/2 "2021-01-31T13:40:20Z")

</div>

I've been running Node-RED on PiZeros for years without doing that command

And all my Pi are running full desktops so that would make them even more memory constrained

Not noticed any issues at all

---

<div class="post-metadata">

### Author: ![Pi-DD](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pi-dd/32/36265_2.png) [@Pi-DD](https://discourse.nodered.org/u/Pi-DD)
#### Post date: [31 January 2021 13:47 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/3 "2021-01-31T13:47:58Z")

</div>

Thanks! I had not noticed any negative effect, but was just curious and did not want to wake up one morning to find my Pi's were memory bound!

---

<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 January 2021 13:49 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/4 "2021-01-31T13:49:48Z")

</div>

If you use the [recommended install script](https://nodered.org/docs/getting-started/raspberrypi) then it sets up a reasonable default value in the systemd startup script.

---

<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: [31 January 2021 14:22 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/5 "2021-01-31T14:22:19Z")

</div>

When you run as a service it uses the nodered.service file we configure to start up... this is usually at `/lib/systemd/system/nodered.service` - so you can look at that to see how we have defaulted it to your device. (and indeed edit it if you want)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 January 2021 14:34 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/6 "2021-01-31T14:34:53Z")

</div>

The option helps Node.js steer when it does garbage collection of allocated space that is no longer needed. Because GC is an overhead, it isn't done unless really needed.

So the option wouldn't have any impact unless you happen to hit a situation where you are filling up and emptying the stack quite rapidly coupled with constrained memory.

It was recommended at one stage by Nick & Dave because we were seeing quite a few cases of out-of-memory issues and constraining the GC process seemed to help. Since then, perhaps node.js and the underlying V8 engine have gotten more efficient. Perhaps the CG process is also now more efficient. Maybe Node-RED is also more efficient.

But you are right. For most people, most of the time, they will not get much, if any benefit from that option.

---

<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 January 2021 14:40 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/7 "2021-01-31T14:40:11Z")

</div>

> [@dceejay](#):
>
> this is usually at /var/systemd/system/nodered.service

I think it is /lib/systemd/system/nodered.service on a pi.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 January 2021 14:49 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/8 "2021-01-31T14:49:34Z")

</div>

The following will tell you where everything is actually located:

```auto
home@home:~$ ls -la /etc/systemd/system
total 40
drwxr-xr-x 10 root root 4096 Dec 8 23:02 .
drwxr-xr-x 5 root root 4096 Dec 6 06:32 ..
drwxr-xr-x 2 root root 4096 Feb 8 2020 bluetooth.target.wants
lrwxrwxrwx 1 root root 42 Feb 8 2020 dbus-fi.w1.wpa_supplicant1.service -> /lib/systemd/system/wpa_supplicant.service
lrwxrwxrwx 1 root root 37 Feb 8 2020 dbus-org.bluez.service -> /lib/systemd/system/bluetooth.service
lrwxrwxrwx 1 root root 40 Dec 8 23:02 dbus-org.freedesktop.ModemManager1.service -> /lib/systemd/system/ModemManager.service
lrwxrwxrwx 1 root root 53 Dec 8 23:02 dbus-org.freedesktop.nm-dispatcher.service -> /lib/systemd/system/NetworkManager-dispatcher.service
lrwxrwxrwx 1 root root 45 Feb 8 2020 dbus-org.freedesktop.timesync1.service -> /lib/systemd/system/systemd-timesyncd.service
drwxr-xr-x 2 root root 4096 Feb 8 2020 getty.target.wants
drwxr-xr-x 2 root root 4096 Dec 8 23:02 graphical.target.wants
lrwxrwxrwx 1 root root 36 Feb 9 2020 influxd.service -> /lib/systemd/system/influxdb.service
drwxr-xr-x 2 root root 4096 Dec 31 13:52 multi-user.target.wants
drwxr-xr-x 2 root root 4096 Dec 8 23:02 network-online.target.wants
lrwxrwxrwx 1 root root 39 Feb 10 2020 nrmain.service -> /home/home/nrmain/system/nrmain.service
drwxr-xr-x 2 root root 4096 Dec 8 23:01 sockets.target.wants
lrwxrwxrwx 1 root root 31 Feb 8 2020 sshd.service -> /lib/systemd/system/ssh.service
drwxr-xr-x 2 root root 4096 Feb 8 2020 sysinit.target.wants
lrwxrwxrwx 1 root root 35 Feb 8 2020 syslog.service -> /lib/systemd/system/rsyslog.service
drwxr-xr-x 2 root root 4096 Feb 9 2020 timers.target.wants
home@home:~$

```

---

<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 January 2021 15:10 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/9 "2021-01-31T15:10:08Z")

</div>

> [@TotallyInformation](#):
>
> `ls -la /etc/systemd/system`

Or possibly (in the case of Ubuntu and Raspbian)  
`ls -la /etc/systemd/system/multi-user.target.wants/`  
It doesn't appear in /etc/systemd/system.

I think the best way is  
`sudo systemctl status nodered`  
which will tell you where it actually is.

---

<div class="post-metadata">

### Author: ![Pi-DD](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pi-dd/32/36265_2.png) [@Pi-DD](https://discourse.nodered.org/u/Pi-DD)
#### Post date: [31 January 2021 16:36 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/10 "2021-01-31T16:36:48Z")

</div>

> [@Pi-DD](#):
>
> ```auto
> 
> ```

Thank you to everyone for their swift responses!

The config is in /lib/systemd/system on mi Pi and the setting is  
Environment="NODE\_OPTIONS=--max\_old\_space\_size=512"

I'm going to leave well alone for now as nobody seems to have had a problem (and neither have I!) with that setting, but at least I now know where to look!

Matter closed, thanks once again!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [14 February 2021 16:37 UTC](https://discourse.nodered.org/t/raspberry-pi-start-service-at-boot-clarification/40109/11 "2021-02-14T16:37:09Z")

</div>

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