skip to Main Content

I just installed CentOS 8 and added nodejs (tried v12 & v14) And then I installed pm2 using npm install pm2@latest (so at the time of posting it uses v4.4.0). I did try an older version (v3.5.0), but it does the exact same thing.

and after pm2 got installed, i ran the command "pm2 startup"

after a restart, pm2 does start, but gets killed after 90 seconds and then restarts giving this message

"pm2 has been killed by signal, dumping process list before exit…"

First, I thought it was because of my app (the one that pm2 is supposed to manage), but i removed it from pm2, so it’s practically empty, but it does the same thing

5

Answers


  1. Chosen as BEST ANSWER

    Later update. For those who are facing the same issues. It's an issue related to SE Linux. Known workarounds (the ones I discovered).

    1. Disabling SE Linux (obviously, not recommended)

    2. go to /etc/systemd/system/pm2-root.service - comment PIDFile=... (add a # in front of that line)

    3. Audit and trace - use following commands:

       # dnf install policycoreutils-python-utils setroubleshoot-server -y
       # journalctl -f
      

      At ths point, you should see the solution in the output (the log) it should be something like:

      # ausearch -c 'systemd' --raw | audit2allow -M my-systemd
      # semodule -i my-systemd.pp
      

      You need to do the last step (ausearch... and semodule...) twice - I did it once, restarted the machine and noticed the same issue after 90 seconds. But if you read the log carefully, you will notice that the issue seems to be outputed twice. (looks the same). Probably two things are trying to write to that file (pm2-root.service).

    Still waiting for the perfect solution (done by the person that really knows how to fix this in a proper manner), but for those that have this issue, any of these options seem to work just fine.


  2. I had the same issue and I tried several solutions online but none worked for me.

    However, I completely removed pm2, restarted the server, and reinstalled pm2 and that does it for me.

    1- Stop and remove pm2

    pm2 kill
    sudo npm remove pm2 -g
    

    2- Restart the server

    sudo reboot
    

    3- Log in again, then reinstall pm2

    sudo npm install -g pm2
    
    Login or Signup to reply.
  3. I’ve had this problem (on Debian), when for some reason two "PM2 God Daemon" processes (not threads) were launched, so they conflicting with each other.

    Killing one of them solved the issue.

    Login or Signup to reply.
  4. I did not disable SE Linux (I think it’s not safe to disable it), but the following method helped me:

    Edit file: /etc/systemd/system/pm2-root.service

    1. Add new line: Environment=PM2_PID_FILE_PATH=/run/pm2.pid

    2. And replace: PIDFile=/root/.pm2/pm2.pid to: PIDFile=/run/pm2.pid

    Versions:

    • CentOS 8.3.2011
    • Node.js 14.16.0
    • NPM 7.7.5
    • PM2 4.5.5

    Original answer. Thanks Alec!

    Login or Signup to reply.
  5. Running the following command as root worked for me:

    pm2 update
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search