UCP Failed updating libraries!


(Hardsoda) #1

Hi,
I have issue after freepbx modules updates. After update not starting UCP NODE daemon. I try to install it from CLI and got a many errors:

# fwconsole ma install ucp
Updating tables ucp_sessions...Done
System : sangoma
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..

> mariasql@0.2.6 install /var/www/html/admin/modules/ucp/node/node_modules/mariasql
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: tunneling socket could not be established, statusCode=403
gyp ERR! stack     at ClientRequest.onConnect (/usr/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:166:19)
gyp ERR! stack     at Object.onceWrapper (events.js:319:30)
gyp ERR! stack     at emitThree (events.js:136:13)
gyp ERR! stack     at ClientRequest.emit (events.js:217:7)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:474:11)
gyp ERR! stack     at emitOne (events.js:116:13)
gyp ERR! stack     at Socket.emit (events.js:211:7)
gyp ERR! stack     at addChunk (_stream_readable.js:263:12)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:250:11)
gyp ERR! stack     at Socket.Readable.push (_stream_readable.js:208:10)
gyp ERR! System Linux 3.10.0-957.21.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/admin/modules/ucp/node/node_modules/mariasql
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mariasql@0.2.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mariasql@0.2.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


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

Failed updating libraries!
Stopping old running processes...Done
Refreshing all UCP Assets, this could take a while...
Generating Module Scripts...Done
Generating Module CSS...Done
Generating Main Scripts...Done
Generating Main CSS...Done
Done!
Generating CSS...Done
Module ucp version 15.0.6.14 successfully installed
Updating Hooks...Done
Chowning directories...Done

FreePBX version: FreePBX 15.0.16.49


(Sergio Lobera) #2

Hi !
What do you see when running this command?

fwconsole pm2 --list

Try this: fwconsole start ucpnode

Also, on the GUI go to Admin > Advanced Settings > Search for NodeJS Server and be sure that is enabled there.


(Hardsoda) #3

I see this modules:
# fwconsole pm2 --list
±-------------±-----±-------±---------±-----------------------±----±--------+
| Process Name | PID | Status | Restarts | Uptime | CPU | Mem |
±-------------±-----±-------±---------±-----------------------±----±--------+
| core-fastagi | 1711 | online | 0 | 16 minutes, 48 seconds | 0% | 22.37MB |
| xmpp | 2512 | online | 0 | 16 minutes, 41 seconds | 0% | 82.22MB |
| restapps | 7261 | online | 0 | 20 seconds | 0% | 40.19MB |
±-------------±-----±-------±---------±-----------------------±----±--------+

And when I try to run ucpnode:
# fwconsole start ucpnode
Running FreePBX startup…
Taking too long? Customize the chown command, See …
Setting Permissions…
Setting base permissions…Done
Setting specific permissions…
36401 [============================]
Finished setting permissions
Unable to run Pre-Asterisk hooks, because Asterisk is already running on PID 1491 and has been running for 17 minutes, 29 seconds


(Sergio Lobera) #4

Did you take a look at Advanced Settings if NodeJS Server is enabled ?


(Hardsoda) #5

Yes, it was enabled by default:


(Sergio Lobera) #6

Try this: fwconsole start ucp
And after that see if it’s running with fwconsole pm2 --list | grep ucp


(Hardsoda) #7
# fwconsole start ucp
Running FreePBX startup...
Taking too long? Customize the chown command, See 
Setting Permissions...
Setting base permissions...Done
Setting specific permissions...
 36433 [============================]
Finished setting permissions
Unable to run Pre-Asterisk hooks, because Asterisk is already running on PID 1491 and has been running for 42 minutes, 43 seconds
Running Asterisk post from Ucp module
Starting UCP Node Server...
[>---------------------------] < 1 sec
Started UCP Node Server. PID is 13044

# fwconsole pm2 --list | grep ucp
| ucp          | 0     | errored | 15       | 0                      | 0%  | 0.00B   |

It is in errored state. :confused:


(Sergio Lobera) #8

That’s weird, just to be sure, all system packages updated? what about modules?

yum update && fwconsole ma upgradeall

fwconsole ma downloadinstall ucp --force

And then again fwconsole pm2 --list | grep ucp


(Hardsoda) #9

OS and Modules updates are installed latest. When I trying to install ucp, I’m getting this npm errors related to mariasql lib:

# fwconsole ma downloadinstall ucp --force
No repos specified, using: [standard] from last GUI settings

Downloading module 'ucp'
Processing ucp
Downloading...
 4267705/4267705 [============================] 100%
Finished downloading
Extracting...Done
Download completed in 5 seconds
Updating tables ucp_sessions...Done
System : sangoma
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 WARN deprecated node-uuid@1.4.7: Use uuid module instead
npm WARN deprecated node-xmpp-client@3.1.2: this package is deprecated please use https://www.npmjs.com/package/@xmpp/client
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-xmpp-core@5.0.9: this package is deprecated please use https://github.com/xmppjs/xmpp.js
npm WARN deprecated node-xmpp-tls-connect@1.0.1: this package is deprecated please use https://github.com/xmppjs/xmpp.js
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-udryrcRbGabMX9LwSPjZQGzs5Jg= integrity checksum failed when using sha1: wanted sha1-udryrcRbGabMX9LwSPjZQGzs5Jg= but got sha512-wZK/v5ZaNaSUs2Wnwh2YSX/Jqv6bQHKNEwojdzV11tByKziR9ikOssf5tvUhx+8/oCBz6AakOFAjZuqPoiRHJQ==. (3717 bytes)
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.

> mariasql@0.2.6 install /var/www/html/admin/modules/ucp/node/node_modules/mariasql
> node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: tunneling socket could not be established, statusCode=403
gyp ERR! stack     at ClientRequest.onConnect (/usr/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:166:19)
gyp ERR! stack     at Object.onceWrapper (events.js:319:30)
gyp ERR! stack     at emitThree (events.js:136:13)
gyp ERR! stack     at ClientRequest.emit (events.js:217:7)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:474:11)
gyp ERR! stack     at emitOne (events.js:116:13)
gyp ERR! stack     at Socket.emit (events.js:211:7)
gyp ERR! stack     at addChunk (_stream_readable.js:263:12)
gyp ERR! stack     at readableAddChunk (_stream_readable.js:250:11)
gyp ERR! stack     at Socket.Readable.push (_stream_readable.js:208:10)
gyp ERR! System Linux 3.10.0-957.21.3.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/admin/modules/ucp/node/node_modules/mariasql
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN ws@7.3.0 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.3.0 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mariasql@0.2.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mariasql@0.2.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

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

Failed updating libraries!
Stopping old running processes...Done
Refreshing all UCP Assets, this could take a while...
Generating Module Scripts...Done
Generating Module CSS...Done
Generating Main Scripts...Done
Generating Main CSS...Done
Done!
Generating CSS...Done
Module ucp version 15.0.6.14 successfully installed
Updating Hooks...Done
Chowning directories...Done

In ucp_error log I see this errors:
2020-05-13 15:53 +03:00: Error: Cannot find module ‘mariasql’
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/var/www/html/admin/modules/ucp/node/lib/freepbx.js:11:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions…js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)


(Hardsoda) #10

I found issue! My proxy server not allowed connection to nodejs repos. After allowing connections to nodejs.org it installed witout errors and now UCP is running:

# fwconsole pm2 --list | grep ucp
| ucp          | 15410 | online | 0        | 12 seconds             | 0%  | 35.47MB  |

Kudos @ slobera for help :slight_smile:


(Sergio Lobera) #11

Nice @hardsoda good catch!

Take care!