Skip to content

[Bug] 2.37.dev when started with pm2, updatenotification fails on checking for module changes #4165

Closed

Description

@sdetweil

Environment

SYSTEM: manufacturer: System manufacturer; model: System Product Name; virtual: false; MM: v2.37.0-develop

  • OS: platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-179-generic
  • VERSIONS: electron: 42.1.0; used node: 24.15.0; installed node: 22.22.1; npm: 10.9.4; pm2: 5.4.3
  • ENV: XDG_SESSION_TYPE: x11; MM_CONFIG_FILE: undefined
    WAYLAND_DISPLAY: undefined; DISPLAY: :0.0; ELECTRON_ENABLE_GPU: undefined
  • RAM: total: 48076.70 MB; free: 42777.97 MB; used: 5298.73 MB
  • OTHERS: uptime: 127 minutes; timeZone: America/Chicago

Which start option are you using?

node --run start:x11

Are you using PM2?

Yes

Module

updatenotification

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Configuration
      {
        module: "updatenotification",
        position: "top_center",
        order: "*",
        disabled: false,
        hiddenOnStartup: false,
        configDeepMerge: false,
        animateIn: "None",
        animateOut: "None",
        config: {
          updateAutorestart: true,
          updateInterval: 60000,
          updates: [
            { 'SampleModule':'git pull'}
          ]     
        }
      },

<!-- Paste relevant code here -->

Steps to reproduce the issue:
set UPN confg as above
start MM via pm2
then update one of the modules active in the config.js

What did you expect to happen?

expected module to update and MM to restart (per the new restart fix)

What actually happened?

HOWEVER , when MM is started via pm2, the git commands fail

2026-05-20 14:46:48.424] [ERROR] [updatenotification] Failed to get git revisions for MMM-Wallpaper: Error: Command failed: git rev-list --ancestry-path --count ecff59a..86a0df4  master
fatal: ambiguous argument 'ecff59a..86a0df4  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:48.819] [ERROR] [updatenotification] Failed to get git revisions for MMM-EmbedURL: Error: Command failed: git rev-list --ancestry-path --count b401282..a6215fa  with_MMM-Config
fatal: ambiguous argument 'b401282..a6215fa  with_MMM-Config': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:49.131] [ERROR] [updatenotification] Failed to get git revisions for MMM-Config: Error: Command failed: git rev-list --ancestry-path --count 7702261..c12fefe  main
fatal: ambiguous argument '7702261..c12fefe  main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:49.740] [ERROR] [updatenotification] Failed to get git revisions for MMM-CalendarExt3: Error: Command failed: git rev-list --ancestry-path --count e93534d..8b8e4f4  main
fatal: ambiguous argument 'e93534d..8b8e4f4  main': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:50.057] [ERROR] [updatenotification] Failed to get git revisions for MMM-page-indicator: Error: Command failed: git rev-list --ancestry-path --count 4d2cbd6..c431bb9  master
fatal: ambiguous argument '4d2cbd6..c431bb9  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

[2026-05-20 14:46:50.691] [ERROR] [updatenotification] Failed to get git revisions for SampleModule: Error: Command failed: git rev-list --ancestry-path --count 9a81558..dd05c02  master
fatal: ambiguous argument '9a81558..dd05c02  master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

so it never detects the change, and does not know to update.

i tested this twice, deleted the .pm2/logs/project_name-*.log

I was wondering what would happen when we killed and restarted, disconnected from pm2,
the args still look the same..

[2026-05-20 14:49:26.946] [LOG]   [updatenotification] args= [
  '/home/sam/MagicMirror.2.36.dev/node_modules/electron/dist/electron',
  'js/electron.js'
]

and it came up, as x11 (on my system, as the process.env is passed on..)

and then

                const options = { cwd: this.root_path, detached: true, stdio: ["ignore", out, err] };
                const subprocess = Spawn(binary, args, options);
                subprocess.unref(); // allow the current process to exit without waiting for the subprocess
                process.exit();

do we have a race condition?, if newly spawned MM gets to open port, before current shuts down, we fail as port is in use
and I think we will have this with pm2 trying to restart the instance that died, while we have already started another instance..

the user will not be able to restart with pm2, as there is an instance running in the background.

if I stop the pm2 instance and do manual npm run start:x11
it detects, updates, and restarts as expected

Additional comments

No response

Participation

  • I am willing to submit a pull request for this change.

Activity

  1. sdetweil commented on May 20, 2026

    @sdetweil
    CollaboratorAuthor

    similar to #4137

  2. KristjanESPERANTO commented on May 20, 2026

    @KristjanESPERANTO
    Collaborator

    Oh my, is this a never-ending chain reaction? 🤯😅

  3. khassel commented on May 20, 2026

    @khassel
    Collaborator

    seeing the git error: are you really on develop?

  4. KristjanESPERANTO commented on May 20, 2026

    @KristjanESPERANTO
    Collaborator

    seeing the git error: are you really on develop?

    I think he is. In the system info Sam provided: MM: v2.37.0-develop.

    The git errors are from the module's repo.

    do we have a race condition?, if newly spawned MM gets to open port, before current shuts down, we fail as port is in use and I think we will have this with pm2 trying to restart the instance that died, while we have already started another instance.

    That should be fixable if we detect PM2 and then let PM2 respawn. I have a working draft, but it needs fine tuning and I want to write tests. That should at least solve the second problem. I still don't have a clue about the other one - but I'm just too tired right now. I've been coding all day on my day off 😵😅

  5. sdetweil commented on May 20, 2026

    @sdetweil
    CollaboratorAuthor

    seeing the git error: are you really on develop?

    am@sams:~/MagicMirror.2.36.dev$ grep version package.json
    	"version": "2.37.0-develop",
    
    sam@sams:~/MagicMirror.2.36.dev$ git branch
    * develop
      master
    
    sam@sams:~/MagicMirror.2.36.dev$ tail -n 20  ~/.pm2/logs/MagicMirror-test-error.log 
    fatal: ambiguous argument '9a81558..ce6a924  master': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    [2026-05-20 17:02:57.773] [ERROR] [updatenotification] Failed to get git revisions for MMM-OpenWeatherForecast: Error: Command failed: git rev-list --ancestry-path --count f8334cf..0b469c0  master
    fatal: ambiguous argument 'f8334cf..0b469c0  master': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    [2026-05-20 17:02:58.123] [ERROR] [updatenotification] Failed to get git revisions for MMM-pages: Error: Command failed: git rev-list --ancestry-path --count 75b6f00..2475b4b  master
    fatal: ambiguous argument '75b6f00..2475b4b  master': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    [2026-05-20 17:02:58.477] [ERROR] [updatenotification] Failed to get git revisions for MMM-CurlToNotification: Error: Command failed: git rev-list --ancestry-path --count bd1e417..9c890bf  main
    fatal: ambiguous argument 'bd1e417..9c890bf  main': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    
    
  6. sdetweil commented on May 20, 2026

    @sdetweil
    CollaboratorAuthor

    but I'm just too tired right now. I've been coding all day on my day off

    this isn't fatal.. we have over a month... I opened issue to track.. not push anyone to do it NOW!

  7. sdetweil commented on May 20, 2026

    @sdetweil
    CollaboratorAuthor

    The git errors are from the module's repo.

    copy the text of the failed command into a shell, cwd in the module folder works

    same for each module failed.. the commit numbers are correct for each, the branch is correct for each..

    git doesn't like something in the parms..

    I wonder if we can hook a shell script in here to see what 'git' is getting

  8. added 2 commits that reference this issue on May 21, 2026
    f0d2f5b
    b0bebf4
  9. KristjanESPERANTO commented on May 21, 2026

    @KristjanESPERANTO
    Collaborator

    Just to be sure — could you show which commit you're on in your MagicMirror directory?

    git log -1
  10. sdetweil commented on May 21, 2026

    @sdetweil
    CollaboratorAuthor
    commit 9a3538de01e83cac6cfc82d6e249b506fddaae83 (HEAD -> develop, origin/develop)
    Author: Kristjan ESPERANTO <[email protected]>
    Date:   Wed May 20 20:16:17 2026 +0200
    
        chore: update dependencies (#4162)
        
        This updates the dependencies and implements a workaround for the
        failing ci tests on node 26.1.0 (#4150).
    
  11. sdetweil commented on May 21, 2026

    @sdetweil
    CollaboratorAuthor

    i am 2 commits behind , but unrelated

    Image
  12. added a commit that references this issue on May 21, 2026
    03e4eef
  13. KristjanESPERANTO commented on May 22, 2026

    @KristjanESPERANTO
    Collaborator

    I cannot reproduce the error. Could it be that you pulled the fix but PM2 was still running the old pre-fix code in memory? Sorry if I'm wrong - I just can't explain it any other way yet! 🤔

  14. sdetweil commented on May 22, 2026

    @sdetweil
    CollaboratorAuthor

    my pm2 was downlevel, 5.4, updated now, and did pm2 update so in memory is updated..

    same problem

    /home/sam/.pm2/logs/MagicMirror-test-error.log last 15 lines:
    10|MagicMi | [2026-05-22 17:21:47.918] [ERROR] [updatenotification] Failed to get git revisions for MMM-OpenWeatherForecast: Error: Command failed: git rev-list --ancestry-path --count f8334cf..0b469c0  master
    10|MagicMi | fatal: ambiguous argument 'f8334cf..0b469c0  master': unknown revision or path not in the working tree.
    10|MagicMi | Use '--' to separate paths from revisions, like this:
    10|MagicMi | 'git <command> [<revision>...] -- [<file>...]'
    10|MagicMi | 
    10|MagicMi | [2026-05-22 17:21:48.277] [ERROR] [updatenotification] Failed to get git revisions for MMM-pages: Error: Command failed: git rev-list --ancestry-path --count 75b6f00..2475b4b  master
    10|MagicMi | fatal: ambiguous argument '75b6f00..2475b4b  master': unknown revision or path not in the working tree.
    10|MagicMi | Use '--' to separate paths from revisions, like this:
    10|MagicMi | 'git <command> [<revision>...] -- [<file>...]'
    10|MagicMi | 
    10|MagicMi | [2026-05-22 17:21:48.644] [ERROR] [updatenotification] Failed to get git revisions for MMM-CurlToNotification: Error: Command failed: git rev-list --ancestry-path --count bd1e417..9c890bf  main
    10|MagicMi | fatal: ambiguous argument 'bd1e417..9c890bf  main': unknown revision or path not in the working tree.
    10|MagicMi | Use '--' to separate paths from revisions, like this:
    10|MagicMi | 'git <command> [<revision>...] -- [<file>...]'
    10|MagicMi | 
    
    /home/sam/.pm2/logs/MagicMirror-test-out.log last 15 lines:
    10|MagicMi | [2026-05-22 17:21:44.702] [INFO]  [updatenotification] Checking git for module: MMM-page-indicator
    10|MagicMi | [2026-05-22 17:21:44.708] [INFO]  [updatenotification] Checking git for module: MMM-NewsFeedTicker
    10|MagicMi | [2026-05-22 17:21:44.715] [INFO]  [updatenotification] Checking git for module: SampleModule
    10|MagicMi | [2026-05-22 17:21:44.720] [INFO]  [helpers] [MMM-HomeAssistantDisplay] [
    10|MagicMi |   'Conected to Home Assistant for module_11_MMM-HomeAssistantDisplay after 0 retries'
    10|MagicMi | ]
    10|MagicMi | [2026-05-22 17:21:44.721] [INFO]  [updatenotification] Checking git for module: MMM-OpenWeatherForecast
    10|MagicMi | [2026-05-22 17:21:44.726] [INFO]  [updatenotification] Checking git for module: MMM-pages
    10|MagicMi | [2026-05-22 17:21:44.733] [INFO]  [updatenotification] Checking git for module: MMM-CurlToNotification
    10|MagicMi | [2026-05-22 17:21:44.739] [INFO]  [updatenotification] Checking git for module: MagicMirror
    10|MagicMi | [2026-05-22 17:21:44.809] [INFO]  [calendar] Broadcasting 23 events from https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics.
    10|MagicMi | [2026-05-22 17:21:45.474] [INFO]  [calendar] Broadcasting 141 events from https://calendar.google.com/calendar/ical/sdetweil%40gmail.com/private-b01395933cda72021e36fae98c07a186/basic.ics.
    10|MagicMi | [2026-05-22 17:21:46.314] [LOG]   [MMM-Config] stdout: completed
    10|MagicMi | 
    10|MagicMi | [2026-05-22 17:21:49.017] [INFO]  [updatenotification] Update found for module: MMM-HomeAssistantDisplay
    
    ####  System Information  ####
    - SYSTEM:   manufacturer: System manufacturer; model: System Product Name; virtual: false; MM: v2.36.0
    - OS:       platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-179-generic
    - VERSIONS: electron: 41.3.0; used node: 22.22.1; installed node: 22.22.1; npm: 10.9.4; pm2: 6.0.14
    - ENV:      XDG_SESSION_TYPE: x11; MM_CONFIG_FILE: undefined
                WAYLAND_DISPLAY:  undefined; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
    - RAM:      total: 48076.72 MB; free: 43390.32 MB; used: 4686.39 MB
    - OTHERS:   uptime: 459 minutes; timeZone: America/Chicago
    

    pm2 version is weird..

    sam@sams:~/MagicMirror.2.36.dev$ pm2 --version
    7.0.1
    

    updated

    >>>> In-memory PM2 is out-of-date, do:
    >>>> $ pm2 update
    In memory PM2 version: 5.4.3
    Local PM2 version: 7.0.1
    
    
                      -------------
    
    
      ██████╗ ███╗   ███╗██████╗     ██╗    ██╗ ██████╗
      ██╔══██╗████╗ ████║╚════██╗    ██║   ██╔╝██╔═══██╗
      ██████╔╝██╔████╔██║ █████╔╝    ██║  ██╔╝ ██║   ██║
      ██╔═══╝ ██║╚██╔╝██║██╔═══╝     ██║ ██╔╝  ██║   ██║
      ██║     ██║ ╚═╝ ██║███████╗    ██║██╔╝   ╚██████╔╝
      ╚═╝     ╚═╝     ╚═╝╚══════╝    ╚═╝╚═╝     ╚═════╝
    
                      https://pm2.io/
    
         Harden your Node.js Production Environment
    
          - Real-time Monitoring Web Interface
          - Pro Active Alerting System
          - Production Profiling for Memory and CPU
          - PM2 Runtime High Availability Fallback
    
    
                 Start using it by typing:
    
                        $ pm2 plus
    
                      -------------
    
    [PM2] Applying action deleteProcessId on app [all](ids: [
       0, 1, 2, 3, 4,
       5, 6, 7, 8, 9,
      10
    ])
    [PM2] [Smart Mirror](0) ✓
    [PM2] [startspot](1) ✓
    [PM2] [smart-mirror ttt](4) ✓
    [PM2] [smart-mirror](5) ✓
    [PM2] [MagicMirror1](6) ✓
    [PM2] [MagicMirror 8](7) ✓
    [PM2] [MagicMirror](8) ✓
    [PM2] [checkarec](2) ✓
    [PM2] [start_alexa_bk](3) ✓
    [PM2] [testups](9) ✓
    [PM2] [MagicMirror-test](10) ✓
    [PM2] [v] All Applications Stopped
    [PM2] [v] PM2 Daemon Stopped
    [PM2] Spawning PM2 daemon with pm2_home=/home/sam/.pm2
    [PM2] Restoring processes located in /home/sam/.pm2/dump.pm2
    [PM2] Process /home/sam/smart-mirror/scripts/bash-start.sh restored
    [PM2] Process /home/sam/startspot.sh restored
    [PM2] Process /home/sam/checkarec.sh restored
    [PM2] Process /home/sam/start_alexa_bk.sh restored
    [PM2] Process /home/sam/ttt/scripts/bash-start.sh restored
    [PM2] Process /home/sam/temp/sssss/smart-mirror/scripts/bash-start.sh restored
    [PM2] Process /home/sam/MagicMirror/installers/mm.sh restored
    [PM2] Process /home/sam/MagicMirror/installers/mm.sh restored
    [PM2] Process /home/sam/MagicMirror/installers/mm.sh restored
    [PM2] Process /home/sam/testups.sh restored
    [PM2] Process /home/sam/MagicMirror.2.36.dev/installers/mm.sh restored
    >>>>>>>>>> PM2 updated
    
  15. KristjanESPERANTO commented on May 23, 2026

    @KristjanESPERANTO
    Collaborator

    Why does systeminfo now output MM: v2.36.0 and not MM: v2.37.0-develop?

  16. sdetweil commented on May 23, 2026

    @sdetweil
    CollaboratorAuthor

    thanks.. I missed that too!

    the shell script started by pm2 was hard coded to cd ~/MagicMirror, oops.. not this folder..
    so, never mind
    closing

  17. KristjanESPERANTO commented on May 23, 2026

    @KristjanESPERANTO
    Collaborator

    I'm glad we figured it out 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions