Fwconsole reload - Error

Hi !

I’m running Freepbx 15.0.20 on Rapberry Pi 4. Asterisk is 16.21.1

I have just updated some modules and got now an error applying changes.

fwconsole reload →

In Cron.class.php line 281:
proc_open(/tmp/cron.error): failed to open stream: Permission denied

Already tested
rm -f cron.error
fwconsole chown
fwconsole reload

Still get the error.

Any help !!!

Well, first question. You did verify the actual owner/group on the /tmp directory and confirmed this cron.error is created with the right permissions?

[email protected]:~# ls -l /tmp/
total 20
drwxr-xr-x 2 asterisk asterisk 4096 Jan 30 22:00 backup
-rwxrwxrwx 1 root root 0 Feb 4 14:59 cron.error
-rw-r–r-- 1 root root 3 Jun 7 2020 raspbx_cur_version
-rw-rw-r-- 1 asterisk asterisk 0 Dec 18 14:03 swap4jd5Bs

Got alos in the GUI 1 module need update : PM2.
When I dothe update, got an error too

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

One one think that something owned by root can’t be opened by a standard user like asterisk.

I also asked what the owner/permissions of /tmp was.

drwxrwxrwt 11 root root 4096 Feb 4 15:06 tmp

fwconsole reload
Reload Started

In Self_Helper.class.php line 212:

Unable to locate the FreePBX BMO Class 'Pm2’A required module might be disabled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole ma install pm2 2) fwconsole ma enable pm2

reload [–json] [–dry-run] [–skip-registry-checks] [–dont-reload-asterisk]

[email protected]:~# 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 ERR! Linux 5.10.63-v7l+
npm ERR! argv “/usr/bin/node” “/usr/bin/npm” “install” “–only=production”
npm ERR! node v12.22.5
npm ERR! npm v3.10.10

npm ERR! cb.apply is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/admin/modules/pm2/node/npm-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
    [email protected]:~# nano /var/www/html/admin/modules/pm2/node/logs/install.log
    [email protected]:~# fwconsole ma enable pm2
    The following error(s) occured:
  • Module pm2 cannot be enabled
    [email protected]:~#

Well that is a completely different issue. So what does the log files that it says has the details say?

As for the /tmp stuff you have something not setup right because I see this on my systems:

-rwxrwxrwx 1 asterisk asterisk 0 Jul 10 2016 cron.error

Show the output of ps -ef | grep asterisk

ps -ef | grep asterisk
asterisk 1507 1 0 2021 ? 01:09:00 PM2 v4.5.0: God Daemon (/home/asterisk/.pm2)
root 2360 13910 0 16:21 pts/1 00:00:00 grep asterisk
asterisk 5017 1449 0 00:00 ? 00:00:02 /usr/sbin/apache2 -k start
asterisk 5018 1449 0 00:00 ? 00:00:07 /usr/sbin/apache2 -k start
asterisk 5019 1449 0 00:00 ? 00:00:01 /usr/sbin/apache2 -k start
asterisk 5020 1449 0 00:00 ? 00:00:11 /usr/sbin/apache2 -k start
asterisk 5021 1449 0 00:00 ? 00:00:02 /usr/sbin/apache2 -k start
asterisk 8328 1507 0 2021 ? 07:53:42 node /var/www/html/admin/modules/core/node/fastagi-server.js
asterisk 12555 5018 0 14:11 ? 00:00:00 [sh]
root 15469 1 0 14:45 pts/1 00:00:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 15471 15469 1 14:45 pts/1 00:01:12 /usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c
asterisk 23478 1449 0 12:00 ? 00:01:47 /usr/sbin/apache2 -k start
asterisk 23484 1449 0 12:00 ? 00:00:01 /usr/sbin/apache2 -k start
asterisk 23485 1449 0 12:00 ? 00:00:01 /usr/sbin/apache2 -k start
asterisk 23486 1449 0 12:00 ? 00:00:01 /usr/sbin/apache2 -k start
asterisk 23487 1449 0 12:00 ? 00:00:01 /usr/sbin/apache2 -k start
asterisk 28861 1 0 Jan13 ? 00:00:21 dirmngr --daemon --homedir /home/asterisk/.gnupg

npm ERR! Linux 5.10.63-v7l+
npm ERR! argv “/usr/bin/node” “/usr/bin/npm” “install” “–only=production”
npm ERR! node v12.22.5
npm ERR! npm v3.10.10

npm ERR! cb.apply is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/admin/modules/pm2/node/npm-debug.log

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

