Read the statement by Michael Teeuw here.
Auto start does not work
-
Here you have the solution!
Good Luck!
-
Hi
I tried this procedure but it did not work. I still have the same automatic restart problem.
Thank you. -
See my previous post here: https://forum.magicmirror.builders/topic/1094/pm2-mm2-not-starting-on-start-up/20
This method may help you:
Set
pm2
to startup usingsystemd
with userpi
and home directory/home/pi
sudo pm2 startup systemd -u pi --hp /home/pi
And then use
pm2 save
to save the state. -
Hi
I followed instructions now it works and I figured out how it works.
THank you so much -
I installed Nodejs 9.8.0 on my raspberry Pi 3 model B before run the installation script for raspberry.
MagicMirror does not autostart until I found a fix on internet:
sudo env PATH=$PATH:/usr/local/bin pm2 startup systemd -u pi --hp /home/pi -
@greda, I was able to figure a solution I’d sort of seen elsewhere to this exact issue, as I was having the same problem. Created an account to document the solution as this is the first thread that comes up when searching for a solution.
On a completely clean installation, and copy/pasting the terminal commands to install, I could get MM running just fine using pm2, but it would not auto-start. As it turns out, I missed a part of the auto-start instructions, and this caused the problem. Here’s my solution:
- Look for the step “Starting PM2 on Boot”
- Command is “pm2 startup”
- There’s an instruction line there that’s easy to miss, which is this: "PM2 will now show you a command you need to execute."
- IN THE TERMINAL, there is an output to the “pm2 startup” command when it’s done running saying that you need to copy and then re-paste to sent environmental variables
- Copy/paste the output text from “pm2 startup” out of, then back into, Terminal
- Proceed with the rest of the auto-start instructions as documented
This cleanly and easily solved the issue for me - it’s an easy step in the instructions to miss as it’s the only one where you need to do something with the output of the setup commands.
-
@ntmatter you can also run the fixuppm2 script from my automation library listed as alternative in the mm doc