FreePBX 15.0.17.24 / Asterisk 16.15.1 / all modules up to date
As the subject line states, when I run Apply Config, the dialog says:
"Error! There was an error during reload: Unknown Error. Please Run: fwconsole reload --verbose
$ sudo fwconsole reload --verbose
Reload Started
In PJSip.class.php line 502:
[Exception]
Asterisk will crash if sip_server is blank!
Exception trace:
() at /var/www/html/admin/modules/core/functions.inc/drivers/PJSip.class.php:502
FreePBX\modules\Core\Drivers\PJSip->genConfig() at /var/www/html/admin/modules/core/Core.class.php:280
FreePBX\modules\Core->genConfig() at /var/www/html/admin/libraries/BMO/FileHooks.class.php:97
FreePBX\FileHooks->processNewHooks() at /var/www/html/admin/libraries/BMO/FileHooks.class.php:26
FreePBX\FileHooks->processFileHooks() at /var/www/html/admin/libraries/Console/Reload.class.php:335
FreePBX\Console\Command\Reload->reload() at /var/www/html/admin/libraries/Console/Reload.class.php:91
FreePBX\Console\Command\Reload->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:960
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:163
When I log in to FreePBX, whether via the console or ssh, the following warnings are shown:
Last login: Tue Mar 23 15:19:43 2021
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening â/etc/freepbx.confâ for inclusion (include_path=â.:/usr/share/pear:/usr/share/phpâ) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class âSymfony\Component\Console\Applicationâ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
±-----------------------------------------------------------+
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening â/etc/freepbx.confâ for inclusion (include_path=â.:/usr/share/pear:/usr/share/phpâ) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class âSymfony\Component\Console\Applicationâ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
+
If I run fwconsole chown:
$ sudo fwconsole chown --verbose
Taking too long? Customize the chown command, See Sangoma Documentation
Setting PermissionsâŠ
Setting base permissionsâŠDone in 5 seconds
Setting specific permissionsâŠ
Setting /home/asterisk to permissions of: 755
⊠[thousands of lines]
Setting /var/www/html/admin/modules/zulu/hooks user owner to: asterisk
Finished setting permissions
$
If I log out and then log back in, the same warnings appear.
$ ls -la /etc/freepbx.conf
-rw-rw----. 1 asterisk asterisk 337 Dec 25 19:02 /etc/freepbx.conf
$ sudo chmod 664 /etc/freepbx.conf
$ ls -la /etc/freepbx.conf
-rw-rw-râ. 1 asterisk asterisk 337 Dec 25 19:02 /etc/freepbx.conf
$ logout
Connection to 172.16.0.175 closed.
On the next login:
$ ssh -p XXXXXX [email protected]
Last login: Tue Mar 23 08:29:03 2021 from 172.16.0.XXX
UnexpectedValueException: The stream or file â/var/log/asterisk/freepbx.logâ could not be opened: failed to open stream: Permission denied in file /var/www/html/admin/libraries/Composer/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
Stack trace:
NOTICE! You have 1 notifications! Please log into the UI to see them!
Current Network Configuration
±----------±------------------±-------------------------+
| Interface | MAC Address | IP Addresses |
±----------±------------------±-------------------------+
| eth0 | 08:00:27:97:2F:36 | 172.16.0.175 |
| | | fe80::a00:27ff:fe97:2f36 |
±----------±------------------±-------------------------+
Please note most tasks should be handled through the GUI.
You can access the GUI by typing one of the above IPs in to your web browser.
For support please visit: Training & Support | FreePBX - Let Freedom Ring
You say ârun as root.â Iâve been a UNIX system admin for (too) many years, and as a matter of policy Iâve learned to try to avoid running things as root unless absolutely necessary. If you check the commands that were run above, everything was run as sudo.
Can you explain why you recommend running these commands as root instead of sudo, and why running on CentOS would be any different than on other UNIX or Linux systems?
Absolutely no changes were made to the OS, nor were any permissions changed by me (and Iâm the only one authorized to use this computer). However I see when I logged in again today, the problem re-surfaced:
$ ssh -p XXXX [email protected]
Last login: Wed Mar 24 12:41:35 2021 from 172.16.0.146
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening â/etc/freepbx.confâ for inclusion (include_path=â.:/usr/share/pear:/usr/share/phpâ) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class âSymfony\Component\Console\Applicationâ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
±-----------------------------------------------------------+
PHP Warning: include_once(/etc/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 12
PHP Warning: include_once(): Failed opening â/etc/freepbx.confâ for inclusion (include_path=â.:/usr/share/pear:/usr/share/phpâ) in /var/lib/asterisk/bin/fwconsole on line 12
PHP Fatal error: Class âSymfony\Component\Console\Applicationâ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11
±-----------------------------------------------------------+
$
fwconsole has to be run as root. If you donât it wonât work. Fearing root is a very debian thing to do. Iâve been in and out of systems for 20 years as root and almost nobody has died. Seriously though it is just how it works.
If you insist on using sudo, do sudo -i to get the same environment as root, the relevant sudoer has effectively logged in as a root login without knowing rootâs password, without an argument, sudo -i starts a root login $SHELL (from rootâs environment).
@jerrm I donât want to start a flame war here, but I can tell you where the âsudo dogmaâ originates, at least from my point of view. Itâs in response to the âcowboy rootâ dogma, where someone less qualified than they think (sometimes âthe bossâ) demands the root password and proceeds to log in every single time as root. (Cue rolling eyes and groans from the rest of the technical staff.) Iâve seen this happen a few times, and is one reason all UNIX-like systems Iâve worked on, Solaris, HP-UX, Linux, FreeBSD, SCO UNIX, macOS, and dozens more, are designed to limit the use of root with the sudo command, or even better, prevent someone from logging in directly as the root user.
I have no problem if someone with proper skills wants to log in or "su - " as root. But log in, do your work, and donât forget to log out.