"Current process list running is not in sync with saved list. npm differs. Type 'pm2 save' to synchronize."
It does not start over at boot and sometimes gives different errors.
The "npm differs" seems a good hint but I don't know what to do as npm is the latest version globally (npm install -g npm)
I don't really know, it was working on a different server, now it just tells me the process list is not in sync.
I installed npm, installed my repo and then installed npm2. Same dynamic as the old server.
Maybe installing from root wasn't good?
I don't really think so..
--- PM2 report ----------------------------------------------------------------
Date : Thu Dec 19 2019 17:35:40 GMT+0100 (Central European Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.2.0
node version : 13.3.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 3min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.2.0
node version : 13.3.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/bin/pm2,report
argv0 : node
user : root
uid : 0
gid : 0
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz
cpus nb : 4
freemem : 13558943744
totalmem : 16812118016
home : /root
===============================================================================
--- PM2 list -----------------------------------------------
โโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโ
โ id โ name โ mode โ โบ โ status โ cpu โ memory โ
โโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโค
โ 0 โ npm โ fork โ 0 โ online โ 0.1% โ 45.5mb โ
โโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโ
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2 | 2019-12-19T17:31:42: PM2 log: BUS socket file : /root/.pm2/pub.sock
PM2 | 2019-12-19T17:31:42: PM2 log: Application log path : /root/.pm2/logs
PM2 | 2019-12-19T17:31:42: PM2 log: Worker Interval : 30000
PM2 | 2019-12-19T17:31:42: PM2 log: Process dump file : /root/.pm2/dump.pm2
PM2 | 2019-12-19T17:31:42: PM2 log: Concurrent actions : 2
PM2 | 2019-12-19T17:31:42: PM2 log: SIGTERM timeout : 1600
PM2 | 2019-12-19T17:31:42: PM2 log: ===============================================================================
PM2 | 2019-12-19T17:31:42: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2019-12-19T17:31:42: PM2 log: App [npm:0] online
PM2 | 2019-12-19T17:31:46: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2019-12-19T17:31:46: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2019-12-19T17:31:46: PM2 log: App [npm:0] online
PM2 | 2019-12-19T17:31:49: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT]
PM2 | 2019-12-19T17:31:49: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2019-12-19T17:31:49: PM2 log: App [npm:0] online
PM2 | 2019-12-19T17:31:49: PM2 log: Stopping app:npm id:0
PM2 | 2019-12-19T17:31:49: PM2 log: App [npm:0] exited with code [0] via signal [SIGINT]
PM2 | 2019-12-19T17:31:49: PM2 log: pid=26339 msg=process killed
PM2 | 2019-12-19T17:32:27: PM2 log: App [npm:0] starting in -fork mode-
PM2 | 2019-12-19T17:32:27: PM2 log: App [npm:0] online
I've actually had this same issue this week. If I run a ps aux | grep node I don't see any Node processes that aren't showing up in the pm2 list, but it tells me the same warning.
What it's telling you is that the processes currently running are different from the processes that are listed in the dump file (generally ~/.pm2/dump.pm2). This is why it doesn't restart those applications at boot, because at boot it's going to start whatever is listed in the dump file.
If you want things to restart on boot, you should do what it says and run pm2 save to update the dump file with what is currently running.
If (like me) you are using pm2 for temporary development processes and you don't want it to restart anything on boot then you can get rid of the warning by just deleting the dump file.
Alas, pm2 changes nothing and I need apps to be restarted
I have same issue on window system, same warn. Pm2 version is 4.2.3.
I hit this problem today, running pm2 update restarted all processes.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
well stalebot is probably one of the stupidest things I have ever heard of, this is still an issue BTW.
Lukily @VirtueMe hint fixed my server but seems there is an issue. In my case, happened after a hard reboot but autosave was active.
I'm running into this issue as well. As a work around I've added this to the rc.local on the host:
PM2_HOME=/opt/my-service /usr/bin/pm2 resurrect
chown -R root:my-team /opt/my-service/
I hit this problem today, running
pm2 updaterestarted all processes.
This seem to solve the problem , but if I reboot the system ... I have to run this command again ...
I found it !
make sure you specify the user after the startup option
pm2 startup -u nodeuser
for me I used root and reboot server, and voila !
pm2 startup -u root
Tested @nsssim solution and no longer got the sync issue. Thanks!
This is how I solved.
TLDR:
you need these three steps
1. npm install pm2@latest -g (Upgrade to 4.4.0)
2. pm2 set pm2:autodump true
3. Stop all processes, reboot, start them again
LONG VERSION:
the latest updates gave me hints on what to do with messages by pm2. First message:
Be sure to have the latest version by doing `npm install pm2@latest -g` before
doing this procedure.
so I upgraded to 4.4.0 . Second message I got AFTER the update:
>>>> In-memory PM2 is out-of-date, do:
>>>> $ pm2 update
so I updated all processes, or stopped them rebooted and started them again. Third message:
[PM2][WARN] Current process list running is not in sync with saved list.
Type 'pm2 save' to synchronize or enable autosync via
'pm2 set pm2:autodump true'
so I set the autodump as true.
Now everything works. Great update. Thanks everyone.
I found it !
make sure you specify the user after the startup option
pm2 startup -u nodeuser
for me I used root and reboot server, and voila !
pm2 startup -u root
Since I couldn't reliably get my PM2 processes to restart on reboot, here's what was successful:
crontab -e
@reboot sudo pm2 resurrect
Hi @egekhter , run pm2 startup -u username, where username is, of course, the user where PM2 runs. It will show you a command line.
Run that command line with sudo and that should work. Basically creates a service in root that starts the daemon in the target user.
Most helpful comment
I hit this problem today, running
pm2 updaterestarted all processes.