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.

    Starting mirror with PM2 on boot

    Scheduled Pinned Locked Moved Solved Troubleshooting
    7 Posts 2 Posters 2.0k Views 2 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
      eitan
      last edited by

      Hi all,

      I have a Pi3, running Magic mirror.
      grep version ~/MagicMirror/package.json:
      “version”: “2.26.0”,
      node ver:
      v20.10.0
      uname -a:
      Linux xxxxPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
      lsb_release -a:
      No LSB modules are available.
      Distributor ID: Debian
      Description: Debian GNU/Linux 11 (bullseye)
      Release: 11
      Codename: bullseye

      last I installed and run the PM2.
      followed the instruction “AutoStart your MagicMirror²” , Magic mirror starts OK with the command: “pm2 start mm.sh”
      Last on the install list, enabling restarting of the Magic Mirror is the command pm2 save that ends successfully (no errors).
      rebooting the Pi, Magic Mirror will not start automatically.
      running pm2 logs I see 2 errors:
      0|mm | [1876:0121/103318.925547:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
      0|mm | /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT

      can anybody help on this?
      Thank you

      S 1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil @eitan
        last edited by

        @eitan ok let’s check mm first

        cd ~/MagicMirror
        npm start
        

        does it start?
        if not show me the message from the terminal window

        those freedesktop messages are junk.

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        E 1 Reply Last reply Reply Quote 0
        • E Offline
          eitan @sdetweil
          last edited by

          @sdetweil

          Thank you for your replay.

          Yes, Magic Mirror starts with npm start,
          It also starts with PM2, when running it after boot - pm2 start mm.
          what I have not been able to do is for it to start automatically after boot.

          S 1 Reply Last reply Reply Quote 0
          • S Away
            sdetweil @eitan
            last edited by

            @eitan ok, I have not used the install instructions for pm2,
            as I have an install script that does all the work ,

            you can use the fixuppm2 script
            it uses a different mm.sh, whcih we ship, in the MagicMirror/installers folder

            see this
            https://github.com/sdetweil/MagicMirror_scripts?tab=readme-ov-file#add-using-pm2-to-autostart-magicmirror-at-bootup

            you will have to delete one of the entries from pm2 after this so you don’t try to start 2.

            see

            pm2 --help
            

            for the command syntax

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            E 1 Reply Last reply Reply Quote 0
            • E Offline
              eitan @sdetweil
              last edited by

              @sdetweil

              Hi sdetweil (as I don’t have your name),

              Thank you, this worked perfect.
              I ran the script, afterwards PM2 had a second line in it named MagicMirror.
              PM2.JPG I deleted my own mm line (PM2 delete mm) and was left with only MagicMirror in PM2
              PM2_2.JPG
              Stopped started the MagicMirror with PM2 and got an warning from PM2 about the incorrect mm:
              [PM2][WARN] Current process list is not synchronized with saved list. App mm differs. Type ‘pm2 save’ to synchronize.
              Saved the new status PM2 save
              Rebooted the Pi and MagicMirror was up after boot.

              I was wondering if you can share the content of MagicMirror.sh (if it is an .sh script), so that I can understand what’s the different

              In any case, thank you

              S 1 Reply Last reply Reply Quote 0
              • S Away
                sdetweil @eitan
                last edited by

                @eitan my name is in each of my replies.

                the script is ~/MagicMirror/installers/mm.sh

                you can also give pm2 a json file with a more descriptive name.

                see the file I create
                ~/MagicMirror/installers/pm2_magicmirror.json

                see pm2 --help for all the things it can do

                by convention, each command is to provide help 2 ways.

                one in response to the only Parm --help and some usage man(ual) page(s)

                so

                man pm2 
                

                will.open that for pm2

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                E 1 Reply Last reply Reply Quote 0
                • E Offline
                  eitan @sdetweil
                  last edited by

                  @sdetweil

                  Thank you Sam, for all your help.

                  I can close the issue now.

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