-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PM2 not start after system reboot #2775
Comments
Hi That's seems to be the same problem here: #2765 That will be fixed in the next release ;) |
Not sure it is, pm2 should boot faster (so under the timeout) and so resurrect applications. |
For the moment I back on the version 2.4.0 which didn't have this problem of resurrect. You can try this workaround if you are in a hurry :) |
Can you try the fix ? |
@vmarchaud, Yes, After reinstall from |
I am having this issue on version 2.4.5. What is the resolution? |
2.4.6 still an issue Ubuntu 16.04 |
i am facing the same issue in 2.5.0. |
@smohankarthik resolved ? if so how ? :) |
Same problem in a RasberryPi with ArchLinux on it and pm2 at version 2.6.1. |
solved for me on my rPi by doing |
@revolunet do you run pm2 as root user? In my case I run it by my own user, and if I run
My dump file location is not in the root dir. When I reboot I don't have any proccess startup, and is I run
|
yes in my case i need to run it as root If you launch it as root, then each call to |
@revolunet yes, your right its was working only when your a root user. Non-Root user didnt work for me. I followed the steps which are mentioned in the following link , there a comment made by cdaringe i just followed that. |
Hi, I got this problem too in v 2.72, i am login as root user, tried to run
OS: RHEL 7.2 Anyone facing this too? |
I had to do: This is because I was starting pm2 using a node script: |
This was a no go for me. #2775 (comment)
www@awsre574186:~$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /home/www/.pm2/dump.pm2
www@awsre574186:~$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u www --hp /home/www
www@awsre574186:~$ sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u www --hp /home/www
[PM2] Init System found: systemd
Platform systemd
Template
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target
[Service]
Type=forking
User=www
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/home/www/.pm2
PIDFile=/home/www/.pm2/pm2.pid
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
[Install]
WantedBy=multi-user.target
Target path
/etc/systemd/system/pm2-www.service
Command list
[ 'systemctl enable pm2-www',
'systemctl start pm2-www',
'systemctl daemon-reload',
'systemctl status pm2-www' ]
[PM2] Writing init configuration in /etc/systemd/system/pm2-www.service
[PM2] Making script booting at startup...
>>> Executing systemctl enable pm2-www
[DONE]
>>> Executing systemctl start pm2-www
Job for pm2-www.service failed because a configured resource limit was exceeded. See "systemctl status pm2-www.service" and "journalctl -xe" for details.
[ERROR] Exit code : 1
[PM2][ERROR] systemctl start pm2-www failed, see error above.
www@awsre574186:~$ what I get from -- The start-up result is done.
Mar 15 04:04:47 ip-172-31-95-70 systemd[1]: Starting PM2 process manager...
-- Subject: Unit pm2-www.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit pm2-www.service has begun starting up.
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: [PM2] Resurrecting
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: [PM2] Restoring processes located in /home/www/.pm2/dump.pm2
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: ┌────────────────────┬────┬──────┬───────┬─────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: ├────────────────────┼────┼──────┼───────┼─────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ lsae_cron │ 7 │ fork │ 19753 │ stopped │ 5 │ 0 │ 0% │ 0 B │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ lsae_queue_worker1 │ 8 │ fork │ 16964 │ online │ 0 │ 5m │ 0% │ 42.7 MB │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ lsae_queue_worker2 │ 9 │ fork │ 16966 │ online │ 0 │ 5m │ 0% │ 42.4 MB │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ node_logwatch │ 12 │ fork │ 17012 │ online │ 0 │ 5m │ 0% │ 47.3 MB │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ node_services │ 10 │ fork │ 16974 │ online │ 0 │ 5m │ 0% │ 54.0 MB │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ node_websockets │ 11 │ fork │ 16976 │ online │ 0 │ 5m │ 0% │ 51.7 MB │ www │ disabled │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: └────────────────────┴────┴──────┴───────┴─────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: Module activated
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: ┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┬──────┐
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ Module │ version │ target PID │ status │ restart │ cpu │ memory │ user │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: ├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┼──────┤
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: │ pm2-logrotate │ 2.4.0 │ N/A │ online │ 1 │ 0% │ 56.516 MB │ www │
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: └───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┴──────┘
Mar 15 04:04:48 ip-172-31-95-70 pm2[20099]: Use `pm2 show <id|name>` to get more details about an app
Mar 15 04:04:48 ip-172-31-95-70 systemd[1]: pm2-www.service: PID file /home/www/.pm2/pm2.pid not readable (yet?) after start: No such file or directory
Mar 15 04:04:48 ip-172-31-95-70 systemd[1]: Failed to start PM2 process manager.
-- Subject: Unit pm2-www.service has failed
-- Defined-By: systemd the line: |
Turns out I was trying to create a startup script without doing Here's what eventually work, assuming only 1 user on the system is using pm2 in the example: # stop and delete all previous pm2 processes for www user
sudo su - www -c "pm2 stop all || true";
sudo su - www -c "pm2 delete all || true";
# remove startup script and kill any lingering pm2 processes
sudo pm2 unstartup || true;
pkill -f pm2 || true;
# start pm2 processes for the 'www' user
sudo su - www -c "pm2 start /home/www/ecosystem.config.js";
# save process list and create startup script
sudo su - www -c "pm2 save;";
sudo pm2 startup -u www --hp /home/www; However it may still be possible to get this error #3274 |
no me refiero adaptar al que tenemos sino ir empezando algo con este nuevo que puedes ser el futuro |
Una disculpa por comentar en español en un foro en Inglés pero encontré la solución al problema. 1.- pm2 start "ejemplo.js" Después de ejecutar lo anterior hacer un "sudo reboot" y con eso el problema queda resuelto. Saludos. |
No se de que me hablas amigo jajaja
Enviado desde mi iPhone
… El 19 ago 2020, a las 17:05, RicardoZap ***@***.***> escribió:
Una disculpa por comentar en español en un foro en Inglés pero encontré la solución al problema.
Ami me funcionó ejecutando el siguiente método:
1.- pm2 start "ejemplo.js"
2.- pm2 save
3.- pm2 startup
4.- sudo env PATH=$PATH:/usr/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi
Después de ejecutar lo anterior hacer un "sudo reboot" y con eso el problema queda resuelto. Saludos.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Solution is: |
Expected behaviour
Saved processes start automatically after the machine starts up
Actual behaviour
The processes are not started after the system is started
Steps to reproduce
After reboot
Software versions used
PM2 Log output
The text was updated successfully, but these errors were encountered: