Web UI, fwconsole and many things got broken after 15 to 16 upgrade, can it be fixed?

Hello! I had a raspberry pi with freepbx 15 installed and decided to do upgrade because I needed to install some drivers for my non-chan dongle which might work not good on 15th version. I can’t now exactly explain how I eventually upgraded, because I faced many issues, like installing php 7.4, when the system after its installation thinks that you still have only php 7.0, like impossibility to install proper linux-headers (eventually I installed them from .deb from raspberry archive), need to downgrade libssl to 1.1.1d, etc. It’s upgraded with errors from web ui. Then I repeated the same using fwconsole. And also repeated following this guide, starting from Compile and install Asterisk:
https://wiki.freepbx.org/display/FOP/Installing+FreePBX+16+on+Debian+10.9
During the process, by some moment web ui had worked, I even noticed that it’s version seems to be upgraded (different style of icons, buttons, etc). But after full upgrade, http:/raspbx(or its ip) webpage doesn’t load and logs showed that apache2 faced 500 internal server error. Also I had some problems with fwconsole and returned it to work by restarting some services like mysql and apache2 (I will write the exact commands below).
So, now when the device is rebooted, there is no connection to the http://raspbx (at all, no apache2 service is running). Fwconsole also is down, running it causes following exceptions:

root@raspbx:/home/asterisk# fwconsole ma list
Exception: SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/utility.functions.php on line 120

Caused by
PDOException: SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/BMO/Database.class.php on line 144
Stack trace:
  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:120
  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:149
  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:144
  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:144
  5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:71
  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:144
  7. require_once() /etc/freepbx.conf:10
  8. include_once() /var/lib/asterisk/bin/fwconsole:12

But, restarting some services as I mentioned before:

systemctl stop freepbx.service
systemctl stop apache2.service
systemctl stop mysql.service
systemctl start mysql.service
systemctl start apache2.service
fwconsole start
systemctl start freepbx.service

seems fixing fwconsole:

root@raspbx:/home/asterisk# systemctl stop freepbx.service
root@raspbx:/home/asterisk# systemctl stop apache2.service
root@raspbx:/home/asterisk# systemctl stop mysql.service
root@raspbx:~# systemctl start mysql.service
root@raspbx:~# systemctl start apache2.service
root@raspbx:~# fwconsole start
Running FreePBX startup...
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions...
Setting base permissions...Done in 10 seconds
Setting specific permissions...
 18190 [============================]
Finished setting permissions
Starting Asterisk...
[============================] 4 secs
Asterisk Started
Running Asterisk post from Core module
Starting Core FastAGI Server...
[>---------------------------] 2 secs
Started Core FastAGI Server. PID is 23329
Running Asterisk post from Ucp module
Starting UCP Node Server...
[>---------------------------] 3 secs
Started UCP Node Server. PID is 23476
root@raspbx:~# systemctl start freepbx.service

Here are the modules installed in the system:

root@raspbx:~# fwconsole ma list
No repos specified, using: [standard] from last GUI settings

