Errors on upgrade

I just upgraded my system, the upgrade indicated that there weren’t any issues but I re3ceived 4 e-mails with problems. Can anyone tell me if these need to be resolved?

1) Cron asterisk@pbx /var/lib/asterisk/bin/pagepro-scheduler.php 2>&1 >/dev/null

/bin/sh: /var/lib/asterisk/bin/pagepro-scheduler.php:
Permission denied

2) Cron asterisk@pbx [ -e /var/www/html/admin/modules/qxact_reports/import_queue_data.php ] && php /var/www/html/admin/modules/qxact_reports/import_queue_data.php

Exception: SQLSTATE[HY000] [2002] Can’t connect to local
MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)::SQLSTATE[HY000]
[2002] Can’t connect to local MySQL server through socket
’/var/lib/mysql/mysql.sock’ (2) in file
/var/www/html/admin/libraries/utility.functions.php on line 202 Stack trace:

1.Exception->() /var/www/html/admin/libraries/utility.functions.php:202

  1. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:101

  2. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:98

  3. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:98

  4. FreePBX\Database->__construct()
    /var/www/html/admin/libraries/BMO/FreePBX.class.php:69

  5. FreePBX->__construct() /var/www/html/admin/bootstrap.php:141

  6. require_once() /etc/freepbx.conf:9

  7. include_once() /var/www/html/admin/modules/qxact_reports/import_queue_data.php:4

3) Cron asterisk@pbx [ -x /var/www/html/admin/modules/dashboard/scheduler.php ] && /var/www/html/admin/modules/dashboard/scheduler.php

Exception: SQLSTATE[HY000] [2002] Can’t connect to local
MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)::SQLSTATE[HY000]
[2002] Can’t connect to local MySQL server through socket
’/var/lib/mysql/mysql.sock’ (2) in file
/var/www/html/admin/libraries/utility.functions.php on line 202 Stack trace:

  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:202

  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:101

  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:98

  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:98

  5. FreePBX\Database->__construct()
    /var/www/html/admin/libraries/BMO/FreePBX.class.php:69

  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:141

  7. require_once() /etc/freepbx.conf:9

  8. include() /var/www/html/admin/modules/dashboard/scheduler.php:14

4. Cron asterisk@pbx [ -x /var/lib/asterisk/bin/schedtc.php ] && /var/lib/asterisk/bin/schedtc.php

Exception: SQLSTATE[HY000] [2002] Can’t connect to local
MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)::SQLSTATE[HY000]
[2002] Can’t connect to local MySQL server through socket
’/var/lib/mysql/mysql.sock’ (2) in file /var/www/html/admin/libraries/utility.functions.php
on line 202 Stack trace:

  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:202

  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:101

  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:98

  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:98

  5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:69

  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:141

  7. require_once() /etc/freepbx.conf:9

  8. include_once() /var/www/html/admin/modules/timeconditions/bin/schedtc.php:7

Thanks!

Your mysql server isn’t running.

Hi Andrew,

I think it is. See below: (I’m not very knowledgeable with Linux.)

