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.

    Raspberry Pi Zero W for Magic Mirror

    Scheduled Pinned Locked Moved Hardware
    79 Posts 10 Posters 58.0k Views 11 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.
    • D Offline
      davidgagne @sdetweil
      last edited by

      @sdetweil Okay! I’m doing this right now and will keep you posted. THANK YOU AGAIN.

      1 Reply Last reply Reply Quote 0
      • D Offline
        davidgagne @sdetweil
        last edited by

        `@sdetweil Sadly that didn’t seem to work at all.

        pm2 flush gave me:

        [PM2] Spawning PM2 daemon with pm2_home=/home/dvg/.pm2
        [PM2] PM2 Successfully daemonized
        [PM2] Flushing /home/dvg/.pm2/pm2.log
        [PM2] Logs flushed
        

        Then pm2 status gave me:

        ┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
        │ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
        ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
        │ 0  │ MagicMirror        │ fork     │ 0    │ online    │ 23.3%    │ 40.3mb   │
        └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
        

        Then I did cd ~/MagicMirror/ and ran npm start which spit out this:

        > magicmirror@2.27.0 start
        > ./run-start.sh $1
        
        [2024-05-29 23:08:58.949] [LOG] Starting MagicMirror: v2.27.0
        [2024-05-29 23:08:59.437] [LOG] Loading config ...
        [2024-05-29 23:08:59.497] [LOG] config template file not exists, no envsubst
        [2024-05-29 23:09:07.135] [LOG] Loading module helpers ...
        [2024-05-29 23:09:07.356] [LOG] No helper found for module: alert.
        [2024-05-29 23:09:36.395] [LOG] Initializing new module helper ...
        [2024-05-29 23:09:36.558] [LOG] Module helper loaded: updatenotification
        [2024-05-29 23:09:36.688] [LOG] No helper found for module: clock.
        [2024-05-29 23:10:00.038] [LOG] Initializing new module helper ...
        [2024-05-29 23:10:00.109] [LOG] Module helper loaded: calendar
        [2024-05-29 23:10:00.684] [ERROR] Whoops! There was an uncaught exception... 
        [2024-05-29 23:10:01.570] [ERROR] Error: Cannot find module 'request'
        Require stack:
        - /home/dvg/MagicMirror/modules/MMM-JEOPARDY/node_helper.js
        - /home/dvg/MagicMirror/js/app.js
        - /home/dvg/MagicMirror/serveronly/index.js
            at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
            at Module._resolveFilename (/home/dvg/MagicMirror/node_modules/module-alias/index.js:49:29)
            at Module._load (node:internal/modules/cjs/loader:901:27)
            at Module.require (node:internal/modules/cjs/loader:1115:19)
            at require (node:internal/modules/helpers:130:18)
            at Object.<anonymous> (/home/dvg/MagicMirror/modules/MMM-JEOPARDY/node_helper.js:8:17)
            at Module._compile (node:internal/modules/cjs/loader:1241:14)
            at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
            at Module.load (node:internal/modules/cjs/loader:1091:32)
            at Module._load (node:internal/modules/cjs/loader:938:12)
            at Module.require (node:internal/modules/cjs/loader:1115:19)
            at require (node:internal/modules/helpers:130:18)
            at loadModule (/home/dvg/MagicMirror/js/app.js:183:19)
            at loadModules (/home/dvg/MagicMirror/js/app.js:213:10)
            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
            at async App.start (/home/dvg/MagicMirror/js/app.js:261:3) {
          code: 'MODULE_NOT_FOUND',
          requireStack: [
            '/home/dvg/MagicMirror/modules/MMM-JEOPARDY/node_helper.js',
            '/home/dvg/MagicMirror/js/app.js',
            '/home/dvg/MagicMirror/serveronly/index.js'
          ]
        } 
        [2024-05-29 23:10:01.664] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? 
        [2024-05-29 23:10:01.745] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MagicMirrorOrg/MagicMirror/issues 
        [2024-05-29 23:12:53.308] [INFO] System information:
        ### SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi Zero W Rev 1.1; raspberry: [object Object]; virtual: false
        ### OS: platform: linux; distro: Raspbian GNU/Linux; release: 11; arch: arm; kernel: 6.1.21+
        ### VERSIONS: electron: undefined; used node: 20.8.0; installed node: 20.8.0; npm: 10.1.0; pm2: 5.4.0
        ### OTHER: timeZone: America/New_York; ELECTRON_ENABLE_GPU: undefined
        Starting chromium browser now, have patience, it takes a minute
        Chromium_browser not installed
        

        This all seemed pointless, but I ran pm2 restart 0 anyway and got this:

        Use --update-env to update environment variables
        [PM2] Applying action restartProcessId on app [0](ids: [ '0' ])
        [PM2] [MagicMirror](0) ✓
        ┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
        │ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
        ├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
        │ 0  │ MagicMirror        │ fork     │ 47   │ online    │ 0%       │ 23.5mb   │
        └────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
        

        At this point I’m going to give up and go back to square one and flash the drive again and start over. Ugh.

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

          @davidgagne said in Raspberry Pi Zero W for Magic Mirror:

          024-05-29 23:10:01.570] [ERROR] Error: Cannot find module ‘request’
          Require stack:

          • /home/dvg/MagicMirror/modules/MMM-JEOPARDY/node_helper.js

          no… just fix the MMM-Jeopardy module as I suggested yesterday

          two steps
          you only did 1

          … the more concerning part is that pm2 didn’t get setup as a service and start on boot… i haven’t looked at the log yet

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S D 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @sdetweil
            last edited by

            @davidgagne the install log looks good…

            don’t know what is going on… will have to think on it while I sleep…

            time to rest… til tomorrow

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • D Offline
              davidgagne @sdetweil
              last edited by

              @sdetweil I understand what you’re saying about fixing the Jeopardy module, but I really think that’s secondary to not getting MM to run in the first place (and it not starting as a service on boot). Once I get MM running reliably in the first place I will play around with modules. :-)

              1 Reply Last reply Reply Quote 0
              • D Offline
                davidgagne
                last edited by

                How to Get MagicMirror to Run on a Raspberry Pi Zero W Rev 1.1

                Late-May 2024

                Huge thanks to @sdetweil for all his help!


                1. Flash card with Legacy 32-bit.
                2. Connect via ssh to run script:
                  bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh)"
                  

                  Answer yes to disable screen saver and use pm2 questions.

                3. Remove chromium with:
                  sudo apt-get remove chromium-browser
                  sudo apt autoremove
                  
                4. Add Firefox with:
                  sudo apt-get update
                  sudo apt-get install firefox-esr
                  
                5. Enable VNC using GUI (Interface Options):

                  sudo raspi-config

                6. Connect via TigerVNC (Apple app)
                7. Edit installers/mm.sh via VNC using Pi's baked-in text editor by adding:
                  cd ~/MagicMirror
                  export external_browser=firefox
                  DISPLAY=:0 npm start
                  
                8. Execute fix'em-up script:
                  bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/fixuppm2.sh)"
                  
                9. cd ~/MagicMirror/
                  pm2 start MagicMirror
                  
                10. sudo reboot

                Note: On my Pi Zero W it takes a solid ten minutes from reboot to actually seeing MM output via HDMI.

                S C plainbrokeP 4 Replies Last reply Reply Quote 1
                • S Offline
                  sdetweil @davidgagne
                  last edited by sdetweil

                  @davidgagne thanks.

                  5 and 6 are optional
                  as 7 can be done with nano over ssh

                     scroll down with keyboard arrow keys
                     hit enter to add a line
                     type the export line
                     ctrl-x to exit nano, yes to save contents
                  

                  8 and 9 over ssh
                  9 pm2 can be run from any folder location

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    davidgagne @sdetweil
                    last edited by

                    @sdetweil Is there any reason why this same procedure would not work on a 3B+? I’ve tried with multiple different versions of the OS but it always seems to get stuck on “Updating packages …” and – as far as I can tell – there’s nothing meaningful in install.log. Is this install script unique to the Zero W?

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

                      @davidgagne no. the script works of any Debian based os. pi0 is SLOOOOOW…
                      but pi 3b+ should be ok. there should be a moving <-> while it’s updating… (haven’t figured out how to make that stand out more)

                      the script is doing apt get update, apt upgrade . this could take a while based on how much change since distro was released. over wifi, nothing I can do to speed it up.

                      I’ve tested on all the pi models. except the pi 1.
                      on odroid, Jetson nano, a chrome box and book running linux and a bunch of x86 distros., and macos Intel and arm.
                      I also tested on my arm chromebook, with the extra Ubuntu installed. install worked and server mode worked. no ui

                      if there is a problem, I’ll fix it. I’ll setup my 3b later.

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      D 1 Reply Last reply Reply Quote 0
                      • D Offline
                        davidgagne @sdetweil
                        last edited by

                        @sdetweil Right. That’s my confusion. I have been able to run the script a dozen (or more) times on the Zero W, but it always fails on the 3B+, which I had assumed would be faster / better than the Zero W.

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

                          @davidgagne always fails?

                          what os? I’d pick the 32 it due to memory size

                          send me the install.log.

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            capedbuffethero @davidgagne
                            last edited by

                            @davidgagne Wow, your summary above is just amazing! This is exactly what I was looking for.

                            Can you comment on why the choice of legacy OS was selected? Is there some kind of tradeoff that is being made here?

                            S D 2 Replies Last reply Reply Quote 1
                            • S Offline
                              sdetweil @capedbuffethero
                              last edited by

                              @capedbuffethero the pi0 is older armv6l processor, it can only run 32 bit mode. the memory is small on pi0,

                              everything that doesn’t fit in memory causes swapping, to the sd card. pi0 has the older slower sd chip.

                              so, use the legacy 32 bit image to reduce the footprint

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                davidgagne @capedbuffethero
                                last edited by

                                @capedbuffethero Thanks! Please upvote if you found it valuable. I’m fairly new here and trying to improve my rep so all my posts aren’t held for moderation. :)

                                C 1 Reply Last reply Reply Quote 0
                                • C Offline
                                  capedbuffethero @davidgagne
                                  last edited by

                                  @davidgagne It appears I need 1 reputation to upvote.

                                  S 2 Replies Last reply Reply Quote 1
                                  • S Offline
                                    sdetweil @capedbuffethero
                                    last edited by

                                    @capedbuffethero really? I’ll check on that. didn’t used to be.

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

                                    1 Reply Last reply Reply Quote 2
                                    • S Offline
                                      sdetweil @capedbuffethero
                                      last edited by sdetweil

                                      @capedbuffethero can you try this again… we should have reset this option to 0
                                      downvote still requires rep of 1 or above…

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 1
                                      • plainbrokeP Offline
                                        plainbroke @davidgagne
                                        last edited by

                                        @davidgagne
                                        Does it matter that you install firefox-esr
                                        but in the mm.sh script you just call it firefox ?
                                        I went to midori to get mine to work it would not recognize the firefox in mm.sh for some reason.

                                        Slow learner. But trying anyways.
                                        MM is on Raspberry Pi 4B w/8gb ram loaded on a 128gb nvme drive.
                                        Running Trixie and the latest MM version.

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

                                          @plainbroke the package is called firefox-esr

                                          the program name is firefox
                                          it must be on the path for mm.sh to execute it.
                                          I don’t know if installing the package does that.
                                          I don’t remember worrying about it

                                          the command

                                          which firefox
                                          should return the full path to the executable if it’s on the path.
                                          otherwise you can add its folder onto the path in the .profile or .bashrc scripts
                                          that setup the shell environment

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          1 Reply Last reply Reply Quote 0
                                          • C Offline
                                            capedbuffethero @davidgagne
                                            last edited by capedbuffethero

                                            @davidgagne said in Raspberry Pi Zero W for Magic Mirror:

                                            Summary

                                            • when running DISPLAY=:0 npm start I got an unexpected error
                                            • follow up question: export external_browser=firefox doesn’t this export vanish as soon as my session ends? Do I have to do this every time?
                                            • firefox is started and is visible on VNC
                                            • firefox is not able to connect to the node server (I guess the node server is not running)

                                            Details:
                                            When executing this script:

                                            cd ~/MagicMirror
                                            export external_browser=firefox
                                            DISPLAY=:0 npm start
                                            

                                            on this step: I get this output:

                                            myname@raspberrypi:~ $ cd ~/MagicMirror
                                            myname@raspberrypi:~/MagicMirror $ export external_browser=firefox
                                            myname@raspberrypi:~/MagicMirror $ DISPLAY=:0 npm start
                                            
                                            > magicmirror@2.27.0 start
                                            > ./run-start.sh $1
                                            
                                            ./run-start.sh: line 79:  8050 Killed                  node serveronly
                                            
                                            

                                            these are the lines that precede line 79:

                                                # if user explicitly configured to run server only (no ui local)
                                                # OR there is no xwindows running, so no support for browser graphics
                                                if [ "$serveronly." == "$true." ] || [ "$xorg." == "." -a $mac != 'Darwin' -a "$wait_for_x." != "." ]; then
                                                  # start server mode,
                                                  node serveronly
                                                else
                                                  # start the server in the background
                                                  # wait for server to be ready
                                                  # need bash for this
                                                  exec 3< <(node serveronly)
                                            

                                            if we do export external_browser doesn’t that vanish as soon as the RPI is rebooted or if my session ends?

                                            after a while the VNC client showed firefox start, but no URL, then the screen went white, then Firefox said “Unable to connect”

                                            then I ran this script, I am tailing logs. What does “fix 'em up” script do

                                          • Execute fix'em-up script:
                                            bash -c "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/fixuppm2.sh)"
                                            
                                          • the last line is this: pm2 setup completed - Fri Jun 14 21:52:48 PDT 2024

                                            cancelling the step DISPLAY=:0 npm start allows me to rerun this step, but the step always ends in failure.

                                            UPDATE: “Unable to connect” is because Firefox cannot connect to the node server. VNC can connect without issue! The error is actually an error from the Firefox browser.

                                            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
                                            • 4
                                            • 3 / 4
                                            • 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