±-----------------±-----------±------------------------------------±--------+
| Module | Version | Status | License |
±-----------------±-----------±------------------------------------±--------+
| announcement | 15.0.3.13 | Enabled | GPLv3+ |
| arimanager | 15.0.3.13 | Enabled | GPLv3+ |
| asteriskinfo | 15.0.14 | Enabled | GPLv3+ |
| backup | 15.0.10.68 | Enabled | GPLv3+ |
| blacklist | 15.0.2.17 | Enabled | GPLv3+ |
| builtin | | Enabled | |
| calendar | 15.0.4.21 | Enabled | GPLv3+ |
| callrecording | 15.0.7.24 | Enabled | AGPLv3+ |
| cdr | 15.0.17.15 | Enabled | GPLv3+ |
| cel | 15.0.15.15 | Enabled | GPLv3+ |
| conferences | 15.0.7.11 | Enabled | GPLv3+ |
| contactmanager | 15.0.8.52 | Enabled | GPLv3+ |
| core | 15.0.12.98 | Enabled | GPLv3+ |
| customappsreg | 15.0.14 | Enabled | GPLv3+ |
| dashboard | 15.0.12 | Enabled | AGPLv3+ |
| featurecodeadmin | 13.0.6.11 | Enabled | GPLv3+ |
| filestore | 15.0.3.27 | Enabled | AGPLv3 |
| framework | 15.0.21 | Enabled | GPLv2+ |
| iaxsettings | 15.0.8 | Enabled | AGPLv3 |
| infoservices | 15.0.3 | Enabled | GPLv2+ |
| ivr | 15.0.29 | Enabled | GPLv3+ |
| logfiles | 15.0.15 | Enabled | GPLv3+ |
| manager | 15.0.15 | Enabled | GPLv2+ |
| music | 15.0.22 | Enabled | GPLv3+ |
| phonebook | 15.0.12 | Disabled | GPLv3+ |
| pm2 | 15.0.7 | Disabled; Pending upgrade to 15.0.8 | AGPLv3+ |
| queues | 15.0.34 | Enabled | GPLv2+ |
| recordings | 15.0.3.16 | Enabled | GPLv3+ |
| ringgroups | 15.0.11.15 | Enabled | GPLv3+ |
| sipsettings | 15.0.6.39 | Enabled | AGPLv3+ |
| soundlang | 15.0.5.10 | Enabled | GPLv3+ |
| timeconditions | 15.0.15.11 | Enabled | GPLv3+ |
| userman | 15.0.68 | Enabled | AGPLv3+ |
| voicemail | 15.0.18.49 | Enabled | GPLv3+ |
±-----------------±-----------±------------------------------------±--------+

Hi
Try to do that:
# fwconsole ma downloadinstall pm2
or
# fwconsole ma downloadinstall pm2 --edge “for any modules on the EDGE repos (non stable)”

Salut.
Essayes de forcer le téléchargement puis l’installation de PM2.
En fait, le module est téléchargé mais n’est pas activé, car il y a une version téléchargé en attente de mise à jour… :wink:

Hi !

Already tested, but no luck.
I also tried to uninstall then reinstall but it wont !

I also tested few other ways like

or
https://help.heroku.com/ZV7S7D6T/why-is-my-node-build-is-suddenly-displaying-npm-err-cb-apply-is-not-a-function
with no more luck.

Finally, I did a full restoration from IMG file (4 days old) and restored settings from FTP backup (1 day old) via module save/restore.
During restoration, I saw in log files the same error message concerning pm2 but it works and there is no error till now.
Auto-update tell me now there are new updates available including pm2 but I’m afraid of a new disaster.

I also can say that backup/restore module seem to have some missing backups because after restoring some settings were wrong (PJSIP module) concerning codecs.

I will look at an external SSD (already bought) to install my system and forget SD cards.

That I know, your systems must be up to date for both before to backup and restore something.
About PM2, check if there is something weird about the dependencies which can break any update / install for PM2.

Check the NodeJS version
It should be : v8.16.0

How do you check the version ?

Concerning backup/restore, if I can compare to pfsense, it is better on pfsense because it do not take care of version - You can restore any backuped version on any running version, even with a huge difference in version, it always work !

node -v

node -v
v12.22.5

Try to downgrade the version please and check again.

Ho ! Downgrade ?
Why does I got a too recent version ? Where it comes from ?
I only do updates from Freepbx and raspbx-update command line…

How do i downgrade ?

You’ll have to ask that on the RasPBX forums