pm2 startup doesn't correctly detect platform on ubuntu 14.04

Created on 19 Jan 2017  路  6Comments  路  Source: Unitech/pm2

Expected behaviour

On ubuntu 14.04 pm2 startup ubuntu should use upstart on ubuntu 14.04 to setup startup script

Actual behaviour

pm2 startup ubuntu uses systemd for startup script generation on ubuntu 14.04

At the end it says

/bin/sh: 1: systemctl: not found
[error] exit code: 127
[pm2][error] systemctl enable pm2 failed, see error above.

and after that when I restarted the system it didn't boot up, I had to manually fix startup scripts.

my solution was to manually run

pm2 unstartup
pm2 startup upstart

Software versions used

OS         : Ubuntu 14.04
node.js    : 6.9.x
PM2        : latest

Most helpful comment

Because the new LTS version of ubuntu is 16.04 so by default, ubuntu is referring to the version 16.04.
See code source here, you will understand that you should use either pm2 startup or pm2 startup ubuntu14 or pm2 startup upstart
We added a check in pm2 v2.3 (will be released next week) with message to say that you didn't specify the right init-system.

All 6 comments

Have you run the command pm2 startup or pm2 startup ubuntu?

How could it detect systemctl automatically if it's not present on the system? https://github.com/Unitech/pm2/blob/master/lib/API/Startup.js#L48

Correct, I checked the command history and it was definitely pm2 startup ubuntu, I'll update the issue description

Because the new LTS version of ubuntu is 16.04 so by default, ubuntu is referring to the version 16.04.
See code source here, you will understand that you should use either pm2 startup or pm2 startup ubuntu14 or pm2 startup upstart
We added a check in pm2 v2.3 (will be released next week) with message to say that you didn't specify the right init-system.

Thanks, it should be on docs page though.

It is on the docs there, i guess it's not clear for you, how would you write that ? (repo is over here if you want to make a PR)

Thanks, was looking for that repo, I think It'd be convenient if docs listed all available platforms

Was this page helpful?
0 / 5 - 0 ratings

Related issues

getvega picture getvega  路  3Comments

webchaz picture webchaz  路  3Comments

chaos-git picture chaos-git  路  3Comments

rajendar38 picture rajendar38  路  3Comments

rangercyh picture rangercyh  路  4Comments