Read the statement by Michael Teeuw here.
(electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0
-
Hi People
I have just installed magic mirror using the script provided on the github on my new Raspberry Pi 4b+.
I followed the pm2 and autostart method. However magicmirror keeps on restarting itself every 2-3 seconds.
I stopped it using pm2 stop Magicmirror and went onto the MagicMirror directory and manually tried to start it by this command “npm start dev”. I get the same errors as before when I check my pm2 logs MagicMirror. These are:
pi@raspberrypi:~/MagicMirror $ npm start dev > magicmirror@2.9.0 start /home/pi/MagicMirror > sh run-start.sh "dev" (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! magicmirror@2.9.0 start: `sh run-start.sh "dev"` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the magicmirror@2.9.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2019-12-19T14_16_40_381Z-debug.logThe xxxxx-debug.log file contains the following:
0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start', 'dev' ] 2 info using npm@6.13.4 3 info using node@v10.18.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle magicmirror@2.9.0~prestart: magicmirror@2.9.0 6 info lifecycle magicmirror@2.9.0~start: magicmirror@2.9.0 7 verbose lifecycle magicmirror@2.9.0~start: unsafe-perm in lifecycle true 8 verbose lifecycle magicmirror@2.9.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 9 verbose lifecycle magicmirror@2.9.0~start: CWD: /home/pi/MagicMirror 10 silly lifecycle magicmirror@2.9.0~start: Args: [ '-c', 'sh run-start.sh "dev"' ] 11 silly lifecycle magicmirror@2.9.0~start: Returned: code: 1 signal: null 12 info lifecycle magicmirror@2.9.0~start: Failed to exec start script 13 verbose stack Error: magicmirror@2.9.0 start: `sh run-start.sh "dev"` 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:198:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:198:13) 13 verbose stack at maybeClose (internal/child_process.js:982:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid magicmirror@2.9.0 15 verbose cwd /home/pi/MagicMirror 16 verbose Linux 4.19.75-v7l+ 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" "dev" 18 verbose node v10.18.0 19 verbose npm v6.13.4 20 error code ELIFECYCLE 21 error errno 1 22 error magicmirror@2.9.0 start: `sh run-start.sh "dev"` 22 error Exit status 1 23 error Failed at the magicmirror@2.9.0 start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]Can someone please help me?
Thanks.
-
@bachoo786 you cannot run this over ssh, display 0 is the actual display screen connected to the pi hdmi port
if u are running in console (text) mode, then you must run in serveronly, and use a browser from some other system …
I have my 4b running MM without problem, altho I used the updated install script (to be the official version on next release)
see here https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer -
@sdetweil I suppose I would look stupid to tell you that at the moment I have not connected my rpi 4b to any display. Could that be answer?
-
@bachoo786 Hm… could be,that would be no display 0 (i hate it when the computers get it right!)
if u want to see it from some other system, then do
cd ~/MagicMirror node serveronlyit will tell you what IP address to put into the browser on your other system
-
@sdetweil right ok make sense.
to be fair the instrcutions on github on installing MagicMirror are little confusing as the installation script asks you if you want to use pm2 and when you say yes it should automatically run magicmirror via pm2.
however there is this link (https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror) on the github explaining how to auto starting the magic mirror. And when you follow this link you end up having two instances of magic mirror on pm2 i.e. MagicMirror and mm. Thats confusing!
Do I still have to follow the autostarting magicmirror link? or is the install script sufficient?
-
@bachoo786 install script does it for you…
-
@bachoo786 could you do me a favor before u plug in a monitor,
can you do
pgrep Xorgfrom the ssh terminal…
I’m guessing it should return nothing…
my new run-start.sh script in next release, will detect text mode and start your installation in serveronly automagically.,! (pm2 just starts the script)
-
@sdetweil yeah it returned nothing.
so shall I follow your script i.e. https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer
and reinstall MagicMirror?Do I have to worry about installing pm2? will Magic Mirror run automatically if I was to reboot my raspberry? etc?
to be fair I want to install and run Magic Mirror on my raspberry. I suppose that is server mode? and not client mode? whats the difference sorry ?
-
@bachoo786 you don’t need to reinstall… you are ok… just need a display on the 4 or run server only…
the new code isn’t used on my install except for pi0, which won’t work anymore without some changes
-
@bachoo786 said in (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0:
yeah it returned nothing.
awesome! thanks
-
@sdetweil what is server mode and client mode? I dont understand the difference. Can you please explain? thanks.
-
@bachoo786 said in (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0:
Do I have to worry about installing pm2? will Magic Mirror run automatically if I was to reboot my raspberry? etc?
the current installation only tries to run on the real display… YOU have to figure it out otherwise…
(which we are doing here in this topic) -
@sdetweil I am really confused buddy.
lets start again please. I install mm using the script, what do I do next? do I need to worry about pm2? I suppose installing using the script installs MM as the server on the raspberry pi?
-
@bachoo786 sure…
MagicMirror is a web application.
it can be run in two different models
-
the browser and ‘web server’ are the same app, on the same machine
other machines can access the ‘web server’ part too -
the mirror is run without a display (server only), and some browser somewhere is used to
access the ‘web server’
you might do 2 where u want to provide Mirror access to multiple systems but don’t need it where the pi is installed…
-
-
@sdetweil said in (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0:
the mirror is run without a display (server only), and some browser somewhere is used to
access the ‘web server’you might do 2 where u want to provide Mirror access to multiple systems but don’t need it where the pi is installed…
ok makes sense. I normally access the mirror by port forwarding my raspberry pi on port 8080 and thats how I can access it on different machines or at work. And I like it that way to be fair. Because eventually my raspberry pi 4 will be inside the 2 way mirror running the Magic Mirror software.
-
@bachoo786 there is only one install…
but two ways to run…
but if u don’t have a display, then u are forced into serveronly mode
from the readme
https://github.com/MichMich/MagicMirror#server-only
from manual installation
https://github.com/MichMich/MagicMirror#manual-installationManual Installation Download and install the latest Node.js version: curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt install -y nodejs Clone the repository and check out the master branch: git clone https://github.com/MichMich/MagicMirror Enter the repository: cd MagicMirror/ Install and run the app with: npm install && npm start For Server Only use: npm install && node serveronly . // < ------- -
@bachoo786 said in (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0:
Because eventually my raspberry pi 4 will be inside the 2 way mirror running the Magic Mirror software.
well, in that model, typically, u have both server and browser running on same machine (pi 4) inside the actual mirror enclosure on the wall), so NOT serveronly mode
see the forum section https://forum.magicmirror.builders/category/12/show-your-mirror
where people are showing their implementations, with the whole setup -
@sdetweil ok so I will install like everyone else i.e. server and browser on the same machine. Thanks for sorting my head on that.
Now with regards to the install script I do not need to follow this link (https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror) to autostart magicmirror? as you said thats all taken care in the install script? Am i correct? or?
-
@bachoo786 no… u have pm2 which does it all… (oops, the default run-start.sh script ONLY starts in both mode, YOU have to change it to do serveronly like below)
u have already installed both… again there is only ONE install process, but two ways to run
today
issue the following commands (either set)
run bothcd ~/MagicMirror npm startor
run serveronlycd ~/MagicMirror node serveronly -
@sdetweil ok I will try it when I get home mate. Thanks.
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