Cant upgrade Process Management after 14 -> 15 upgrade

I’ve just ungraded my FreePBX system from 14 to 15 using the installation module.

Most of the system is back up and running but I cant upgrade some of the modules - User Control Panel, XMPP and Zulu. I think it is because Process Management(PM) wont upgrade.

PM is @ 13.0.7.1 when I click on it I get the option to upgrade to 15.0.4 and Enable. The following is from the Status window

Installing pm2
Installing/Updating Required Libraries. This may take a while...Running installation.. ...........
Finished updating libraries!

There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Error(s) installing pm2:
Failed to run installation scripts
Updating Hooks...Done

The install.log

npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! pna.nextTick is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/asterisk/.npm/_logs/2020-11-11T23_31_17_561Z-debug.log

The 2020-11-11T23_31_17_561Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'install',
1 verbose cli   '--only=production' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session ffceffd2060520cc
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 17ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 2ms
16 silly install loadAllDepsIntoIdealTree
17 verbose stack TypeError: asyncWrite is not a function
17 verbose stack     at onwrite (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:480:7)
17 verbose stack     at WritableState.onwrite (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writab$
17 verbose stack     at WriteStream.to [as _worker] (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fet$
17 verbose stack     at WriteStream._write (/usr/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-$
17 verbose stack     at doWrite (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
17 verbose stack     at writeOrBuffer (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:41$
17 verbose stack     at WriteStream.Writable.write (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_w$
17 verbose stack     at WriteStream.to [as _worker] (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fet$
17 verbose stack     at WriteStream._write (/usr/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-$
17 verbose stack     at doWrite (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
17 verbose stack     at writeOrBuffer (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:41$
17 verbose stack     at WriteStream.Writable.write (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_w$
17 verbose stack     at WriteStream.to [as _worker] (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fet$
17 verbose stack     at WriteStream._write (/usr/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-$
17 verbose stack     at doWrite (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64)
17 verbose stack     at writeOrBuffer (/usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:41$
18 verbose cwd /var/www/html/admin/modules/pm2/node
19 verbose Linux 3.10.0-1127.19.1.el7.x86_64
20 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "--only=production"
21 verbose node v8.16.0

I’m not sure if this is a red herring but I have two instances of nodejs installed

nodejs.x86_64                                              2:8.11.3-1.7                                    @sng-pkgs/7
nodejs.x86_64                                              2:8.16.0-1.11                                   installed

Any help appreciated.

I’d submit a ticket on this one (as well as following here). This looks like a deep problem and I doubt anyone by maybe @danardf might be able to skull this one out.

Hi
Try to update your O.S

yum update -y

Next; try to launch

fwconsole chown
fwconsole ma downloadinstall pm2
fwconsolr r

Next why not to force

fwconsole ma update xmpp
fwconsole ma update zulu
fwconsole r

Just an idea like that.

Hi danardf.

Thank you for the input. Its still comming up with the same errors - please see below.


yum update -y

[root@pbx ~]# yum update -y
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
sng-base                                                 | 3.6 kB     00:00
sng-epel                                                 | 2.9 kB     00:00
sng-extras                                               | 2.9 kB     00:00
sng-pkgs                                                 | 3.4 kB     00:00
sng-updates                                              | 2.9 kB     00:00
No packages marked for update

fwconsole chown

Setting Permissions...
Setting base permissions...Done
Setting specific permissions...
 55647 [============================]
Finished setting permissions

fwconsole ma downloadinstall pm2

No repos specified, using: [standard,extended] from last GUI settings

Downloading module 'pm2'
Processing pm2
Verifying local module download...Verified
Extracting...Done
Download completed in 0 seconds
Installing/Updating Required Libraries. This may take a while...The following messages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a warning
Running installation..
npm ERR! asyncWrite is not a function
npm ERR! asyncWrite is not a function
npm ERR! pna.nextTick is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/asterisk/.npm/_logs/2020-11-12T18_20_05_779Z-debug.log

Finished updating libraries!

There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done
Chowning directories...Done

fwconsole r

Reload Started
Reload Complete

fwconsole ma update xmpp

No repos specified, using: [standard,extended] from last GUI settings

xmpp is the same as the online version, unable to upgrade
Updating Hooks...Done
Chowning directories...Done

fwconsole ma update zulu

No repos specified, using: [standard,extended] from last GUI settings

zulu is the same as the online version, unable to upgrade
Updating Hooks...Done
Chowning directories...Done

I have the same issue here, after trying to update. Now freepbx is not loading at all

This sounded familiar, so I went back and looked at the forum and this thread seems pertinent to the discussion.

there are no such option in advanced settings. may be due to unavailability of process management module

Same here, I can find any Process Management section or anything to do with NPM.

so no any other idea how to fix this issue?

Have you tried removing and reinstalling nodejs? You shouldn’t have 2 installed… Are you sure that they are both installed? Is this output from yum list installed | grep nodejs ? The list you posted almost looks like you only have one installed.

Also if you were looking for the “NPM Proxy Server Address” It is a hidden read only setting. To see it in advanced settings you have to set “display readonly settings” and “override readonly settings” to yes in advanced settings and apply config and maybe refresh the page and you should see it then.

so should I remove one of the nodejs? how to do it? because ‘yum remove’ is not working for nodejs because of dependencies

Are you sure there are 2 actually installed? Check with

yum list installed | grep nodejs

If so you should be able to remove them - it will want to remove the freepbx package as well but it is safe to do, then yum install nodejs freepbx and all your stuff should still be there. I honestly cant see yum allowing 2 of these packages to be installed at the same time though so I am really wondering if you actually have 2 installed or if you just did a ‘yum list nodejs’ which would show you all available versions.

yes, and not only this package is doubled:

https://gyazo.com/48380a57fe9d1de75e9ac1862eff9191

Hi scristopher71,

You’ll have to forgive me, I’m only a hobbyist with Linux in my spare time so like I said my be a red herring however please find out put below.

yum list installed | grep nodejs
nodejs.x86_64                          2:8.11.3-1.7               @sng-pkgs/7
nodejs.x86_64                          2:8.16.0-1.11              installed

Yeah so you should be able to remove it, can you pastebin what is going to be removed when doing a
yum remove nodejs

If there isnt a huge list you can paste it in here

 yum remove nodejs
Loaded plugins: fastestmirror, versionlock
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:8.11.3-1.7 will be erased
--> Processing Dependency: nodejs for package: freepbx-14.1-1.sng7.noarch
---> Package nodejs.x86_64 2:8.16.0-1.11 will be erased
--> Running transaction check
---> Package freepbx.noarch 0:14.1-1.sng7 will be erased
--> Processing Dependency: freepbx for package: sangoma-pbx-2008-1.sng7.noarch
--> Running transaction check
---> Package sangoma-pbx.noarch 0:2008-1.sng7 will be erased
--> Finished Dependency Resolution
Error: Trying to remove "sangoma-pbx", which is protected

yum remove nodejs
Loaded plugins: fastestmirror, versionlock
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or “yum-complete-transaction --cleanup-only” and “yum history redo last”, first to finish them. If those don’t work you’ll have to try removing/installing packages by hand (maybe package-cleanup can help).
→ Running transaction check
—> Package nodejs.x86_64 2:8.11.3-1.7 will be erased
→ Processing Dependency: nodejs for package: freepbx-14.1-1.sng7.x86_64
—> Package nodejs.x86_64 2:8.16.0-1.11 will be erased
→ Running transaction check
—> Package freepbx.x86_64 0:14.1-1.sng7 will be erased
→ Processing Dependency: freepbx for package: sangoma-pbx-2008-1.sng7.noarch
→ Running transaction check
—> Package sangoma-pbx.noarch 0:2008-1.sng7 will be erased
→ Finished Dependency Resolution
Error: Trying to remove “sangoma-pbx”, which is protected

Ok yeah you don’t want to do that actually unless you know what you are doing. It seems things have changed since 14 and on 15 removing freepbx/sangoma-pbx really screws up some things. I’ve tried 2 different ways to remove nodejs, the first way with yum and that broke the webui after reinstalling so you really don’t want to do that unless you know what you are doing, the second way with rpm I just used had no issues

for pkg in $(rpm -qa | grep nodejs); do rpm -e $pkg --nodeps; done
yum install nodejs
fwconsole ma upgradeall #just in case

*Note: this assumes that the command will only erase your nodejs rpm’s not anything else that might have the name nodejs, you may want to double check beforehand with rpm -qa | grep nodejs to double check, what you see from that output will be removed but this worked fine in my case.

That “should” leave you with only one nodejs installed. Also I’m not sure if you saw my comment about where the NPM Proxy Server Address is and how to access it but have you checked that as well?

Sorry scristopher - I had missed the pointer to the Process Management settings.

Use package caching for NPM was set to No so I’ve reset it to default Yes. All other settings were as the above post said.

I re-ran fwconsole ma install pm2 but it still error-ed.

So to try your new fix…

 rpm -qa | grep nodejs
nodejs-8.11.3-1.7.x86_64
nodejs-8.16.0-1.11.x86_64

Then ran:
for pkg in $(rpm -qa | grep nodejs); do rpm -e $pkg --nodeps; done No packages found after running this.

Re-installed nodejs which worked.[yum install nodejs]

Ran

fwconsole ma install pm2
Installing/Updating Required Libraries. This may take a while...The following messages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a warning
Running installation..
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

added 195 packages from 195 contributors and audited 196 packages in 17.437s
found 0 vulnerabilities


Finished updating libraries!
Generating CSS...Done
Module pm2 version 15.0.4 successfully installed
Updating Hooks...Done
Chowning directories...Done

The other modules are now updating!

Thank you scristopher!

2 Likes

Asterisk didnt want to start on the first reboot.

I ran fwconsole restart which seems to have managed to get asterisk up and running.

It seems that now asterisk is starting on reboot.