+------------------+------------+-----------------------------------+------------+
| Module           | Version    | Status                            | License    |
+------------------+------------+-----------------------------------+------------+
| amd              | 16.0.1     | Enabled                           | GPLv3+     |
| announcement     | 16.0.4     | Enabled                           | GPLv3+     |
| api              | 16.0.4.8   | Enabled                           | AGPLv3+    |
| arimanager       | 16.0.5     | Enabled                           | GPLv3+     |
| asteriskinfo     | 16.0.5     | Enabled                           | GPLv3+     |
| backup           | 16.0.50.8  | Enabled                           | GPLv3+     |
| blacklist        | 16.0.5     | Enabled                           | GPLv3+     |
| builtin          |            | Enabled                           |            |
| bulkhandler      | 16.0.5     | Enabled                           | GPLv3+     |
| calendar         | 16.0.6     | Enabled                           | GPLv3+     |
| callforward      | 16.0.5     | Enabled                           | AGPLv3+    |
| callrecording    | 16.0.9     | Enabled                           | AGPLv3+    |
| callwaiting      | 16.0.5     | Enabled                           | GPLv3+     |
| cdr              | 16.0.14    | Enabled                           | GPLv3+     |
| cel              | 16.0.5     | Enabled                           | GPLv3+     |
| certman          | 16.0.19    | Enabled                           | AGPLv3+    |
| cidlookup        | 16.0.5     | Enabled                           | GPLv3+     |
| conferences      | 16.0.6     | Enabled                           | GPLv3+     |
| contactmanager   | 16.0.16    | Enabled                           | GPLv3+     |
| core             | 16.0.56.20 | Enabled                           | GPLv3+     |
| customappsreg    | 16.0.3     | Enabled                           | GPLv3+     |
| cxpanel          | 16.0.2     | Enabled                           | GPLv3      |
| dashboard        | 16.0.8     | Enabled                           | AGPLv3+    |
| daynight         | 16.0.1     | Enabled                           | GPLv3+     |
| directory        | 16.0.1     | Enabled                           | GPLv3+     |
| donotdisturb     | 16.0.3     | Enabled                           | GPLv3+     |
| fax              | 16.0.4     | Enabled                           | GPLv3+     |
| featurecodeadmin | 16.0.1     | Enabled                           | GPLv3+     |
| filestore        | 16.0.10.7  | Enabled                           | AGPLv3     |
| findmefollow     | 16.0.10    | Enabled                           | GPLv3+     |
| framework        | 16.0.10.43 | Enabled                           | GPLv2+     |
| hotelwakeup      | 16.0.1     | Enabled                           | GPLv2      |
| iaxsettings      | 16.0.1     | Enabled                           | AGPLv3     |
| infoservices     | 16.0.2     | Enabled                           | GPLv2+     |
| ivr              | 16.0.3     | Enabled                           | GPLv3+     |
| logfiles         | 16.0.2     | Enabled                           | GPLv3+     |
| manager          | 16.0.9     | Enabled                           | GPLv2+     |
| music            | 16.0.1     | Enabled                           | GPLv3+     |
| outroutemsg      | 16.0.1     | Enabled                           | GPLv3+     |
| paging           | 16.0.8     | Enabled                           | GPLv3+     |
| parking          | 16.0.2     | Enabled                           | GPLv3+     |
| pinsets          | 16.0.6     | Enabled                           | GPLv3+     |
| pm2              | 16.0.5     | Enabled                           | AGPLv3+    |
| presencestate    | 16.0.1     | Enabled                           | GPLv3+     |
| printextensions  | 16.0.1     | Enabled                           | GPLv3+     |
| queues           | 16.0.14    | Enabled                           | GPLv2+     |
| recordings       | 16.0.5     | Enabled                           | GPLv3+     |
| restapi          | 13.0.21.2  | Enabled                           | AGPLv3     |
| ringgroups       | 16.0.7     | Enabled                           | GPLv3+     |
| setcid           | 16.0.3     | Enabled                           | GPLv3+     |
| sipsettings      | 16.0.16    | Enabled                           | AGPLv3+    |
| sms              | 16.0.4     | Disabled                          | Commercial |
| soundlang        | 16.0.6     | Enabled                           | GPLv3+     |
| timeconditions   | 16.0.8     | Enabled                           | GPLv3+     |
| ttsengines       | 16.0.3     | Enabled                           | AGPLv3     |
| ucp              | 16.0.16    | Enabled                           | AGPLv3+    |
| userman          | 16.0.25.18 | Enabled                           | AGPLv3+    |
| vmblast          | 16.0.4     | Enabled                           | GPLv3+     |
| voicemail        | 16.0.29    | Enabled                           | GPLv3+     |
| weakpasswords    | 16.0.1     | Enabled                           | GPLv3+     |
| webrtc           | 16.0.10    | Enabled                           | GPLv3+     |
| xmpp             |            | Not Installed (Locally available) | AGPLv3     |
+------------------+------------+-----------------------------------+------------+

Now, if I type http://raspbx in a browser, it will show nothing, blank page. When http://raspbx/admin/config.php# is typed, some php code is shown with this suspicious place in the middle:

 //FREEI-918 - if the uploaded file's size exceeds php's post_max_size, PHP drops //the _POST and _FILES values and continues with the request. There is no error value //to properly know what happened. Meeting this set of conditions is enough evidence //to assume module upload from Module Admin failed due to the file being too large. //The page_content is being overwritten to display an error and option to try again, //instead of going back to the admin dashboard/index if ((preg_match('/config.php\?display=modules&action=upload/', $_SERVER['HTTP_REFERER']) || preg_match('/config.php\?display=updates&action=upload/', $_SERVER['HTTP_REFERER'])) && empty($_FILES) && empty($_POST) && $_REQUEST['display'] === 'index' && $_SERVER['CONTENT_LENGTH'] > 0) { $postMaxSize = ini_get('post_max_size'); $page_content = '

