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.

    Autostarts but doesn't run, will run on restart

    Scheduled Pinned Locked Moved Solved Troubleshooting
    47 Posts 3 Posters 19.1k 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.
    • E Offline
      ember1205 @sdetweil
      last edited by

      @sdetweil

      armv71

      I’ve modified my shutdown control to stop MM, wipe the .config/chromium directory, and then power off. This allows chromium to load the correct information when it does finally launch.

      There still remains an issue, however, with the run-start.sh script actually launching the chromium browser on boot. The log file basically ends with “0|mm | Ready to go! Please point your browser to: http://0.0.0.0:8080” on boot up. “pm2 restart mm” correctly brings everything up every time.

      Here’s what the log looks like when it boots:

      0|mm       | > magicmirror@2.13.0 start
      0|mm       | > ./run-start.sh
      0|mm       |
      0|mm       | [2022-05-10 14:30:59.191] [LOG]    Starting MagicMirror: v2.13.0
      0|mm       | [2022-05-10 14:30:59.207] [LOG]    Loading config ...
      0|mm       | [2022-05-10 14:30:59.222] [LOG]    Loading module helpers ...
      0|mm       | [2022-05-10 14:31:00.614] [LOG]    Initializing new module helper ...
      0|mm       | [2022-05-10 14:31:00.617] [LOG]    Module helper loaded: MMM-ImagesPhotos
      0|mm       | [2022-05-10 14:31:00.625] [LOG]    No helper found for module: alert.
      0|mm       | [2022-05-10 14:31:00.733] [LOG]    Initializing new module helper ...
      0|mm       | [2022-05-10 14:31:00.735] [LOG]    Module helper loaded: updatenotification
      0|mm       | [2022-05-10 14:31:00.741] [LOG]    No helper found for module: clock.
      0|mm       | [2022-05-10 14:31:01.058] [LOG]    Initializing new module helper ...
      0|mm       | [2022-05-10 14:31:01.060] [LOG]    Module helper loaded: calendar
      0|mm       | [2022-05-10 14:31:01.068] [LOG]    No helper found for module: currentweather.
      0|mm       | [2022-05-10 14:31:01.072] [LOG]    No helper found for module: weatherforecast.
      0|mm       | [2022-05-10 14:31:01.074] [LOG]    All module helpers loaded.
      0|mm       | [2022-05-10 14:31:02.616] [LOG]    Starting server on port 8080 ...
      0|mm       | [2022-05-10 14:31:02.665] [LOG]    Server started ...
      0|mm       | [2022-05-10 14:31:02.680] [LOG]    Connecting socket for: MMM-ImagesPhotos
      0|mm       | [2022-05-10 14:31:02.683] [LOG]    Starting node helper for: MMM-ImagesPhotos
      0|mm       | [2022-05-10 14:31:02.685] [LOG]    Connecting socket for: updatenotification
      0|mm       | [2022-05-10 14:31:02.693] [LOG]    Connecting socket for: calendar
      0|mm       | [2022-05-10 14:31:02.700] [LOG]    Starting node helper for: calendar
      0|mm       | [2022-05-10 14:31:02.702] [LOG]    Sockets connected & modules started ...
      0|mm       | [2022-05-10 14:31:02.704] [LOG]
      0|mm       | Ready to go! Please point your browser to: http://0.0.0.0:8080
      
      
      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @ember1205
        last edited by

        @ember1205 ok,

        lets edit run-start.sh t- enable some more debugging

        in the 1st line add -x to the change the 1st line to

        #!/bin/bash -x
        

        then pm2 flush
        then do the reboot which causes mm not to come up.

        then pm2 logs --lines=100

        the debug output will come out in the error listing of the two listings displayed

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        E 3 Replies Last reply Reply Quote 0
        • E Offline
          ember1205 @sdetweil
          last edited by

          @sdetweil

          Full logs…

          [TAILING] Tailing last 100 lines for [all] processes (change the value with --lines option)
          /home/pi/.pm2/pm2.log last 100 lines:
          PM2        | 2022-05-10T15:00:25: PM2 log: PM2 successfully stopped
          PM2        | 2022-05-10T15:00:44: PM2 log: ===============================================================================
          PM2        | 2022-05-10T15:00:44: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
          PM2        | 2022-05-10T15:00:44: PM2 log: Time                 : Tue May 10 2022 15:00:44 GMT-0400 (Eastern Daylight Time)
          PM2        | 2022-05-10T15:00:44: PM2 log: PM2 version          : 4.4.1
          PM2        | 2022-05-10T15:00:44: PM2 log: Node.js version      : 16.15.0
          PM2        | 2022-05-10T15:00:44: PM2 log: Current arch         : arm
          PM2        | 2022-05-10T15:00:44: PM2 log: PM2 home             : /home/pi/.pm2
          PM2        | 2022-05-10T15:00:44: PM2 log: PM2 PID file         : /home/pi/.pm2/pm2.pid
          PM2        | 2022-05-10T15:00:44: PM2 log: RPC socket file      : /home/pi/.pm2/rpc.sock
          PM2        | 2022-05-10T15:00:44: PM2 log: BUS socket file      : /home/pi/.pm2/pub.sock
          PM2        | 2022-05-10T15:00:44: PM2 log: Application log path : /home/pi/.pm2/logs
          PM2        | 2022-05-10T15:00:44: PM2 log: Worker Interval      : 30000
          PM2        | 2022-05-10T15:00:44: PM2 log: Process dump file    : /home/pi/.pm2/dump.pm2
          PM2        | 2022-05-10T15:00:44: PM2 log: Concurrent actions   : 2
          PM2        | 2022-05-10T15:00:44: PM2 log: SIGTERM timeout      : 1600
          PM2        | 2022-05-10T15:00:44: PM2 log: ===============================================================================
          PM2        | 2022-05-10T15:00:45: PM2 log: App [mm:0] starting in -fork mode-
          PM2        | 2022-05-10T15:00:45: PM2 log: App [mm:0] online
          
          /home/pi/.pm2/logs/mm-error.log last 100 lines:
          0|mm       | + '[' -f ./untrack-css.sh ']'
          0|mm       | + grep docker /proc/1/cgroup -qa
          0|mm       | + '[' -z :0 ']'
          0|mm       | ++ uname -m
          0|mm       | + arch=armv7l
          0|mm       | + false=false
          0|mm       | ++ grep -v '^[[:blank:]]*//' config/config.js
          0|mm       | ++ grep -i serveronly:
          0|mm       | ++ awk -F: '{print tolower($2)}'
          0|mm       | ++ sed -e 's/^[[:space:]]*//'
          0|mm       | ++ tr -d ',"'\''\r'
          0|mm       | + serveronly=local
          0|mm       | + serveronly=local
          0|mm       | ++ pgrep Xorg
          0|mm       | + xorg=
          0|mm       | + '[' . == . ']'
          0|mm       | ++ pgrep X
          0|mm       | + xorg=
          0|mm       | ++ uname
          0|mm       | + mac=Linux
          0|mm       | + '[' local. '!=' false. -o armv7l == armv6l ']'
          0|mm       | + '[' local. == true. ']'
          0|mm       | + '[' . == . -a Linux '!=' Darwin ']'
          0|mm       | + node serveronly
          
          /home/pi/.pm2/logs/mm-out.log last 100 lines:
          0|mm       |
          0|mm       | > magicmirror@2.13.0 start
          0|mm       | > ./run-start.sh
          0|mm       |
          0|mm       | [2022-05-10 15:00:55.768] [LOG]    Starting MagicMirror: v2.13.0
          0|mm       | [2022-05-10 15:00:55.790] [LOG]    Loading config ...
          0|mm       | [2022-05-10 15:00:55.804] [LOG]    Loading module helpers ...
          0|mm       | [2022-05-10 15:00:57.248] [LOG]    Initializing new module helper ...
          0|mm       | [2022-05-10 15:00:57.252] [LOG]    Module helper loaded: MMM-ImagesPhotos
          0|mm       | [2022-05-10 15:00:57.264] [LOG]    No helper found for module: alert.
          0|mm       | [2022-05-10 15:00:57.385] [LOG]    Initializing new module helper ...
          0|mm       | [2022-05-10 15:00:57.387] [LOG]    Module helper loaded: updatenotification
          0|mm       | [2022-05-10 15:00:57.391] [LOG]    No helper found for module: clock.
          0|mm       | [2022-05-10 15:00:57.686] [LOG]    Initializing new module helper ...
          0|mm       | [2022-05-10 15:00:57.689] [LOG]    Module helper loaded: calendar
          0|mm       | [2022-05-10 15:00:57.692] [LOG]    No helper found for module: currentweather.
          0|mm       | [2022-05-10 15:00:57.696] [LOG]    No helper found for module: weatherforecast.
          0|mm       | [2022-05-10 15:00:57.698] [LOG]    All module helpers loaded.
          0|mm       | [2022-05-10 15:01:00.465] [LOG]    Starting server on port 8080 ...
          0|mm       | [2022-05-10 15:01:00.504] [LOG]    Server started ...
          0|mm       | [2022-05-10 15:01:00.507] [LOG]    Connecting socket for: MMM-ImagesPhotos
          0|mm       | [2022-05-10 15:01:00.509] [LOG]    Starting node helper for: MMM-ImagesPhotos
          0|mm       | [2022-05-10 15:01:00.511] [LOG]    Connecting socket for: updatenotification
          0|mm       | [2022-05-10 15:01:00.514] [LOG]    Connecting socket for: calendar
          0|mm       | [2022-05-10 15:01:00.516] [LOG]    Starting node helper for: calendar
          0|mm       | [2022-05-10 15:01:00.517] [LOG]    Sockets connected & modules started ...
          0|mm       | [2022-05-10 15:01:00.519] [LOG]
          0|mm       | Ready to go! Please point your browser to: http://0.0.0.0:8080
          
          
          
          1 Reply Last reply Reply Quote 0
          • E Offline
            ember1205 @sdetweil
            last edited by

            @sdetweil

            Here’s a portion of the log when doing a stop and a start (without reboot):

            0|mm       | + false=false
            0|mm       | ++ grep -v '^[[:blank:]]*//' config/config.js
            0|mm       | ++ grep -i serveronly:
            0|mm       | ++ awk -F: '{print tolower($2)}'
            0|mm       | ++ sed -e 's/^[[:space:]]*//'
            0|mm       | ++ tr -d ',"'\''\r'
            0|mm       | + serveronly=local
            0|mm       | + serveronly=local
            0|mm       | ++ pgrep Xorg
            0|mm       | + xorg=755
            0|mm       | + '[' 755. == . ']'
            0|mm       | ++ uname
            0|mm       | + mac=Linux
            0|mm       | + '[' local. '!=' false. -o armv7l == armv6l ']'
            0|mm       | + '[' local. == true. ']'
            0|mm       | + '[' 755. == . -a Linux '!=' Darwin ']'
            0|mm       | + exec
            0|mm       | + read line
            0|mm       | ++ node serveronly
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.203]' '[LOG]' Starting MagicMirror: v2.13.0
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.220]' '[LOG]' Loading config ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.231]' '[LOG]' Loading module helpers ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.936]' '[LOG]' Initializing new module helper ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.938]' '[LOG]' Module helper loaded: MMM-ImagesPhotos
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:14:59.943]' '[LOG]' No helper found for module: alert.
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.042]' '[LOG]' Initializing new module helper ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.050]' '[LOG]' Module helper loaded: updatenotification
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.059]' '[LOG]' No helper found for module: clock.
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.274]' '[LOG]' Initializing new module helper ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.278]' '[LOG]' Module helper loaded: calendar
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.280]' '[LOG]' No helper found for module: currentweather.
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.282]' '[LOG]' No helper found for module: weatherforecast.
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.284]' '[LOG]' All module helpers loaded.
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.471]' '[LOG]' Starting server on port 8080 ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.496]' '[LOG]' Server started ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.498]' '[LOG]' Connecting socket for: MMM-ImagesPhotos
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.500]' '[LOG]' Starting node helper for: MMM-ImagesPhotos
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.502]' '[LOG]' Connecting socket for: updatenotification
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.504]' '[LOG]' Connecting socket for: calendar
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.505]' '[LOG]' Starting node helper for: calendar
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.506]' '[LOG]' Sockets connected '&' modules started ...
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo '[2022-05-10' '15:15:00.507]' '[LOG]'
            0|mm       | + read line
            0|mm       | + case "$line" in
            0|mm       | + echo Ready to 'go!' Please point your browser to: http://0.0.0.0:8080
            0|mm       | + break
            0|mm       | ++ echo Ready to 'go!' Please point your browser to: http://0.0.0.0:8080
            0|mm       | ++ awk -F: '{print $4}'
            0|mm       | + port=8080
            0|mm       | + echo 'Starting chromium browser now, have patience, it takes a minute'
            0|mm       | + '[' Linux '!=' Darwin ']'
            0|mm       | + tee
            0|mm       | ++ which chromium-browser
            0|mm       | + '[' /usr/bin/chromium-browser '!=' '' ']'
            0|mm       | + chromium-browser -noerrdialogs -kiosk -start_maximized --disable-infobars --app=http://localhost:8080 --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors
            
            
            1 Reply Last reply Reply Quote 0
            • E Offline
              ember1205 @sdetweil
              last edited by

              @sdetweil

              I’m seeing a discrepancy where on boot it’s collecting xorg= blank versus xorg=755 on a stop/start after boot.

              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @ember1205
                last edited by

                @ember1205 yes… I see that too…

                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
                  ember1205 @sdetweil
                  last edited by

                  @sdetweil

                  It almost seems like the X desktop isn’t fully initialized when the pgrep command executes and it isn’t collecting info on the process as a result. The restart NEVER happens until X is fully initialized which means that it -can- collect info on the process from a restart or stop/start.

                  S 1 Reply Last reply Reply Quote 0
                  • S Do not disturb
                    sdetweil @ember1205
                    last edited by

                    @ember1205 yes. I am looking for a resolution…

                    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
                      ember1205 @sdetweil
                      last edited by

                      @sdetweil

                      I just edited the run-start.sh script and inserted a ten second sleep before the pgrep command. It’s a bit “extreme”, but should hopefully demonstrate if that’s the issue.

                      WIthout the sleep, not detecting X simply moves on to a different test instead of trying again at least once before moving on.

                      S 1 Reply Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @ember1205
                        last edited by

                        @ember1205 yes, adding a sleep would ‘fix’ it

                        if only we knew how LONG to sleep… working on it…

                        if X is not running then we just launch serveronly and don’t look at its output

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        S 1 Reply Last reply Reply Quote 0
                        • S Do not disturb
                          sdetweil @sdetweil
                          last edited by

                          @sdetweil try 1 second… sleep 1

                          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
                            ember1205 @sdetweil
                            last edited by

                            @sdetweil

                            Sleep 10 allows the browser to correctly launch. I will drop to 1 second and validate that it will work or not (if not, I will tweak and tune).

                            Even with the sleep function ensuring that it allows X to finish initializing, chromium does not start correctly unless I wipe the ~/.config/chromium directory when I shut down.

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @ember1205
                              last edited by

                              @ember1205 people are constantly fiddling with stuff, you never know what you’re gonna get anymore.

                              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
                                ember1205 @sdetweil
                                last edited by

                                @sdetweil

                                Would there be more value in coding in a check for to see if it’s Raspbian or possibly even bullseye and adding a two second sleep if there is?

                                raspberry_pi=$(grep ID /etc/os-release | cut -f2 -d=)
                                if [ "$raspberry_pi." == "raspbian" ] ; then
                                   sleep 2
                                fi
                                xorg=$(pgrep Xorg)
                                

                                Maybe there’s a better string to search for, but it might be a stop-gap that would help?

                                S 1 Reply Last reply Reply Quote 0
                                • S Do not disturb
                                  sdetweil @ember1205
                                  last edited by

                                  @ember1205 i don’t think thats right… as we could have the same problem on any other system…

                                  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
                                    ember1205 @sdetweil
                                    last edited by

                                    @sdetweil

                                    Correct syntax would need to be:

                                      raspberry_pi=$(grep ^ID= /etc/os-release | cut -f2 -d=)
                                      if [ "$raspberry_pi." == "raspbian" ] ; then
                                       sleep 2
                                      fi
                                    
                                    

                                    The RPi 3B+ is a little slower to initialize on Bullseye versus Buster. Any time a device is running a slightly heavier OS and needs a little more time to finish booting up, I could see this occurring. The question is, do you solve it with a fix that impacts everyone (“sleep 2” or similar), test for particular OS/HW combo’s, or is there another process to look for that would better indicate when the system should be finished initializing?

                                    Right now, it looks for X and just “moves on” when it isn’t found and assumes some sort of mistake or something in the config. Great as a fail-safe, but creates a new occasional issue to be dealt with.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @ember1205
                                      last edited by

                                      @ember1205 that test is for when MM is running under docker (with no X running) but using the docker host’s xorg for viewing…

                                      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
                                        ember1205 @sdetweil
                                        last edited by

                                        @sdetweil

                                        The test I’m referring to checks to see if X is running. If not, it moves on to test for Lubuntu. If that also fails, it assumes server only and moves on.

                                        I do recall seeing a specific Docker test at the very beginning of the script, but that’s a fair bit earlier than where I’ve added this check (which is right before the “pgrep Xorg” line).

                                        S 1 Reply Last reply Reply Quote 0
                                        • S Do not disturb
                                          sdetweil @ember1205
                                          last edited by sdetweil

                                          @ember1205 yes… i am looking for a test that works if the system is slow…

                                          i added the rm of ./config folder and my pi 0 now comes up instead of the chrome desktop
                                          which was random before…

                                                  if [ $(which $b). != '.' ]; then
                                                       rm -rf ~/.config/$b 2>/dev/null   # add this line
                                          

                                          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
                                            ember1205 @sdetweil
                                            last edited by

                                            @sdetweil said in Autostarts but doesn't run, will run on restart:

                                            … my pi 0 now comes up instead of the chrome desktop
                                            which was random before…

                                            Not sure I’m following what this should mean?

                                            S 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
                                            • 3
                                            • 1 / 3
                                            • 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