pm2
pm2 copied to clipboard
pm2 startup systemd - failed because the service did not take the steps required by its unit configuration
What's going wrong?
Job for pm2-wololo.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status pm2-wololo.service" and "journalctl -xe" for details.
How could we reproduce this issue?
Following this guide https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04
Supporting information
$ pm2 report
===============================================================================
--- PM2 REPORT (Mon Sep 24 2018 04:45:23 GMT+0000 (Coordinated Universal Time))
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 3.1.3
node version : 10.11.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : wololo
uid : 1000
gid : 1000
uptime : 12min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 3.1.3
node version : 10.11.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/bin/pm2,report
argv0 : node
user : wololo
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
cpus nb : 1
freemem : 545316864
totalmem : 1033383936
home : /home/wololo
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬──────┬───────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼──────┼───────────┼────────┼──────────┤
│ hello │ 0 │ fork │ 2152 │ online │ 0 │ 5m │ 0.1% │ 32.9 MB │ wololo │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴──────┴───────────┴────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼────────┼──────────┤
│ hello │ 0 │ fork │ 2152 │ online │ 0 │ 5m │ 0% │ 32.9 MB │ wololo │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
@MarvelousWololo I've hit the same issue... I'll post back if I discover anything.
@MarvelousWololo I ended up shutting down my server and starting it back up... once I did this everything seemed to be working fine.
I had the same issue with the same fix @corywheeler -- I had just barely set up a new ubuntu 18.04 box, and had never rebooted it.
I had the same issue as @corywheeler and @eegrok. I was able to get things working after a reboot. For those unfamiliar with the command it is: sudo reboot
@corywheeler, same here, after the reboot everything works OK. (spend two days on it...) Thanks!
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-)
ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
@harupu : It works for me also
@harupu worked for me as well :pray:
@harupu It has also worked for me Thank you
@harupu: also worked for me. many thx
Worded for me too
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-)
ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
Worked for me without the need to restart my server, thank you.
Didn't try the ps command, but the reboot worked for me :3 Thanks!
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.
Dude, after hours of debugging, restart works! thanks mate
Great. It works for me too.
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-)
ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
tnx alot
I had the same problem with ubuntu 16, I need to execute pm2 resurrect every time my server has rebooted.
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-) ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
This is the same as pm2 kill right? - just kill the pm2 master process.
Job for pm2-wololo.service failed because the service did not take the steps required by its unit configuration. See "systemctl status pm2-wololo.service" and "journalctl -xe" for details.
This basically means the pm2 master process should be launched by the systemd, so it can manage it. But in most cases, if you follow the tutorial the master process is launched by yourself. That explains why it works after a restart/kill the master process - you get no pm2 running and the systemd can take over.
I suppose the correct steps to set up your server are:
- run
pm2 killto kill the master process if it launched already. - run
pm2 startup systemd. - run the command it generates on step 2
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u USERNAME --hp /home/USERNAME - run
sudo service pm2-USERNAME start, now you have a pm2 master process managed by systemd. You can verify it withservice pm2-USERNAME status. - run
pm2 start your-ecosystem.fileto start your apps. - run
pm2 saveto save your app configuration to/home/USERNAME/.pm2, so systemd launched pm2 master process can resume it from after a server restart.
@favoyang Thank you, That worked for me very well
@favoyang works like a charm, thank you!
I had the same issue and resolved with: pm2 kill rm -rf node_modules npm i pm2 start index.js
sudo shutdown -r now
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-)
ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
it is work for me than you
worked for me after reboot the server
@MarvelousWololo I ended up shutting down my server and starting it back up... once I did this everything seemed to be working fine.
Rebooting the server worked for me, too.
@harupu you save my time 😄
It seems killing the pm process is the same way as a reboot. Anyway thanks.
Worked as expected after reboot server
I had the same issue as @corywheeler and @eegrok. I was able to get things working after a reboot. For those unfamiliar with the command it is:
sudo reboot
Thanks you Saved my day ^_^
Reboot worked for me
I had the same issue. But after run command showed below, pm2 startup systemd started with no error :-)
ps aux | grep pm2 | grep -v grep | awk '{print $2}' | xargs kill -9
this wroked for me in combination with the below
sudo su
The following start command will timeout
systemctl start pm2-USERNAME
Then do this
ausearch -c 'systemd' --raw | audit2allow -M my-systemd semodule -i my-systemd.pp
NOTE: this is NOT a mistake, it has to be done twice
systemctl start pm2-USERNAME
Again, the above start command will timeout
ausearch -c 'systemd' --raw | audit2allow -M my-systemd semodule -i my-systemd.pp systemctl start pm2-USERNAME
Finally the above start command will start the pm2 service, and verify it with
systemctl status pm2-USERNAME