Error: RROR] Process or Namespace not found. PM2 Error Linux Server with github actions
Asked Answered
G

3

8

I recently updated my self-hosted linux server on compute engine. Pm2 had been working perfectly along my github actions previously. However after update when i restart a pm2 instance from my ssh terminal it works fine. But when I try to restart pm2 instance from github actions jobs then it throws me this error. I've uninstall and reinstalled pm2 but still the same error. Previously it worked fine but now it shows me this error.

So if i run the github action then this error shows enter image description here

But when i run the same command from ssh termianl connected to my server then it works fine enter image description here

Any help would be appreciated

Gaiser answered 8/9, 2021 at 18:29 Comment(0)
L
0

This problem may be caused by not setting the environment variable PM2_HOME correctly.

  • What is PM2_HOME from ChatGPT: PM2_HOME is an environment variable that specifies the directory where PM2 stores its configuration files and data, including log files, process lists, and keys. By default, if PM2_HOME is not set, PM2 uses the .pm2 folder in the user's home directory (e.g., ~/.pm2 on Linux or macOS).

Problems I encountered

  • I encountered the same problem when using our company's internal CI tool. The root of this problem is that the CI tool also uses PM2 to manage its own services. When you use the CI tool to execute a script, if the environment variable PM2_HOME is not set, the CI tool will use its own PM2 process (which is different from the PM2 process in your ssh), so the PM2 of the process cannot find the target service.

Two solutions

  • Check this doc.
  1. Temporarily set PM2_HOME: PM2_HOME='<your pm2 home>' pm2 <command>
  2. Setting PM2_HOME in .bashrc/.shrc/.zshrc

Way to find PM2_HOME location of a running PM2 thread

  • run command ps aux|grep PM2
  • you will see something like this picture
  • the path in the red box in the figure is the path of PM2_HOME of this pm2 process
  • Next, you can specify PM2_HOME as these paths and view the services managed by these pm2 processes.
    • like PM2_HOME='.pm2' pm2 ls
Lovash answered 16/8 at 8:4 Comment(0)
F
1

First, Kill the processes via ssh.
Then, do pm2 restart ecosystem.config.js via Github CI.

Fairspoken answered 14/5, 2022 at 18:40 Comment(0)
S
0

Running the svc.sh with sudo fixed it

Resinstall the service with sudo ./svc.sh install and start it

I hope you are clear with this solution

Slimsy answered 15/5, 2022 at 20:6 Comment(0)
L
0

This problem may be caused by not setting the environment variable PM2_HOME correctly.

  • What is PM2_HOME from ChatGPT: PM2_HOME is an environment variable that specifies the directory where PM2 stores its configuration files and data, including log files, process lists, and keys. By default, if PM2_HOME is not set, PM2 uses the .pm2 folder in the user's home directory (e.g., ~/.pm2 on Linux or macOS).

Problems I encountered

  • I encountered the same problem when using our company's internal CI tool. The root of this problem is that the CI tool also uses PM2 to manage its own services. When you use the CI tool to execute a script, if the environment variable PM2_HOME is not set, the CI tool will use its own PM2 process (which is different from the PM2 process in your ssh), so the PM2 of the process cannot find the target service.

Two solutions

  • Check this doc.
  1. Temporarily set PM2_HOME: PM2_HOME='<your pm2 home>' pm2 <command>
  2. Setting PM2_HOME in .bashrc/.shrc/.zshrc

Way to find PM2_HOME location of a running PM2 thread

  • run command ps aux|grep PM2
  • you will see something like this picture
  • the path in the red box in the figure is the path of PM2_HOME of this pm2 process
  • Next, you can specify PM2_HOME as these paths and view the services managed by these pm2 processes.
    • like PM2_HOME='.pm2' pm2 ls
Lovash answered 16/8 at 8:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.