' . _("There was an error uploading the module tar ball due to its size being greater than post_max_size {") . $postMaxSize . '}.
'. _("Please host the file and use the \"Download (From Web) option\", or ssh to your FreePBX system and use \"fwconsole ma downloadinstall [url]\" to install the module from a URL.") . "
" . _("For further help, please contact") . " " . _("Sangoma Support") . "." . '
'; }

Logs of apache2 show:

[Sat Dec 11 00:34:19.503381 2021] [mpm_prefork:notice] [pid 4085] AH00163: Apache/2.4.38 (Raspbian) configured -- resuming normal operations
[Sat Dec 11 00:34:19.503564 2021] [core:notice] [pid 4085] AH00094: Command line: '/usr/sbin/apache2'
***
[Sat Dec 11 01:27:00.540457 2021] [authz_core:error] [pid 4090] [client 10.6.0.2:44714] AH01630: client denied by server configuration: /var/www/html/admin/index.cgi
[Sat Dec 11 01:27:00.540559 2021] [authz_core:error] [pid 4090] [client 10.6.0.2:44714] AH01630: client denied by server configuration: /var/www/html/admin/index.pl
[Sat Dec 11 01:27:00.728057 2021] [:error] [pid 4090] [client 10.6.0.2:44714] PHP Parse error:  syntax error, unexpected '?', expecting variable (T_VARIABLE) in /var/www/html/admin/libraries/Composer/vendor/symfony/string/Resources/functions.php on line 14
***
[Sat Dec 11 03:04:13.877534 2021] [mpm_prefork:notice] [pid 1137] AH00169: caught SIGTERM, shutting down
[Sat Dec 11 03:38:39.872863 2021] [mpm_prefork:notice] [pid 3159] AH00163: Apache/2.4.38 (Raspbian) configured -- resuming normal operations
[Sat Dec 11 03:38:39.876054 2021] [core:notice] [pid 3159] AH00094: Command line: '/usr/sbin/apache2'
[Sat Dec 11 03:40:11.781334 2021] [mpm_prefork:notice] [pid 3159] AH00169: caught SIGTERM, shutting down
[Sat Dec 11 20:34:21.347563 2021] [mpm_prefork:notice] [pid 22950] AH00163: Apache/2.4.38 (Raspbian) configured -- resuming normal operations
[Sat Dec 11 20:34:21.351007 2021] [core:notice] [pid 22950] AH00094: Command line: '/usr/sbin/apache2'

Errors were yesterday. They gone after I seems following the mentioned 16 version installation guide deleted completely web server’s directory:

rm -rf /var/www/html

