MagicMirror² v2.11.0 is available! For more information about this release, check out this topic.

proposed New processing and config for pi0/armv6 and serverOnly mode

  • some users are using older PI hardware, based on the armv6 chipset. Unfortunately the electron browser is no longer built for that chipset, and forcing armv7 no longer works.

    so I propose an update to the script which will detect this and use the chromium browser instead. this helps because the impacted users don’t have to learn to modify the run-start file or the why

    its slower to start up, but just as functional
    (we also need to make the electron dependency optional, so the install will complete)

    also, in some cases our users would like to run serverOnly mode, so I think we could add a config.js option to enable that, and use the same update to run-start to just NOT start a browser…

      serverOnly:  "local"  or true or false (default)
                                  true means runserveronly, but no UI ON the local system
                                 "local"  means runserveronly, also run UI ON the local system, default for armv6
                                 false  (default), means do not run serveronly default for NOT armv6

    here is my proposed change to (extra spaces to handle the forum chopping off stuff after < )

      # use bash instead of sh
    if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
    	export DISPLAY=:0 # Set by default display
    # get the processor architecture
    arch=$(uname -m)
    # got the config option, if any
    serveronly=$(grep -i serveronly: config/config.js | awk '{print tolower($2)}' | tr -d ,\"\')
    # set default if not defined in config
    # check for xwindows running
    xorg=$(pgrep Xorg)
    # if the user requested serveronly OR 
    #    electron support for armv6l has been dropped OR
    #    system is in text mode
    if [ "$serveronly." != "false." -o  "$arch" == "armv6l" -o  "$xorg." == "." ]; then
    	# 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." -o "$xorg." == "." ]; then
    	  # start server mode, 
    	  node serveronly
    		# start the server in the background
    		# wait for server to be ready
    		# need bash for this
    		exec 3< < (node serveronly)
    		# Read the output of server line by line until one line 'point your browser'
    		while read line; do
    			 case "$line" in
    			 *point\ your\ browser*)
    					echo $line 
    					echo $line
    					#sleep .25
    		done < &3
    		# Close the file descriptor
    		exec 3< &-	
    		# lets use chrome to display here now
    		# get the server port address from the ready message
    		port=$(echo $line | awk -F\: '{print $4}')	
    		# start chromium 
    		echo "Starting chromium browser now, have patience, it takes a minute"
    		chromium-browser -noerrdialogs -kiosk -start_maximized  --disable-infobars --app=http://localhost:$port  --ignore-certificate-errors-spki-list --ignore-ssl-errors --ignore-certificate-errors 2>/dev/null
    	# we can use electron directly	
    	`electron js/electron.js $1`;

  • @sdetweil if u want to try this now,

    save this contents to the file,
    change 3 lines due to the forum processing

              exec 3< < (node serveronly)    # remove the space before (
              done < &3                      #  remove the space before &
              exec 3< &-                     #  remove the space before &


    chmod +x run-start-sh

    edit package,json

         "start": "sh",


         "start": "./",

    Then npm start will start this correctly

  • I have submitted these changes as pull request 1788

  • I added a check for textmode os config (no xwindows)

Log in to reply