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.

    Struggling with Pi0

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    8 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.
    • R Offline
      rgatlin
      last edited by rgatlin

      That would be great. Thanks!

      What is the correct way see the display? Is it the browser with the localhost:8080 address?

      Thanks again for the help.

      1 Reply Last reply Reply Quote 0
      • A Offline
        andyc7687
        last edited by

        I believe the issue is that there are elements of nodejs that don’t get installed correctly using npm on the pi zero. Attached is a shell script that should do it from a fresh Raspbian Stretch Install. I put all the files in the home directory (~) and it all distributes itself from there by running RaspberryPi0.sh
        Let me know if that helps!

        [3_1546385331101_startMagicMirror.sh](Uploading 100%) [2_1546385331101_RaspberryPi0.sh](Uploading 100%) [1_1546385331100_pm2_MagicMirror.json](Uploading 100%) [0_1546385331099_chromium_start.sh](Uploading 100%)

        1 Reply Last reply Reply Quote 0
        • A Offline
          andyc7687
          last edited by andyc7687

          I don’t know if those files uploaded…

          startMagicMirror.sh: EDIT: I uploaded the wrong code just for this file; changes are a semi colon after line 2 and at the end of line 4; plus the directory has changed from
          /home/pi/chromium_start.sh to /home/pi/MagicMirror/PiZero/chromium_start.sh in line 5

          #!/bin/bash
          cd ~/MagicMirror;
          node serveronly &
          sleep 30;
          sh /home/pi/MagicMirror/PiZero/chromium_start.sh
          

          chromium_start.sh

          #!/bin/sh
          unclutter &
          chromium-browser --start-fullscreen --app http://localhost:8080
          

          pm2_MagicMirror.json

          {
            "apps" : [{
              "name"        : "MagicMirror",
              "script"      : "~/MagicMirror/PiZero/startMagicMirror.sh",
              "watch"       : ["/home/pi/MagicMirror/config/config.js"]
            }]
          }
          
          

          RaspberryPi0.sh

          #!/bin/bash
          #Pi Zero Install, largely plagiarised from MagicMirror2's raspberry.sh shell script for Pi2 and Pi3
          echo 'Updating Pi'
          sudo apt-get update;
          echo 'Upgrading Pi'
          sudo apt-get upgrade;
          sudo apt-get upgrade --fix-missing;
          
          echo 'Downloading node v11.6.0'
          curl -o node-v11.6.0-linux-armv6l.tar.gz  https://nodejs.org/dist/v11.6.0/node-v11.6.0-linux-armv6l.tar.gz; #Most up to date recent version
          echo 'Extracting node v11.6.0'
          tar -xzf node-v11.6.0-linux-armv6l.tar.gz; # extract files
          echo 'Extracting node and npm'
          
          cd node-v11.6.0-linux-armv6l/;
          sudo cp -R * /usr/local/;
          cd ~;
          sudo apt install git; sudo apt install unclutter;
          echo 'Cloning Magic Mirror'
          
          git clone https://github.com/MichMich/MagicMirror;
          cd MagicMirror;
          echo 'Installing Magic Mirror Dependencies'
          npx npmc@latest install; npm install acorn@latest; npm install stylelint@latest; npm audit fix;
          echo 'Loading default config'
          
          # Use sample config for start MagicMirror
          cp config/config.js.sample config/config.js;
          
          #Set the splash screen to be magic mirror
          THEME_DIR="/usr/share/plymouth/themes"
          sudo mkdir $THEME_DIR/MagicMirror
          sudo cp ~/MagicMirror/splashscreen/splash.png $THEME_DIR/MagicMirror/splash.png && sudo cp ~/MagicMirror/splashscreen/MagicMirror.plymouth $THEME_DIR/MagicMirror/MagicMirror.plymouth && sudo cp ~/MagicMirror/splashscreen/MagicMirror.script $THEME_DIR/MagicMirror/MagicMirror.script; 
          sudo plymouth-set-default-theme -R MagicMirror; 
          mkdir ~/MagicMirror/PiZero;
          sudo mv ~/startMagicMirror.sh ~/MagicMirror/PiZero/startMagicMirror.sh;
          sudo mv ~/pm2_MagicMirror.json ~/MagicMirror/PiZero/pm2_MagicMirror.json;
          sudo mv ~/chromium_start.sh ~/MagicMirror/PiZero/chromium_start.sh;
          sudo chmod a+x ~/MagicMirror/PiZero/startMagicMirror.sh;
          sudo chmod a+x ~/MagicMirror/PiZero/pm2_MagicMirror.json;
          sudo chmod a+x ~/MagicMirror/PiZero/chromium_start.sh;
          
          # Use pm2 control like a service MagicMirror
          sudo npm install -g pm2;
          sudo su -c "env PATH=$PATH:/usr/bin pm2 startup systemd -u pi --hp /home/pi";
          pm2 start /MagicMirror/PiZero/pm2_MagicMirror.json;
          pm2 save;
          echo 'Magic Mirror should begin shortly'
          

          Takes about an hour depending on how up to date your Raspbian image is… I haven’t silenced/run any of the things in the background so you might get a couple of prompts where you just have to press enter (normally during the apt-get upgrade phase)

          1 Reply Last reply Reply Quote 1
          • R Offline
            rgatlin
            last edited by

            I will give this a try. Thanks for your help!

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              andyc7687
              last edited by

              no worries. if you want to have a bit more control over it, you can execute each line of RaspberryPi0.sh (minus the echo requests) directly in the terminal.

              1 Reply Last reply Reply Quote 0
              • A Offline
                andyc7687 @rgatlin
                last edited by andyc7687

                @rgatlin Did that work for you?

                if now working, can you mark the post as solved please :)

                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