[root@pbx ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2357
Server version: 5.1.73 Source distribution

Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> connect
Connection id: 2366
Current database: *** NONE ***

mysql> status

mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

Connection id: 2366
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.73 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 5 hours 19 min 23 sec

Threads: 5 Questions: 150313 Slow queries: 0 Opens: 109 Flush tables: 1 Open tables: 64 Queries per second avg: 7.843

mysql>

This is usually indicative of the /var/lib/asterisk/bin/pagepro-scheduler.php program is not executable by Asterisk.

Check the ownership of the files and directories and make sure that asterisk can read and execute the program and the …/bin directory.

Check your MySQL my.cnf file and make sure that your are specifying the same socket name is being used in your FreePBX deployment. ALso, check your directory permissions to make sure that the Asterisk user can access the socket.

The easiest way I can think of to do this is to log into the server as ‘root’. Use ‘su -m asterisk’ to change to the asterisk user and then try to access the files.

Thanks for the response Dave; I think it looks good but I’m not sure. I seem to have links to the actual file and socket. To be honest, I’ve never seen “s” as the first character of a permissions string.

I checked the permissions, and everything looks OK to me. It is accessed via a link, and owned by asterisk with execution authority. Does the second ll need write authority?

[root@pbx ~]# ll /var/lib/asterisk/bin/pagepro-scheduler.php
lrwxrwxrwx 1 asterisk asterisk 63 May 23 2015 /var/lib/asterisk/bin/pagepro-scheduler.php -> /var/www/html/admin/modules/pagingpro/bin/pagepro-scheduler.php

[root@pbx ~]# ll /var/www/html/admin/modules/pagingpro/bin/pagepro-scheduler.php
-rwxr-xr-x 1 asterisk asterisk 1295 Jun 14 08:15 /var/www/html/admin/modules/pagingpro/bin/pagepro-scheduler.php

[root@pbx ~]# ll /var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 Jul 9 06:11 /var/lib/mysql/mysql.sock

[root@pbx ~]# locate my.cnf
/etc/my.cnf
[root@pbx ~]# vi /etc/my.cnf

Here is my my.cnf file, I think I need to enable symbolic links?? Note that I am able to read CDRs from the FreePBX interface, I believe that uses SQL.

[mysqld]
general_log = 0
general_log_file = /var/log/mysql/mysql.log
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

“s” is for “socket”. That’s perfect.

Try running “fwconsole chown” and see what that does.

Your old installation of FreePBX used a program called “amportal” for a lot of management stuff. With the advent of Version 12 (13?), the control program is now “fwconsole”. Run that without any arguments to see all of the options.

Thanks, Dave.

I ran fwconsole, and it successfully completed.

[root@pbx ~]# fwconsole chown
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions…
Collecting Files…Done
58403/58403 [============================] 100%
Finished setting permissions

[root@pbx ~]# f

How do I resolve the errors the I encountered in the last install? I used the module update within FreePBX and installed 31 modules.

Another couple of errors I’ve seen for some time shows up when I sign into Linux that seems related to fwconsole (I don’t have the new Symfony application installed, so I’ve been ignoring them):

Using username “mike”.
Authenticating with public key
Last login: Mon Jul 11 05:54:59 2016 from 192.168.0.9

PHP Warning: include_once(/etc/asterisk/freepbx.conf): failed to open stream: Permission denied in /var/lib/asterisk/bin/fwconsole on line 13

PHP Warning: include_once(): Failed opening ‘/etc/asterisk/freepbx.conf’ for inclusion (include_path=’.:/usr/share/pear:/usr/share/php’) in /var/libasterisk/bin/fwconsole on line 13

PHP Fatal error: Class ‘Symfony\Component\Console\Application’ not found in /var/www/html/admin/libraries/FWApplication.class.php on line 11

[mike@pbx ~]$

Thats normal since you are logging in as “mike” and not “root”

Dave, did you see this?

The “fwconsole chown” should have solved the majority of your permissions problems.

What problems are you still seeing?

The install for some of the most recent updates seemed to have failed due to errors. I don’t notice any specific problems but want to make sure that I don’t need to run the updates that failed again. I’m worried that since those failed, I might have an issue down the road.

By the way, I appreciate all of your help. I’d like to send you a bag of our Kona coffee as a token of appreciation. Send me your name and mailing address if you’re interested.

Best,
Mike

As you go forward, the “module admin” option on the GUI should keep you reasonably up-to-date.

Note that these will sometimes fail (especially is you are tracking the “edge” release). Just power through them until the routine completes without errors. If you can’t, there are specific “fwconsole” commands that you can use to remove and reinstall modules that fail to correctly upgrade.

In my experience, when upgrading, it doesn’t pay to “apply changes” after every step in the update process. I find that doing it once, at the end of the installation chain, is usually sufficient.