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.

    Brand New Install works until I enable PM2 Autostart

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    9 Posts 3 Posters 1.3k Views 3 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.
    • S Offline
      sdetweil @cowlam
      last edited by

      @cowlam did you do these steps?

      https://docs.magicmirror.builders/configuration/autostart.html#using-pm2

      if YOU execute mm.sh does it open MM?

      so, if you do

      pm2 status
      

      then

      pm2 remove 0
      pm2 save
      

      then resume the steps

      pm2 start mm.sh
      

      if it starts then

      pm2 save
      

      or , you can use my scripts. (remove the entry in pm2 first so you don’t get two)

      see
      https://github.com/sdetweil/MagicMirror_scripts

      the last script on that page will setup pm2 to launch mm

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      C 1 Reply Last reply Reply Quote 0
      • C Offline
        cowlam @sdetweil
        last edited by

        @sdetweil Thank You for the suggestions.

        It launches correctly with “pm2 start mm.sh”.
        But when I then run “pm2 save” and stop mm and start it again it launches the black Electron screen.
        So I then remove it (had to run “pm2 del 0”), and save (pm2 save --force).
        Then I ran “pm2 start mm.sh” again.
        I then ran “pm2 stop mm”.
        Then I ran “pm2 save”.
        I can successfully run “pm2 start mm.sh” after that providing I saved it in the stopped state.
        But that means when the pi reboots it isn’t started automatically.

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @cowlam
          last edited by

          @cowlam don’t do the pm2 stop

          pm2 start mm.sh
          pm2 save

          then pm2 restart 0 (or mm), pm2 status will show you the managed apps…
          can address by number or name or all (if u want to affect all apps)

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            cowlam @sdetweil
            last edited by

            @sdetweil

            pm2 start mm.sh
            Magic Mirror launches successfully

            pm2 save
            pm2 restart 0 (can confirm that is the correct id from pm2 status - only one entry which is mm)
            Magic Mirror is closed down… and an black Electron window opens and does not change ever after several minutes.
            If I right-click the Electron window and close it, after a few seconds the Magic Mirror launches successfully again on its own.

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @cowlam
              last edited by

              @cowlam weird…

              can you reboot and tell what happens

              can u show the mm.sh

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                cowlam @sdetweil
                last edited by

                @sdetweil
                After my last post I ran pm2 restart 0 and it restarted MM correctly.
                But after I rebooted it was back to launching the black Electron screen.

                mm.sh looks like this:

                cd ./MagicMirror
                DISPLAY=:0 npm start

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @cowlam
                  last edited by sdetweil

                  @cowlam can u change the cd line to

                  cd ~/MagicMirror
                  

                  the one u have is MagicMirror from here (.)
                  not MagicMirror from user home (~)

                  also the pm2 status line has a column with a circled arrow header, that is restarts
                  and after 5 rapid it stops

                  I suspect the cd doesn’t work, mm doesn’t start,
                  but the saved info says u need electron started.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  BKeyportB 1 Reply Last reply Reply Quote 0
                  • BKeyportB Offline
                    BKeyport Module Developer @sdetweil
                    last edited by

                    @sdetweil Sam: Just to let you know, if PM2 is not running any tasks, it won’t save with a plain pm2 save - you have to use pm2 save --force to clear the list after deleting everything.

                    The "E" in "Javascript" stands for "Easy"

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • 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