MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    PM2 MM2 Not starting on start up

    Scheduled Pinned Locked Moved Troubleshooting
    37 Posts 12 Posters 35.5k Views 12 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      eugekiller
      last edited by

      Ok so i figured out how to exit out of MM. But its still not starting after reboot. Can anyone help me or is there anything i can try to do.

      bheplerB 1 Reply Last reply Reply Quote 0
      • bheplerB Offline
        bhepler Module Developer @eugekiller
        last edited by

        @eugekiller When you say “loads into NOOB”, I presume you mean that it gives you a command line interface that looks like this: pi@RaspMirror:~ $ instead of starting your mirror?

        If that is correct, I believe you need to configure your Pi to start the graphical interface. From the command line, run the configuration program: sudo raspi-config. Navigate to the boot options and tell it to boot to the Desktop Autologin option. When you hit OK enough times, it will ask you to reboot. Do so and report back.

        1 Reply Last reply Reply Quote 0
        • E Offline
          eugekiller
          last edited by

          Noobs is the PI noobs interface almost like a windows (https://www.raspberrypi.org/downloads/noobs/). From there i can select terminal and then i get the pi@raspMirror:~ $. PM2 seems to work and is linked because when i type pm2 start mm.sh it does load MM. So I assume that PM2 is linked with MM since i can load it through PM2. So for some reason PM2 is just not loading it on start up.

          Ok so i did the config option that you said and still no luck. Is there a way to uninstall PM2 so i can try to reload it again?

          bheplerB 1 Reply Last reply Reply Quote 0
          • bheplerB Offline
            bhepler Module Developer @eugekiller
            last edited by

            @eugekiller Sure. sudo npm uninstall -g pm2

            When you installed PM2, did you copy & run the command it displayed for you?

            1 Reply Last reply Reply Quote 0
            • E Offline
              eugekiller
              last edited by

              Yes it did I will try to uninstall and install it back. Thanks B.

              1 Reply Last reply Reply Quote 0
              • E Offline
                eugekiller
                last edited by

                Well Just reinstalled PM2 and still nothing. Using this guide not sure if everything is correct on that. https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror

                Is there a way to see if PM2 is even trying to load MM on start up. Or maybe something wrong with this command:
                cd ~/MagicMirror
                DISPLAY=:0 npm start

                1 Reply Last reply Reply Quote 0
                • E Offline
                  eugekiller
                  last edited by

                  Ok so i also tryed to do pm2 lists and there is nothing in the list. Does that mean anything?

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    eugekiller
                    last edited by

                    Ok so i started doing some more digging. First i have a question PM2 does it actually load MM from a full reboot? meaning power off to RPI and a full start.

                    The reason i ask is because
                    When i open terminal in RPI and type npm start from MM directory it loads MM without any problems. Then i hit Ctrl Q it quits.
                    Then i do PM2 list and gives me 0 apps running.
                    Then I do pm2 start mm.sh again loads MM without a problem. Then i hit Ctrl Q it exits MM for about 10sec and then loads it back. During the 10sec I did pm2 list again and it said MM is running.

                    So I dont think PM2 is actually loading MM from a full reboot.

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      eugekiller
                      last edited by

                      BINGO Got it to work. Not sure if others had a problem with this or its something new. but here it is.

                      However, there is a bug on the generated startup script that prevents PM2 from automatically run at startup. You will need to edit /etc/init.d/pm2-init.sh and

                      replace: export PM2_HOME=“/root/.pm2”
                      with: export PM2_HOME=“/home/pi/.pm2”

                      Got this from here: https://bekti.io/automatically-start-a-node-js-application-on-raspberry-pi/

                      S 1 Reply Last reply Reply Quote 2
                      • S Offline
                        sebzx10r @eugekiller
                        last edited by

                        @eugekiller

                        Hey,I’m having this exact same issue. I’m trying to follow your steps but I can’t locate the pm2-init.sh file. I have the pm2 installed. I go follow the same directory paths as stated but that one file isn’t there. Any ideas about where the file is? It has to exist somewhere since I’m able to use it.

                        E 3 Replies Last reply Reply Quote 0
                        • E Offline
                          eugekiller @sebzx10r
                          last edited by

                          @sebzx10r Its directory is /etc/init.d/pm2-init.sh

                          1 Reply Last reply Reply Quote 0
                          • E Offline
                            eugekiller @sebzx10r
                            last edited by

                            @sebzx10r The way i did it also is used WinSCP to shh in to raspberry.

                            1 Reply Last reply Reply Quote 0
                            • E Offline
                              eugekiller @sebzx10r
                              last edited by

                              @sebzx10r Can you load MM with pm2 start mm.sh?

                              1 Reply Last reply Reply Quote 0
                              • S Offline
                                sebzx10r
                                last edited by

                                Hey,yes, I go to that same exact directory,but the file isn’t there. And yes I can load MM with pm2 start mm.sh. That’s what so weird about the whole thing. It’s as if the file doesn’t exist but yet the program is working somehow.

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  sebzx10r
                                  last edited by

                                  Hey,I kind of did a work around. I found this on another forum:
                                  I also searched for days without success but then, I got it to work quite simply.

                                  In Raspian click Menu,Preferences,Main Menu Editor
                                  Click Preferences and check Default applications for LXSession
                                  Click OK and close main menu editor
                                  Now click Menu and Under Preferences click on Default applications for LXSession
                                  LXSession configuration opens
                                  Click Autostart
                                  Under Manual autostarted applications paste in your java command line
                                  click add
                                  close the LXSession configuration application and reboot your pi
                                  your java app should run after reboot

                                  N 1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    nuckinfutz @sebzx10r
                                    last edited by

                                    @sebzx10r What line did you put in the field? I can’t get it to work.

                                    D 1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      Desertswing @nuckinfutz
                                      last edited by

                                      @nuckinfutz
                                      pm2 start mm.sh

                                      1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        shbatm Module Developer
                                        last edited by

                                        I solved the same issue by using the command:
                                        sudo pm2 startup systemd -u pi --hp /home/pi

                                        And then using pm2 save to save the state.

                                        D D 2 Replies Last reply Reply Quote 2
                                        • D Offline
                                          Desertswing @shbatm
                                          last edited by

                                          @shbatm
                                          will note that down thanks!

                                          R 1 Reply Last reply Reply Quote 0
                                          • R Offline
                                            raymate @Desertswing
                                            last edited by

                                            @Desertswing No idea what that did but it worked, just need to make it show the weather as that seems to have gone away

                                            Pi zero W and Pi 3

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy