PM2 services missing after reboot? Restore every process from the .pm2 folder (full guide)
PM2 services disappear after reboot? How to restore all processes from .pm2 (complete guide)
When deploying Node.js apps on a server, many people rely on PM2 for process management. But after a server reboot, they run into:
pm2 list
→ empty, no servicesYet the .pm2/ folder is still there, which means your previous process info exists. So why do PM2 services vanish? How do you bring them back?
This guide explains why PM2 processes go missing and gives three end-to-end recovery options.
🧩 Why do PM2 processes vanish after reboot?
There are three common causes:
1. You never ran pm2 save (most common)
PM2 does not auto-save the running app list.
You must run:
pm2 saveIt generates:
~/.pm2/dump.pm2That file restores processes after reboot.
If you skip it, PM2 will start after reboot but the process list will be empty.
2. Startup is not configured
You need to run:
pm2 startupAnd execute the systemctl command that PM2 prints:
Example:
sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u ubuntu --hp /home/ubuntuIf you skip this, PM2 will not read dump.pm2 at boot and will not restore processes.
3. Using the wrong user for pm2
PM2 processes are separated by user:
| User | PM2 data directory |
|---|---|
| root | /root/.pm2/ |
| ubuntu / admin | /home/ubuntu/.pm2/ |
| wenhao | /home/wenhao/.pm2/ |
If you:
- started services as ubuntu
- after reboot, check with root
You get:
pm2 list → emptyBut the .pm2 folder actually lives under the original user.
🟢 Scenario 1: dump.pm2 exists → one-command restore
Check the file:
ls ~/.pm2/dump.pm2If it exists:
🔥 Run the restore:
pm2 resurrectThen:
pm2 listAll services return, including:
✔ names
✔ start params
✔ env vars
✔ restart strategy
This is the cleanest and most complete way.
🟠 Scenario 2: No dump.pm2, but you have an ecosystem file
If your project folder includes:
ecosystem.config.jsRecovery is easy:
pm2 start ecosystem.config.js
pm2 saveAll services are restored based on the ecosystem definition.
🔵 Scenario 3: No dump.pm2 and no ecosystem → recover from PM2 logs
Even without a dump file, PM2 logs record the commands you previously ran.
Search history:
grep "pm2 start" ~/.pm2/*logSample output:
pm2 start app.js --name api
pm2 start worker.js --name job-workerThen re-run:
pm2 start app.js --name api
pm2 start worker.js --name job-worker
pm2 saveThis recreates the exact process setup.
🧪 After recovery, enable auto-start (critical)
Otherwise, you’ll lose processes again on the next reboot.
Run:
pm2 startupPM2 prints something like:
sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u ubuntu --hp /home/ubuntuCopy and execute that line.
Then save the current list:
pm2 save🧱 Best practices to avoid losing PM2 processes
Here is the recommended combo:
1. Save immediately after starting services
pm2 save2. Enable boot startup
pm2 startup3. Run the PM2-generated systemctl command
(This is the step most people forget.)
4. Back up the .pm2 folder regularly
~/.pm2/dump.pm2
~/.pm2/logs/🧭 Summary
| Scenario | Recovery approach |
|---|---|
| dump.pm2 exists | pm2 resurrect |
| ecosystem.config.js exists | pm2 start ecosystem.config.js |
| Neither exists | Rebuild from logs and pm2 save |
In every case, your processes can be restored.
📩 If you share the following, I can auto-recover for you:
whoami
ls -l ~/.pm2
cat ~/.pm2/dump.pm2
WenHaoFree