sdetweil / MagicMirror_scripts

Magic Mirror installation and setup scripts
374 stars 64 forks source link

Unable to start #87

Closed mrfoxie closed 5 months ago

mrfoxie commented 8 months ago

After adding modules its not starting up but it shows that it is online

pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ MagicMirror        │ fork     │ 55   │ online    │ 0%       │ 3.0mb    │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
sdetweil commented 8 months ago

do

pm2 stop all pm2 logs --lines=100

mauriziov commented 7 months ago

I have a similar issue, MagicMirror is not starting but after an update. Below the log:

0|MagicMir | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js 0|MagicMir | 0|MagicMir | 0|MagicMir | > magicmirror@2.27.0 start 0|MagicMir | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js 0|MagicMir | 0|MagicMir | 0|MagicMir | > magicmirror@2.27.0 start 0|MagicMir | > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js 0|MagicMir |

/home/dietpi/.pm2/logs/MagicMirror-error.log last 100 lines: 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found 0|MagicMir | sh: 1: ./node_modules/.bin/electron: not found

sdetweil commented 7 months ago

if you dont post the upgrade log i cant help much.

the upgrade log is ~/MagicMirror/installers/upgrade.log

i have been out of town for a while, just getting back,

this is an npm install problem. they dont test on diet pi.

BauzyMM commented 7 months ago

Hi, Have the same issue. When upgrading MM there is a error message in news feed when MM is started. When commented out the MM can be started from cammand prompt, but automatic start will crash after about 20 sec.

Log from installation attached. What's the issue? :) _MagicMirror_installers_upgrade_logfile.txt

sdetweil commented 7 months ago

thanks for the log. it doesnt show any issue on the actual upgrade.

can you use manusl start to capture tge error?

pm2 stop all cd ~/MagicMirror npm start >somefile.txt 2>&1 wait til the error and then try ctrl-q top stop mm then edit the somefile.txt. and go to the bottom

if you want to post that file here, please check and edit out any calendar urls, as these are used in logging the number of events processed. helps when you have multiple calendars being processed

BauzyMM commented 7 months ago

Thanks, attached is the log file. Had no issues before the upgrade. MM2 log.txt

Also attaching the same log file but with news feed back in the config.js. log MM with newsfeed active in config.txt

Looks like somthing with permissions, but as written, worked before and internet connection is fine.

sdetweil commented 7 months ago

things change when there are changes.. pm2 is not our code, so you never know..

issue the command to fix it..

[2024-04-07 21:06:36.565] [ERROR] [PM2][ERROR] Permission denied, to give access to current user:
 sudo chown pi:pi /home/pi/.pm2/rpc.sock /home/pi/.pm2/pub.sock

on the newsfeed, there was a network timeout.. sadly most of the modules do not handle errors very well..

BauzyMM commented 7 months ago

Saw that in the log and tried the command before, MM still crashes after about 5-10 seconds after starting up and feching data.

Any more ideas?

sdetweil commented 7 months ago

and if you do

ls -laF /home/pi/.pm2/rpc.sock

do you see current use as the owner? note the command says pi, but that might not be the username

BauzyMM commented 7 months ago

If I do: pi@raspberrypi:~ $ sudo chown pi:pi /home/pi/.pm2/rpc.sock /home/pi/.pm2/pub.sock pi@raspberrypi:~ $ ls -laF /home/pi/.pm2/rpc.sock srwxrwxr-x 1 pi pi 0 10 apr 07.04 /home/pi/.pm2/rpc.sock=

The MM starts up fine if I start it from command prompt. When doing a reboot and doing the command, the user has changed back to root.

Comandprompt after reboot: pi@raspberrypi:~ $ ls -laF /home/pi/.pm2/rpc.sock srwxrwxr-x 1 root root 0 10 apr 07.04 /home/pi/.pm2/rpc.sock= pi@raspberrypi:~ $ sudo chown pi:pi /home/pi/.pm2/rpc.sock /home/pi/.pm2/pub.sock pi@raspberrypi:~ $ ls -laF /home/pi/.pm2/rpc.sock srwxrwxr-x 1 pi pi 0 10 apr 07.04 /home/pi/.pm2/rpc.sock=