So, what does community think about all of that? Is it possible to fix the web ui? If not, do you think it’s possible to do the trunk, extension, outbound and inbound routes using command line only? I have my access to the device only over ssh/vpn, can’t re-flash it or ask someone to do it for me(

It’s been a while since I played with RasPBX, but no one has answered this, so I’ll take a crack at it anyhow.

Try
fwconsole chown
if no luck:

Can Apache serve a trivial file? At a root shell prompt, try typing
echo hello world >/var/www/html/admin/foo.txt
then in your browser, access
http://raspbx/admin/foo.txt
which should of course display ‘hello world’.
If not, the apache2 logs should point to to the trouble.
If yes, confirm that php 7.4 is installed and running correctly, and that a trivial php file works as expected.

Also, tell us about the big picture, in case you need to start over. What is “my non-chan dongle”? If this is a trunking device requiring a special Asterisk module, consider upgrading Asterisk and/or related system modules, keeping your existing FreePBX 15. If it is an internet access device or one not directly related to FreePBX (home automation, etc.), consider updating only the required system modules, keeping the same FreePBX and Asterisk versions as your production system used.

Please explain the constraints in more detail. If you need to make your PBX run before you can regain physical access, perhaps you can set up a temporary cloud PBX, or call forwarding at your providers, until you get back.

Thank you for your reply. I’ve run

echo hello world >/var/www/html/admin/foo.txt

and after that http://raspbx/admin/foo.txt returns webpage with “hello world” written on it. So, apache2 seems to be working.
But how could I check that php 7.4 works with no issues? Maybe there is some test script for that which I could download somewhere? I’m not sure if fwconsole uses php, but it looks that after resetting services mentioned in the first my post, it works, I even was able to read a text from sms received by the device. So, maybe something could make clear if we understand why fwconsole is broken after reboot.
Concerning big picture, I’ve left my device in another country to have access to my phone number for some time. The device is hosted in my friends’ house. Yes, I know that it was simpler to transfer my number to an operator supporting international roaming, but the idea of the device is captured my mind so much that I didn’t think about another option.
And yes, it’s not chan dongle attached to my raspberry pi, it simcom 7600h-g hat. I thought that I just need some device with sim tray and it should work anyways after doing some setup. When I connected to the asterisk, I was surprised that this hat is not voice capable. But fortunately, not so long ago some guy has written the driver for this “dongle” model and asterisk:
Configuring 4G Module - githubmemory
GitHub - IchthysMaranatha/asterisk-chan-quectel: Channel driver for Quectel and Simcom modules, works with Asterisk-13+
I can’t imagine for a while how that driver can be connected to my frepbx system and where I should tell it to use another driver, but it looks that’s doable and works more or less stable for others people. Maybe it’s possible to setup the system even without web gui, I’m not sure but will not surprise about that.
And yes, I ran fwconsole chown many times and even in this variation:

sudo fwconsole chown

I would appreciate if someone explain me whether it makes some difference (when it’s run from root or non-root user).

Definitely, there is a problem in how mysql service starts. Why I should do
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
all the time to fix fwconsole? Maybe someone could point me out what should I review in my configuration?

if you think mysqld is stopping, then sytemd’s


systemctl status mysql

might be diagnostic before you start it again.
Generally there would be a /var/log/mysql/error.log but raspberry distros mightdisable that for ‘reasons’

OK. I run this command after reboot and it returns the following:

asterisk@raspbx:~ $ sudo systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

but /var/log/mysql/error.log is empty and other archives are not extractable

root@raspbx:/home/asterisk# ls /var/log/mysql/* -l
-rw-r----- 1 mysql adm  0 Dec 20 00:00 /var/log/mysql/error.log
-rw-r----- 1 mysql adm 20 Dec 19 00:00 /var/log/mysql/error.log.1.gz
-rw-r----- 1 mysql adm 20 Dec 18 21:57 /var/log/mysql/error.log.2.gz
-rw-r----- 1 mysql adm 20 Dec 16 00:00 /var/log/mysql/error.log.3.gz
-rw-r----- 1 mysql adm 20 Dec 15 00:00 /var/log/mysql/error.log.4.gz
-rw-r----- 1 mysql adm 20 Dec 14 00:00 /var/log/mysql/error.log.5.gz
-rw-r----- 1 mysql adm 20 Dec 13 00:00 /var/log/mysql/error.log.6.gz
-rw-r----- 1 mysql adm 20 Dec 12 00:00 /var/log/mysql/error.log.7.gz

after restarting the services

systemctl stop freepbx.service
systemctl stop apache2.service
systemctl stop mysql.service
systemctl start mysql.service
systemctl start apache2.service
fwconsole start
systemctl start freepbx.service

sudo systemctl status mysql returns:

Dec 20 12:18:14 raspbx mysqld[1342]: 2021-12-20 12:18:14 0 [Note] InnoDB: Buffer pool(s) load completed at 211220 12:18:14
Dec 20 12:18:14 raspbx mysql[1196]: Starting MariaDB database server: mysqld ..
Dec 20 12:18:14 raspbx systemd[1]: Started LSB: Start and stop the mysql database server daemon.
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1407]: Upgrading MySQL tables if necessary.
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1411]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1411]: Looking for 'mysql' as: /usr/bin/mysql
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1411]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1411]: This installation of MySQL is already upgraded to 10.3.31-MariaDB, use --force if you still need to run mysql_upgrade
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1430]: Checking for insecure root accounts.
Dec 20 12:18:14 raspbx /etc/mysql/debian-start[1434]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Should I do something with this? I did install at some poing MariaDB mysql version according to the freepbx upgrade guide…
…and the logs are the same:

