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

(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.log
    

    The 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. (/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. (/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 serveronly
    

    it 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 Xorg 
    

    from 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


Log in to reply