user changes back to root at reboot, why?

sdetweil commented 7 months ago

were you logged on as root when you did the mm scripts? or did you try some of this before running my script?

run the fixuppm2 script logged on as user

luci-11 commented 7 months ago

hello, same problem here. the script results online but nothing else happened. I also noticed that probably the external_browser configuration is not working anymore, could it be? At reboot I always get a chromium error .Maybe this can help in troubleshooting too. Thanks in advance

sdetweil commented 7 months ago

@luci-11 can you attach the errors, pm2 logs --lines=50 and the upgrade log ~/MagicMirror/installers/upgrade.log

luci-11 commented 7 months ago

So.. I started again with a clean installation as this is what i was trying to do. I selected yes to disable splashscreen and to pm2 to autostart. This is the output: --removed file---

and install.log attached --removed file--

If i need to launch anything with the external_browser modification or an updgrade too let me know. On raspberry screen I had the chromium not supported error popping up

sdetweil commented 7 months ago

yes if it's a new os install they have removed chrome on armv6l.

so you would have to use Firefox or another browser. that has to be installed manually

but, if we worked before mm update, how did we get into this os updated state?

luci-11 commented 7 months ago

In my case,it is a fresh install of everything, both rasp os and MM through your script. It's the latest version of raspberry os available online and firefox was removed too.

Now I've installed midori (tested working with desktop) and changed the mm.sh then reboot. Still get the splashscreen, but then desktop appears and log is full of: 0|MagicMirror | > magicmirror@2.27.0 start 0|MagicMirror | > ./run-start.sh $1 PM2 | App [MagicMirror:0] exited with code [0] via signal [SIGINT] PM2 | App [MagicMirror:0] starting in -fork mode- PM2 | App [MagicMirror:0] online and these lines are repeating

sdetweil commented 7 months ago

ok, for pi0w you need to run the legacy 32 bit image, right?

luci-11 commented 7 months ago

ok I feel like an idiot .. anyway... i reinstalled with 32 bit- MM worked. I tested the reboot and MM was not working anymore. I checked this ----> ls -laF /home/pi/.pm2/rpc.sock for me the output was ok. I tried starting again MM using therun-start.sh and found out it is not reading external_browser anymore from the installer/mm.sh file.. If I set the variable in terminal it works. Now i've put it in ~/.profile , not sure if it is the best way to handle this, the env variable is kept so i can launch run-start.sh manually. But autostart at reboot still doesn't work.... pm2 list command gives empty table and after a couple of minutes goes into stopped

luci-11 commented 7 months ago

I finally got an error!

/home/pi/.pm2/logs/MagicMirror-error.log last 15 lines:
0|MagicMir | Require stack:
0|MagicMir | - /home/pi/MagicMirror/js/electron.js
0|MagicMir |     at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
0|MagicMir |     at Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
0|MagicMir |     at require (node:internal/modules/helpers:130:18)
0|MagicMir |     at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:3:18)
0|MagicMir |     at Module._compile (node:internal/modules/cjs/loader:1241:14)
0|MagicMir |     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
0|MagicMir |     at Module.load (node:internal/modules/cjs/loader:1091:32)
0|MagicMir |     at Module._load (node:internal/modules/cjs/loader:938:12)
0|MagicMir |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|MagicMir |     at Module._compile (node:internal/modules/cjs/loader:1241:14) {
0|MagicMir |   code: 'MODULE_NOT_FOUND',
0|MagicMir |   requireStack: [ '/home/pi/MagicMirror/js/electron.js' ]
sdetweil commented 7 months ago

does the external have the export in front of it??

export EXTERNAL_BROWSER=

in linux environment variables are NOT passed to children processes by default, so you MUST use export in Windows environment variables ARE passed , so you have to delete them if you don't want them passed

sdetweil commented 7 months ago

@luci-11

/pm2/node_modules/require-in-the-middle

so this is a pm2 problem...

run the fixuppm2 script from my scripts page...

I have not seen this error before.. unless we switched node versions out from under pm2..

try this sudo npm i pm2 -g

then restart using pm2

luci-11 commented 7 months ago

@luci-11

/pm2/node_modules/require-in-the-middle

so this is a pm2 problem...

run the fixuppm2 script from my scripts page...

I have not seen this error before.. unless we switched node versions out from under pm2..

try this sudo npm i pm2 -g

then restart using pm2

I tried but still online and no MM running :( about variables, yes I used the export as written in the guide. But at least i have a solution. Just for better understanding,. is pm2 really necessary? I mean, is it completely wrong if we just make the run-start.sh executable at boot as "workaround"? Thanks a lot for your help

p.s. could this be useful? export ELECTRON_DISABLE_GPU=1 (i found it in one of your replies on a thread)

p.p.s i found another person with same issue on reddit :( link to error

sdetweil commented 7 months ago

the users problem you linked to as a missing library the module didn't declare.. my upgrade script would have fixed that

export ELECTRON_DISABLE_GPU=1 only applies if you are using the built in electron browser which is no longer available for armv6l systems

luci-11 commented 7 months ago

Hi, back again. I just wanted to update you about what I did to make everything up and running after reboot :) .. Maybe will help for troubleshooting or others:

sdetweil commented 7 months ago

@luci-11 hmm.. weird

  1. complete path in json file.. I do that already
  2. this was the problem I think. but I don't know why, as the script JUST did this.
  3. ok.. as I said, weird.. i've had 100s maybe 1000s of installs without this difficulty.
slecram commented 6 months ago

Hi guys, is there a solution for this issue yet?

sdetweil commented 6 months ago

@slecram in general this is a case by case problem..

I see it more on pi4/5 with Wayland instead of x11.

it's more a pm2 problem than MagicMirror

try reinstalling pm2 sudo npm install -g pm2

slecram commented 6 months ago

I get the issue on pi zero 2 with raspberry pi os 32-bit. I just reinstalled pm2 by "sudo npm install -g pm2" with no change. There i got warnings:

npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

image

image

image

Errorlogs with missed electron module

sdetweil commented 6 months ago

ah, pi2

can you show results of uname -a and grep start package.json

and attach the log ~/install.log

this is the legacy image, right? for armv6l

there is no electron anymore for armv6l on the bookworm image they have also removed chromium, so you have to install Firefox or midori and add a parm to the mm.sh to tell my special startup script what browser to use

slecram commented 6 months ago
uname -a
Linux fw-alv-pi-photoframe 6.6.28+rpt-rpi-v7 #1 SMP Raspbian 1:6.6.28-1+rpt1 (2024-04-22) armv7l GNU/Linux

grep start package.json returns nothing

npm -v
10.1.0
node -v
v20.8.0

install.log is in attachement install.log

I used this image, not legacy Raspberry Pi OS with desktop 32bit

Firefox and Chromium are already installed in this image. Could you give me more details what I've to do?

slecram commented 5 months ago

Good morning, are there some news?

sdetweil commented 5 months ago

sorry, i didn't see your post from before

the logs says you aborted the install , and attempted to install again..

Note: the node command changed location and the old location may be remembered in your current shell.
         old : /usr/bin/node
         new : /usr/local/bin/node
If "node --version" shows the old version then start a new shell, or reset the location hash with:
hash -r  (for bash, zsh, ash, dash, and ksh)
rehash   (for csh and tcsh)
Cloning MagicMirror ...
Cloning MagicMirror Done!
Installing dependencies ...    <-------  --- last MM install output
install starting  - Thu May 23 11:34:12 CEST 2024   <<< install restarted
installing on armv7l processor system

and then the log says

installing on bookworm
It seems like MagicMirror is already installed.
To prevent overwriting, the installer will be aborted. 
Please rename the ~/MagicMirror folder and try again.

SO, I won't install OVER a prior installation of MagicMirror..

if you want to do this, then u have to move the existing MagicMirror folder out of the way (or delete it)

slecram commented 5 months ago

Thank you!! That was the problem. I delete /Magic Mirror/ and reinstall it. Now it runs without problems! I don't know why the installation aborted ago

sdetweil commented 5 months ago

it SHOULD have output this to the screen , on the second install attempt

�[93mIt seems like MagicMirror is already installed.
To prevent overwriting, the installer will be aborted. 
Please rename the �[1m~/MagicMirror�[0m�[93m folder and try again.�[0m