root@raspbx:/home/asterisk# ls /var/log/mysql/* -l
-rw-r----- 1 mysql adm  0 Dec 20 00:00 /var/log/mysql/error.log
-rw-r----- 1 mysql adm 20 Dec 19 00:00 /var/log/mysql/error.log.1.gz
-rw-r----- 1 mysql adm 20 Dec 18 21:57 /var/log/mysql/error.log.2.gz
-rw-r----- 1 mysql adm 20 Dec 16 00:00 /var/log/mysql/error.log.3.gz
-rw-r----- 1 mysql adm 20 Dec 15 00:00 /var/log/mysql/error.log.4.gz
-rw-r----- 1 mysql adm 20 Dec 14 00:00 /var/log/mysql/error.log.5.gz
-rw-r----- 1 mysql adm 20 Dec 13 00:00 /var/log/mysql/error.log.6.gz
-rw-r----- 1 mysql adm 20 Dec 12 00:00 /var/log/mysql/error.log.7.gz

Maybe wrong permissions for mysql user?
Also I’ve run

root@raspbx:/home/asterisk# sudo mysql_upgrade --force
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
mysql.user                                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
asterisk
asterisk.admin                                     OK
asterisk.ampusers                                  OK
asterisk.announcement                              OK
asterisk.api_access_tokens                         OK
asterisk.api_applications                          OK
asterisk.api_asynchronous_transaction_history      OK
asterisk.api_auth_codes                            OK
asterisk.api_refresh_tokens                        OK
asterisk.arimanager                                OK
asterisk.callrecording                             OK
asterisk.callrecording_module                      OK
asterisk.certman_cas                               OK
asterisk.certman_certs                             OK
asterisk.certman_csrs                              OK
asterisk.certman_mapping                           OK
asterisk.cidlookup                                 OK
asterisk.cidlookup_incoming                        OK
asterisk.contactmanager_entry_emails               OK
asterisk.contactmanager_entry_images               OK
asterisk.contactmanager_entry_numbers              OK
asterisk.contactmanager_entry_speeddials           OK
asterisk.contactmanager_entry_userman_images       OK
asterisk.contactmanager_entry_websites             OK
asterisk.contactmanager_entry_xmpps                OK
asterisk.contactmanager_group_entries              OK
asterisk.contactmanager_groups                     OK
asterisk.cron_jobs                                 OK
asterisk.cronmanager                               OK
asterisk.custom_extensions                         OK
asterisk.cxpanel_conference_rooms                  OK
asterisk.cxpanel_email                             OK
asterisk.cxpanel_managed_items                     OK
asterisk.cxpanel_phone_number                      OK
asterisk.cxpanel_queues                            OK
asterisk.cxpanel_recording_agent                   OK
asterisk.cxpanel_server                            OK
asterisk.cxpanel_users                             OK
asterisk.cxpanel_voicemail_agent                   OK
asterisk.dahdi                                     OK
asterisk.dahdichandids                             OK
asterisk.daynight                                  OK
asterisk.devices                                   OK
asterisk.directory_details                         OK
asterisk.directory_entries                         OK
asterisk.emergencydevices                          OK
asterisk.fax_details                               OK
asterisk.fax_incoming                              OK
asterisk.fax_users                                 OK
asterisk.featurecodes                              OK
asterisk.findmefollow                              OK
asterisk.freepbx_log                               OK
asterisk.freepbx_settings                          OK
asterisk.globals                                   OK
asterisk.hotelwakeup_calls                         OK
asterisk.iax                                       OK
asterisk.iaxsettings                               OK
asterisk.incoming                                  OK
asterisk.indications_zonelist                      OK
asterisk.ivr_details                               OK
asterisk.ivr_entries                               OK
asterisk.kvblobstore                               OK
asterisk.kvstore_Dashboard                         OK
asterisk.kvstore_Fax                               OK
asterisk.kvstore_FreePBX                           OK
asterisk.kvstore_FreePBX_Framework                 OK
asterisk.kvstore_FreePBX_Hooks                     OK
asterisk.kvstore_FreePBX_Media                     OK
asterisk.kvstore_FreePBX_modules_Amd               OK
asterisk.kvstore_FreePBX_modules_Backup            OK
asterisk.kvstore_FreePBX_modules_Calendar          OK
asterisk.kvstore_FreePBX_modules_Conferences       OK
asterisk.kvstore_FreePBX_modules_Contactmanager    OK
asterisk.kvstore_FreePBX_modules_Core              OK
asterisk.kvstore_FreePBX_modules_Customappsreg     OK
asterisk.kvstore_FreePBX_modules_Filestore         OK
asterisk.kvstore_FreePBX_modules_Hotelwakeup       OK
asterisk.kvstore_FreePBX_modules_Paging            OK
asterisk.kvstore_FreePBX_modules_Userman           OK
asterisk.kvstore_FreePBX_modules_Versionupgrade    OK
asterisk.kvstore_FreePBX_modules_Voicemail         OK
asterisk.kvstore_FreePBX_modules_Webrtc            OK
asterisk.kvstore_OOBE                              OK
asterisk.kvstore_Sipsettings                       OK
asterisk.logfile_logfiles                          OK
asterisk.logfile_settings                          OK
asterisk.manager                                   OK
asterisk.meetme                                    OK
asterisk.module_xml                                OK
asterisk.modules                                   OK
asterisk.music                                     OK
asterisk.notifications                             OK
asterisk.outbound_route_email                      OK
asterisk.outbound_route_patterns                   OK
asterisk.outbound_route_sequence                   OK
asterisk.outbound_route_trunks                     OK
asterisk.outbound_routes                           OK
asterisk.outroutemsg                               OK
asterisk.paging_autoanswer                         OK
asterisk.paging_config                             OK
asterisk.paging_core_routing                       OK
asterisk.paging_groups                             OK
asterisk.parkplus                                  OK
asterisk.pinset_usage                              OK
asterisk.pinsets                                   OK
asterisk.pjsip                                     OK
asterisk.presencestate_list                        OK
asterisk.presencestate_prefs                       OK
asterisk.queues_config                             OK
asterisk.queues_details                            OK
asterisk.recordings                                OK
asterisk.restapi_general                           OK
asterisk.restapi_log_event_details                 OK
asterisk.restapi_log_events                        OK
asterisk.restapi_token_details                     OK
asterisk.restapi_token_user_mapping                OK
asterisk.restapi_tokens                            OK
asterisk.ringgroups                                OK
asterisk.setcid                                    OK
asterisk.sip                                       OK
asterisk.sipsettings                               OK
asterisk.sms_dids                                  OK
asterisk.sms_media                                 OK
asterisk.sms_messages                              OK
asterisk.sms_routing                               OK
asterisk.soundlang_customlangs                     OK
asterisk.soundlang_packages                        OK
asterisk.soundlang_prompts                         OK
asterisk.soundlang_settings                        OK
asterisk.timeconditions                            OK
asterisk.timegroups_details                        OK
asterisk.timegroups_groups                         OK
asterisk.trunk_dialpatterns                        OK
asterisk.trunks                                    OK
asterisk.ttsengines                                OK
asterisk.ucp_sessions                              OK
asterisk.userman_directories                       OK
asterisk.userman_groups                            OK
asterisk.userman_groups_settings                   OK
asterisk.userman_template_settings                 OK
asterisk.userman_ucp_templates                     OK
asterisk.userman_users                             OK
asterisk.userman_users_settings                    OK
asterisk.users                                     OK
asterisk.vmblast                                   OK
asterisk.vmblast_groups                            OK
asterisk.voicemail_admin                           OK
asterisk.webrtc_clients                            OK
asterisk.xmpp_options                              OK
asterisk.xmpp_users                                OK
asteriskcdrdb
asteriskcdrdb.cdr                                  OK
asteriskcdrdb.cel                                  OK
information_schema
performance_schema
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK

and after reboot the situation is the same:

asterisk@raspbx:~ $ sudo fwconsole ma list
Exception: SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/utility.functions.php on line 120

Caused by
PDOException: SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/BMO/Database.class.php on line 144
Stack trace:
  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:120
  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:149
  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:144
  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:144
  5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:71
  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:144
  7. require_once() /etc/freepbx.conf:10
  8. include_once() /var/lib/asterisk/bin/fwconsole:12

but the report about mysql status is a bit shorter:

asterisk@raspbx:~ $ sudo systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql; generated)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

And this is content of /etc/init.d/mysql (if it could give some keys about the problem):

asterisk@raspbx:~ $ cat /etc/init.d/mysql
#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          mysql
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $network $named $time
# Should-Stop:       $network $named $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description:       Controls the main MariaDB database server daemon "mysqld"
#                    and its wrapper script "mysqld_safe".
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}

test -x /usr/sbin/mysqld || exit 0

. /lib/lsb/init-functions

SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)

MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"

# priority can be overridden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"

if [ -f /etc/default/mysql ]; then
  . /etc/default/mysql
fi

# Also source default/mariadb in case the installation was upgraded from
# packages originally installed from MariaDB.org repositories, which have
# had support for reading /etc/default/mariadb since March 2016.
if [ -f /etc/default/mariadb ]; then
  . /etc/default/mariadb
