<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can't get pm2 to auto launch after reboot]]></title><description><![CDATA[<p dir="auto">I’ve Done all of the below steps bit it till wont auto launch when i reboot the PI</p>
<p dir="auto">We want Magic Mirror to start up automatically, so type in the following command:<br />
pm2 startup</p>
<p dir="auto">Now create a shell script for startup. Open up the built-in text editor on the Pi by typing in:<br />
cd ~<br />
nano <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a><br />
The lower line basically means, “open up a file called <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> in the nano text editor.”</p>
<p dir="auto">When the text editor has opened, add this to the <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a> file:<br />
cd ~/MagicMirror<br />
DISPLAY=:0 npm start<br />
Exit the editor by pressing ctrl+x and type in y to save the file.</p>
<p dir="auto">Make your shiny new script executable by typing in:<br />
chmod +x <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a></p>
<p dir="auto">Now start up Magic Mirror and make it start up on boot:<br />
pm2 start <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a></p>
<p dir="auto">pm2 save</p>
<p dir="auto">Now, reboot your Pi by typing in<br />
sudo reboot</p>
]]></description><link>https://forum.magicmirror.builders/topic/10002/can-t-get-pm2-to-auto-launch-after-reboot</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 00:18:15 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/10002.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Mar 2019 08:38:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can't get pm2 to auto launch after reboot on Sat, 09 Mar 2019 09:37:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
i had the same problem the last weeks.<br />
It looks like pm2 creates the startup script for systemd with wrong parameters.<br />
You should check if there exists a file “/etc/systemd/systemd/pm2-pi.service”<br />
In my case the file existed but contained the following lines:</p>
<p dir="auto">USER=root which should be USER=pi<br />
Environment=PM2_HOME=/root/.pm2 which should be Environment=PM2_HOME=/home/pi/.pm2<br />
PIDFile=/root/.pm2/pm2.pid which should be PIDFile=/home/pi/.pm2/pm2.pid</p>
<p dir="auto">If the file does not exist you can create it with:<br />
sudo pm2 startup systemd -u pi</p>
<p dir="auto">But you need to check the values again after creating it.<br />
In the end you can enable the script with:<br />
sudo systemd enable pm2-pi.service</p>
<p dir="auto">The parts in described by <a class="plugin-mentions-user plugin-mentions-a" href="/user/chris" aria-label="Profile: Chris">@<bdi>Chris</bdi></a>  are needed as well</p>
]]></description><link>https://forum.magicmirror.builders/post/53979</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53979</guid><dc:creator><![CDATA[wishmaster270]]></dc:creator><pubDate>Sat, 09 Mar 2019 09:37:38 GMT</pubDate></item><item><title><![CDATA[Reply to Can't get pm2 to auto launch after reboot on Sat, 09 Mar 2019 09:30:04 GMT]]></title><description><![CDATA[<p dir="auto">Hello,<br />
test this:</p>
<p dir="auto"><em><strong>there is an existing script provided by MagicMirror now, please try deleting everything on your ~/.pm2 directory, then using:</strong></em></p>
<pre><code>sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
    pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
    pm2 save
</code></pre>
<p dir="auto">You may have to use <em><strong>systemd</strong></em> instead of <em><strong>linux</strong></em> in the first line if you get an error.</p>
<p dir="auto">This solution is not mine but Shbatm.</p>
<p dir="auto">See this post: <a href="https://forum.magicmirror.builders/topic/1094/pm2-mm2-not-starting-on-start-up/26">Here</a></p>
<p dir="auto">cordially</p>
]]></description><link>https://forum.magicmirror.builders/post/53978</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53978</guid><dc:creator><![CDATA[Chris]]></dc:creator><pubDate>Sat, 09 Mar 2019 09:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to Can't get pm2 to auto launch after reboot on Sat, 09 Mar 2019 09:24:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gmgarcia719" aria-label="Profile: gmgarcia719">@<bdi>gmgarcia719</bdi></a> said in <a href="/post/53974">Can't get pm2 to auto launch after reboot</a>:</p>
<blockquote>
<p dir="auto">pm2 start <a href="http://mm.sh" target="_blank" rel="noopener noreferrer nofollow ugc">mm.sh</a><br />
pm2 save</p>
</blockquote>
<p dir="auto">instead try<br />
pm2 start mm</p>
<p dir="auto">pm2 save</p>
<p dir="auto">ejay</p>
]]></description><link>https://forum.magicmirror.builders/post/53975</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/53975</guid><dc:creator><![CDATA[ejay-ibm]]></dc:creator><pubDate>Sat, 09 Mar 2019 09:24:00 GMT</pubDate></item></channel></rss>