FreePBX Cron Errors

NethServer Version: 7.9 (7.8 also)
Module: FreePBX

Dear Community,

since i have installed nethserver-freepbx i have many errors reports from (asterisk) cron like:

"UnexpectedValueException: The stream or file “/var/log/asterisk/freepbx.log” could not be opened: failed to open stream: Keine Berechtigung in file /var/www/html/freepbx/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
Stack trace:

  1. UnexpectedValueException->() /var/www/html/freepbx/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
  2. Monolog\Handler\StreamHandler->write() /var/www/html/freepbx/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php:39
  3. Monolog\Handler\AbstractProcessingHandler->handle() /var/www/html/freepbx/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Logger.php:344
  4. Monolog\Logger->addRecord() /var/www/html/freepbx/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Logger.php:637
  5. Monolog\Logger->info() /var/www/html/freepbx/admin/libraries/BMO/Logger.class.php:146
  6. FreePBX\Logger->driverChannelLogWrite() /var/www/html/freepbx/admin/libraries/BMO/Logger.class.php:97
  7. FreePBX\Logger->channelLogWrite() /var/www/html/freepbx/admin/libraries/BMO/Logger.class.php:85
  8. FreePBX\Logger->logWrite() /var/www/html/freepbx/admin/libraries/BMO/Logger.class.php:39
  9. FreePBX\Logger->log() /var/lib/asterisk/bin/fwconsole:137"

I have looked in the asterisk crontab to see the crontimes and the full command line and i have noted some tasks which uses the “/usr/sbin/fwconsole” command.

As i know, in Nethserver the fwconsole command only works with the “/usr/bin/scl enable rh-php56” in front of the “/usr/sbin/fwconsole” command. But in the asterisk crontasks this “initiation” is not here. (and i am sure the crontab entries are “original” from nethserver-freepx installation)

Is this the cause for the Cron Errors?

What is the best (Nethserver-)way to correct this?
Adding the “/usr/bin/scl enable rh-php56” initiation in every relevant crontask lines?
Or is there a better way like setting an enviroment variable or something?

Thank you for helping,
regards

yummiweb

What is interesting here is that it seems you are the only one and that there maybe an issue PRIOR to installing FreePBX e.g. php scl?

Keine Berechtigung translates to “no permissions” …

Permission issue?

OK, here are more Informations for both questions:

This Nethserver installation is 7.9 and exist since version 7.6.
Last year (i think) i tried out freepbx in Nethserver 7.7 (nethserver-freepbx), the installation itself was fine with cockpit but while installing and/or updating some modules in freepx admin panel the freepbx installation was damaged.
So i endet this experiment with nethserver-freepbx and tried a separate freepbx installation on a external vm.

Early this year i decide to use freepbx real (not for testing only) but in a standalone installation there was some problems with connecting to an Nethserver AD (not possible withoud insecure Nethserver AD) or simple sending E-Mails. So i decide to try nethserver-freepbx a second time. Because the first installation was wrong i must deinstall first. After deinstalling nethserver-freepbx the reinstalling was not possible, there was some errors in installation process. So i removed also some asterisk components (folders and configs also) as i reading in some posts here. After that, the “new” nethserver-freepbx installation was fine and i progressed with my tests. This “Testmaschine” is the installation with the described problem.

Additionally i have installed nethserver-freepbx on a second Nethserver Installation (7.8) for production use without the described problem.

With this second installation (the first is for testing, the second for production) a have the possiblity to compare some things like versions, configs, File/Folder permissions and so on. So i can say, that the permissions seems to be the same on both installations. Both installations have Nethserver 7.9 now and the actual nethserver-freepbx. Maybe there a more freepbx-modules on the testing vm.

I not a FreePBX user myself so can not help you a lot.
Was just triggered by:

And reading your summary of events still triggered by it, it happens more often files stay behind after a de-installation. These files keep the UID and GID numbers of the first install which are not necessarily the UID/GID assigned to the (system) user for a specific application / service created by a re-install.

In this case, again have no knowledge of FreePBX and hope other can chip in, I would check the permissions of freepbx.log and the read/write permissions of the asterisk directory it lives in.

2 Likes

Did you already try this to fix the permissions?

Thanks, this was a nice idea. But the user and groups id of astersisk related files seems to be the same as in /etc/passwd and /etc/groups.

As i know, in Posix Filesystems the UID and GID are raw numbers and the /etc/passwd and/or /etc/groups “lists” assigns the “human readable” names as displayed in CLI.

I think if there is a other (newer) assigning /etc/passwd /etc/groups the assigned names will simple displayed at file listing.
But i dont know what happend if a ID is no (more) assigned to an username or groupname. The ID? Or “undefined”/ “unknown”?

Thank you, i think you have meant the “scl enable rh-php56 – fwconsole chown” command to fix the persmissions? I have done this now and will wait for the next related cron run.
(i think the weekly cron task sends a mail summary with related errors from more frequent tasks)

Regards
yummiweb

Yes, exactly.
I hope it helps.

Hmm, is there a way to edit the command correct in this post?
The “double line” - - in the command will always translated (or displayed) as a “long line” here.

You may put it between two ` instead of " and it will be displayed like this:

scl enable rh-php56 -- fwconsole chown

or use the menu or indent by 4 spaces to get preformatted text:

indent preformatted text by 4 spaces

grafik