Node Red Autoboot in Jetson error

Hi,

I am running the node-red server in jetson nano.
But I cannot get the auto boot working.

nvidia@nvidia-desktop:~$ sudo systemctl enable nodered.service
Failed to enable unit: Unit file nodered.service does not exist.

I follow this link

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

sudo apt-get install -y nodejs build-essential

sudo npm install -g node-red
It works.

But when I try to make the node red to auto boot by following this link
https://nodered.org/docs/getting-started/raspberrypi
It fails…
Is there a different between raspberry pi and jetson nano?

And I also tried PM2, just cannot autoboot…
https://nodered.org/docs/faq/starting-node-red-on-boot

vidia@nvidia-desktop:~$ sudo npm install -g pm2
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
/usr/bin/pm2 -> /usr/lib/node_modules/pm2/bin/pm2
/usr/bin/pm2-dev -> /usr/lib/node_modules/pm2/bin/pm2-dev
/usr/bin/pm2-docker -> /usr/lib/node_modules/pm2/bin/pm2-docker
/usr/bin/pm2-runtime -> /usr/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})

+ pm2@5.1.2
updated 1 package in 19.425s
nvidia@nvidia-desktop:~$ which node-red
/usr/bin/node-red
nvidia@nvidia-desktop:~$ pm2 start /usr/bin/node-red -- -v
[PM2] Spawning PM2 daemon with pm2_home=/home/nvidia/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/bin/node-red in fork_mode (1 instance)
[PM2] Done.
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ node-red           │ fork     │ 0    │ online    │ 0%       │ 27.0mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
nvidia@nvidia-desktop:~$ pm2 info node-red
 Describing process with id 0 - name node-red 
┌───────────────────┬───────────────────────────────────────────┐
│ status            │ online                                    │
│ name              │ node-red                                  │
│ namespace         │ default                                   │
│ version           │ N/A                                       │
│ restarts          │ 0                                         │
│ uptime            │ 9s                                        │
│ script path       │ /usr/bin/node-red                         │
│ script args       │ -v                                        │
│ error log path    │ /home/nvidia/.pm2/logs/node-red-error.log │
│ out log path      │ /home/nvidia/.pm2/logs/node-red-out.log   │
│ pid path          │ /home/nvidia/.pm2/pids/node-red-0.pid     │
│ interpreter       │ node                                      │
│ interpreter args  │ N/A                                       │
│ script id         │ 0                                         │
│ exec cwd          │ /home/nvidia                              │
│ exec mode         │ fork_mode                                 │
│ node.js version   │ 14.18.3                                   │
│ node env          │ N/A                                       │
│ watch & reload    │ ✘                                         │
│ unstable restarts │ 0                                         │
│ created at        │ 2022-01-27T09:44:05.492Z                  │
└───────────────────┴───────────────────────────────────────────┘
 Actions available 
┌────────────────────────┐
│ km:heapdump            │
│ km:cpu:profiling:start │
│ km:cpu:profiling:stop  │
│ km:heap:sampling:start │
│ km:heap:sampling:stop  │
└────────────────────────┘
 Trigger via: pm2 trigger node-red <action_name>

 Code metrics value 
┌────────────────────────┬───────────┐
│ Heap Size              │ 62.46 MiB │
│ Heap Usage             │ 43.78 %   │
│ Used Heap Size         │ 27.35 MiB │
│ Active requests        │ 0         │
│ Active handles         │ 4         │
│ Event Loop Latency     │ 2.61 ms   │
│ Event Loop Latency p95 │ 656.25 ms │
└────────────────────────┴───────────┘
 Divergent env variables from local env 


 Add your own code metrics: http://bit.ly/code-metrics
 Use `pm2 logs node-red [--lines 1000]` to display logs
 Use `pm2 env 0` to display environment variables
 Use `pm2 monit` to monitor CPU and Memory usage node-red
nvidia@nvidia-desktop:~$ pm2 logs node-red
[TAILING] Tailing last 15 lines for [node-red] process (change the value with --lines option)
/home/nvidia/.pm2/logs/node-red-error.log last 15 lines:
/home/nvidia/.pm2/logs/node-red-out.log last 15 lines:
0|node-red | ---------------------------------------------------------------------
0|node-red | Your flow credentials file is encrypted using a system-generated key.
0|node-red | 
0|node-red | If the system-generated key is lost for any reason, your credentials
0|node-red | file will not be recoverable, you will have to delete it and re-enter
0|node-red | your credentials.
0|node-red | 
0|node-red | You should set your own key using the 'credentialSecret' option in
0|node-red | your settings file. Node-RED will then re-encrypt your credentials
0|node-red | file using your chosen key the next time you deploy a change.
0|node-red | ---------------------------------------------------------------------
0|node-red | 
0|node-red | 27 Jan 17:44:10 - [info] Starting flows
0|node-red | 27 Jan 17:44:10 - [info] Started flows
0|node-red | 27 Jan 17:44:10 - [info] Server now running at http://127.0.0.1:1880/

^C
nvidia@nvidia-desktop:~$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /home/nvidia/.pm2/dump.pm2
nvidia@nvidia-desktop:~$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u nvidia --hp /home/nvidia
nvidia@nvidia-desktop:~$ pm2 startup systemd
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u nvidia --hp /home/nvidia
nvidia@nvidia-desktop:~$ sudo vi /etc/init.d/pm2-init.sh

Thx

I have no idea for Node Red, suggest to contact with the author of the Node Red or ask question there.

Oh, because I just want to know how to start a service after bootup in jetson, not just node-red.
Coz I assume the jetson system is similiar to raspberry pi…
Thx

Hi,

How to enable a service has no difference between a vanilla ubuntu and jetson.

For example, you can add a systemd service.

Oh yes, I use another nano and the reboot works. Thx

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