fi

# Safeguard (relative paths, core dumps..)
cd /
umask 077

# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
# as many admins e.g. only store a password without a username there and
# so break my scripts.
export HOME=/etc/mysql/

## Fetch a particular option from mysql's invocation.
#
# Usage: void mysqld_get_param option
mysqld_get_param() {
  /usr/sbin/mysqld --print-defaults \
    | tr " " "\n" \
    | grep -- "--$1" \
    | tail -n 1 \
    | cut -d= -f2
}

## Do some sanity checks before even trying to start mysqld.
sanity_checks() {
  # check for config file
  if [ ! -r /etc/mysql/my.cnf ]; then
    log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
    echo                "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
  fi

  # check for diskspace shortage
  datadir=`mysqld_get_param datadir`
  if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
    log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
    echo                "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
    exit 1
  fi
}

## Checks if there is a server running and if so if it is accessible.
#
# check_alive insists on a pingable server
# check_dead also fails if there is a lost mysqld in the process list
#
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
mysqld_status () {
  ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))

  ps_alive=0
  pidfile=`mysqld_get_param pid-file`
  if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi

  if [ "$1" = "check_alive"  -a  $ping_alive = 1 ] ||
     [ "$1" = "check_dead"   -a  $ping_alive = 0  -a  $ps_alive = 0 ]; then
    return 0 # EXIT_SUCCESS
  else
    if [ "$2" = "warn" ]; then
      echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
    fi
  return 1 # EXIT_FAILURE
  fi
}

#
# main()
#

case "${1:-''}" in

  'start')
  sanity_checks;
  # Start daemon
  log_daemon_msg "Starting MariaDB database server" "mysqld"
  if mysqld_status check_alive nowarn; then
   log_progress_msg "already running"
   log_end_msg 0
  else
    # Could be removed during boot
    test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld

    # Start MariaDB!
    /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &

    for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
      sleep 1
      if mysqld_status check_alive nowarn ; then break; fi
      log_progress_msg "."
    done
    if mysqld_status check_alive warn; then
      log_end_msg 0
      # Now start mysqlcheck or whatever the admin wants.
      output=$(/etc/mysql/debian-start)
      if [ -n "$output" ]; then
        log_action_msg "$output"
      fi
    else
      log_end_msg 1
      log_failure_msg "Please take a look at the syslog"
    fi
  fi
  ;;

  'stop')
  # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
  # at least for cron, we can rely on it here, too. (although we have
  # to specify it explicit as e.g. sudo environments points to the normal
  # users home and not /root)
  log_daemon_msg "Stopping MariaDB database server" "mysqld"
  if ! mysqld_status check_dead nowarn; then
    set +e
    shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
    set -e
    if [ "$r" -ne 0 ]; then
      log_end_msg 1
      [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
      log_daemon_msg "Killing MariaDB database server by signal" "mysqld"
      killall -15 mysqld
      server_down=
      for i in `seq 1 600`; do
        sleep 1
        if mysqld_status check_dead nowarn; then server_down=1; break; fi
      done
      if test -z "$server_down"; then killall -9 mysqld; fi
    fi
  fi

  if ! mysqld_status check_dead warn; then
    log_end_msg 1
    log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server-10.3/README.Debian.gz!"
    exit -1
  else
    log_end_msg 0
  fi
  ;;

  'restart')
  set +e; $SELF stop; set -e
  shift
  $SELF start "${@}"
  ;;

  'reload'|'force-reload')
  log_daemon_msg "Reloading MariaDB database server" "mysqld"
  $MYADMIN reload
  log_end_msg 0
  ;;

  'status')
  if mysqld_status check_alive nowarn; then
    log_action_msg "$($MYADMIN version)"
  else
    log_action_msg "MariaDB is stopped."
    exit 3
  fi
  ;;

  'bootstrap')
	# Bootstrap the cluster, start the first node
	# that initiates the cluster
	log_daemon_msg "Bootstrapping the cluster" "mysqld"
	$SELF start "${@:2}" --wsrep-new-cluster
	;;

  *)
  echo "Usage: $SELF start|stop|restart|reload|force-reload|status|bootstrap"
  exit 1
  ;;
esac

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.