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.

    Rpi 4 and two monitors

    Scheduled Pinned Locked Moved Hardware
    60 Posts 6 Posters 28.1k Views 6 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.
    • S Offline
      sdetweil @NathTheDude
      last edited by

      @NathTheDude MagicMirror startup in the run-start.sh file sets DISPLAY=:0 for the primary display
      I would guess that the second display is :1

      so, do
      export DISPLAY=:1
      then npm start

      see if it comes up on the second display

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • N Offline
        NathTheDude
        last edited by NathTheDude

        @sdetweil na, no joy. I did try this yesterday also but was not sure I was looking in the right place. For the sake of it I tried using numbers 0 to 9, all with the same result. This for example:

        npm ERR! code ENOENT
        npm ERR! syscall open
        npm ERR! path /home/pi/package.json
        npm ERR! errno -2
        npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json'
        npm ERR! enoent This is related to npm not being able to find a file.
        npm ERR! enoent 
        
        npm ERR! A complete log of this run can be found in:
        npm ERR!     /home/pi/.npm/_logs/2020-02-04T21_33_32_894Z-debug.log
        

        However if I reboot the RPI with run-start having the different value it will still display the MM on the first screen, this made me think that this script was not being used at the startup as I would expect it to fail and not display the MM - perhaps I am wrong.

        S 2 Replies Last reply Reply Quote 0
        • bheplerB Offline
          bhepler Module Developer
          last edited by

          I wonder if we’re looking in the wrong place? Perhaps it’s how the MM process is calling Electron that determines where on the desktop the app appears.

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @NathTheDude
            last edited by

            @NathTheDude said in Rpi 4 and two monitors:

            npm ERR! code ENOENT
            npm ERR! syscall open
            npm ERR! path /home/pi/package.json
            npm ERR! errno -2

            you are doing npm start in the root, not in the MagicMirror folder…

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @bhepler
              last edited by sdetweil

              @bhepler that is run-start.sh

              ~/MagicMirror/package.json

              {
                "name": "magicmirror",
                "version": "2.10.1",
                "description": "The open source modular smart mirror platform.",
                "main": "js/electron.js",
                "scripts": {
                  "start": "./run-start.sh",     // < ------   when u do npm start this happens
              

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @NathTheDude
                last edited by sdetweil

                @NathTheDude run-start.sh is in the MagicMirror folder

                actually the pm2 only on the 1st screen is understandable
                as the script used by pm2 is installers/mm.sh

                which does

                DISPLAY=:0 npm start
                

                and run-start does

                # if DISPLAY is not set then set it
                if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
                	export DISPLAY=:0 # Set by default display
                fi
                

                so I would just set export DISPLAY=:0
                and the execute run-start.sh

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • bheplerB Offline
                  bhepler Module Developer
                  last edited by

                  I have to head home, so I can’t investigate any more for some time. But I did find this link on StackOverflow that seems to address the issue. Aren’t we using an X11 based desktop manager?
                  Anyway, this may help.

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @bhepler
                    last edited by

                    @bhepler correct, that is DISPLAY

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      NathTheDude
                      last edited by

                      thanks @sdetweil , right you are - I was not running npm from within the MagicMirror directory.

                      When I update ‘Display’ to 1 I still get an error when trying to manually run NPM, however when ‘Display’ is set to 0 and then I run NPM there are no errors with it. The error is:

                      pi@MagicMirrors:~/MagicMirror $ npm start
                      
                      > magicmirror@2.10.1 start /home/pi/MagicMirror
                      > ./run-start.sh
                      
                      (electron:11918): Gtk-WARNING **: 22:18:00.088: cannot open display: :1
                      npm ERR! code ELIFECYCLE
                      npm ERR! errno 1
                      npm ERR! magicmirror@2.10.1 start: `./run-start.sh`
                      npm ERR! Exit status 1
                      npm ERR! 
                      npm ERR! Failed at the magicmirror@2.10.1 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/2020-02-04T22_18_00_154Z-debug.log
                      pi@MagicMirrors:~/MagicMirror $ 
                      

                      @bhepler thanks for the link, it is a bit beyond my understanding at the moment. I will have to read up on it a bit more. I tried to run xrandr to see what kind of status it gives on the monitors but it currently comes back with ‘Can’t open display’, I assume it is because another service/application is utilising them?

                      Anyway, thanks for your help.

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @NathTheDude
                        last edited by sdetweil

                        @NathTheDude said in Rpi 4 and two monitors:

                        When I update ‘Display’ to 1 I still get an error

                        Yes, we just need to find out what the other Display number is.

                        tvservice is wrong cause it reports display 2 for HDMI 0, and we know it’s really Display 0

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 6 / 6
                        • 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