SUGGESTIONS MySQL Error: FreePBX Won't Start

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
I manage our synagogues PIAF and been getting emails from vitellity that calls not terminating. I assumed this was normal registration issue and it would have failed over to the voip.ms trunk.

Nope. Asterisk down again!

FATAL ERROR

DB Error: connect failed

Trace Back

/var/www/html/admin/libraries/db_connect.php:71 die_freepbx()
[0]: DB Error: connect failed

/var/www/html/admin/bootstrap.php:85 require_once()
[0]: /var/www/html/admin/libraries/db_connect.php

/etc/freepbx.conf:9 require_once()
[0]: /var/www/html/admin/bootstrap.php

/var/www/html/admin/config.php:99 include_once()
[0]: /etc/freepbx.conf

┌────────────────────────SYSTEM INFORMATION───────────────────────────┐
│ Asterisk = OFFLINE | Dahdi = ONLINE | MySQL = OFFLINE │
│ SSH = ONLINE | Apache = ONLINE | Iptables = ONLINE │
│ Fail2ban = ONLINE | Internet = ONLINE | Ip6Tables = ONLINE │
│ Disk Free = ADEQUATE| Mem Free = ADEQUATE| NTPD = ONLINE │
│ Postfix = ONLINE | Samba = ONLINE | Webmin = ONLINE │
│ Ethernet0 = ONLINE | Ethernet1 = N/A | Wlan0 = N/A │
│ │
│ PIAF Installed Version = 2.0.6.4 under *HARDWARE* │
│ FreePBX Version = 2.11.0.37 │
│ Running Asterisk Version = UNKNOWN │
│ Asterisk Source Version = 11.6.0 │
│ Dahdi Source Version = 2.7.0.1 │
│ Libpri Source Version = 1.4.14 │
│ IP Address = 10.196.4.10 on eth0 │
│ Operating System = CentOS release 6.4 (Final) │
│ Kernel Version = 2.6.32-358.23.2.el6.i686 - 32 Bit │
│ Incredible Version = 11.7 │
└─────────────────────────────────────────────────────────────────────┘

I reported this months ago and forgot what was done to clear this and I requested it be added to the distro and never heard anything back. I'm assuming they had a power failure or something that tripped the UPS.

I'm at work during lunch looking at this and need to get it up before Shaboos sets in.

THanks leon
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
amportal restart fails as such:

root@pbx:~ $ amportal restart

Fetching FreePBX settings with gen_amp_conf.php..
/usr/local/sbin/amportal: line 49: [FATAL]: command not found

/var/lib/asterisk/bin/freepbx_engine: line 98: [FATAL]: command not found
**** WARNING: ERROR IN CONFIGURATION ****
astrundir in '/etc/asterisk' is set to but the directory
does not exists. Attempting to create it with: 'mkdir -p '

mkdir: missing operand
Try `mkdir --help' for more information.
**** ERROR: COULD NOT CREATE ****
Attempt to execute 'mkdir -p ' failed with an exit code of 1
You must create this directory and the try again.
WARNING: Always run Incredible PBX behind a secure hardware-based firewall.
root@pbx:~ $
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
Check and see if the mysql server is started.
On CentOS, I think it's 'service mysqld status' or 'service mysql status'
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
thanks folks...if freepbx fixed it then why when stuff comes up it doesnt run this to fix it?
We should, IMHO, do this. seems to happen everytime a power failure hits of course
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
The FreePBX Distro only. This is a distro level feature. I have said that several times now. It is up to your distro to add this (FreePBX itself can't)
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
yes I have and tm1000 says above the distro needs to add it. I have not done so since my original post. which if I were to "fix it" then anytime a change is done or I change colors or pull a new distro I have to reinvent the wheel. if the distro has it I or others dont have to worry about it.

Leon
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,224
Leon (aka wa4zlw):
We plan to add the patch as time permits. In the past 8 years, we've seen this issue raised about three times. Two of those were from you.

So... in the scheme of things, we prioritize resources. We don't do this for a living like tm1000. We do it for fun. Unless you want to fund the next build, use the patch. Otherwise, wait or switch distros if you believe the grass is greener elsewhere. But don't keep raising the same issue. It wastes everyone's time. Thanks.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
thanks ward...i appreciate all that and understand.
 

james

Guru
Joined
Oct 18, 2007
Messages
374
Reaction score
38
To assist the user base who may be having this issue, I would like to contribute to the inclusion of the aforementioned fix. I encourage others to donate as well so we can get these fixes included so people can stay on PBX in a flash. Simply click the donate link at the top of the page. Thanks wardmundy for all of your hard work.
8lz2KXr.png
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
We are just trying to be helpful to your community, we are not trying to push our own product but the fact remains that it is fixed in our own distro in an init.d script, I've pretty much written out what the init.d script should look like. I never had to reply in this thread with the fix or the other thread, I could have just let everyone assume (incorrectly) that Leon's mysql database was crashed/broken beyond repair and that he should/needed to do a full reinstall, is that fair to let that happen? If I comment on the fix that we figured out and also say that it's in the FreePBX distro that is not fair? So the fix is fair and welcome but the comment about our distro is not....... Take it or leave it.

When people ask about PIAF on *our* forums and even in IRC (in which PIAF conversation and questions come up more than you'd think) we are pretty open and nice about it. Users can choose what they want, they should make up their own minds. We shouldn't have to feel ashamed for talking about our products here... or should we?

Furthermore, James and I both have worked on FreePBX for several years in our free time without getting paid. I wrote Endpoint Manager for this community (PIAF) in my free time, completely unpaid. I managed Superfecta completely unpaid (with Lorne). James wrote the freepbx hello world module, the original teletorture module and others completely unpaid. So I fail to see how the argument of "we get paid for this" applies to anything. Are we not welcome here because we turned a hobby into a job? Isn't that the point of all this?

Just trying to provide for the community that I love/respect. That is all. I hope for Leon's sake that he writes this down, because if he asks about it again I'm sure we will all travel down this same rat-hole again and I'd really hate to see that.

Instant Coffee Fix:
Code:
service mysqld stop
rm -Rf /var/lib/mysql/mysql.sock
service mysqld start

Long Term Fix:
Code:
echo "service mysqld stop" >> /etc/rc.d/rc.local
echo "rm -Rf /var/lib/mysql/mysql.sock" >> /etc/rc.d/rc.local
echo "service mysqld start" >> /etc/rc.d/rc.local
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,224
Thanks, tm1000. We provided a similar fix last May in the first thread in which this was raised by the same wa4zlw.

We all appreciate everything you and james do/have done for both the FreePBX and PIAF projects. Just wish some of the snarky comments could be avoided. Tends to poison a good conversation.
 

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,634
Reaction score
523
Instant Coffee Fix:
Code:
service mysqld stop
rm -Rf /var/lib/mysql/mysql.sock
service mysqld start

Long Term Fix:
Code:
echo "service mysqld stop" >> /etc/rc.d/rc.local
echo "rm -Rf /var/lib/mysql/mysql.sock" >> /etc/rc.d/rc.local
echo "service mysqld start" >> /etc/rc.d/rc.local

Hi my Coffee turned sour when I used your fix on my Rpi2 Raspbian (wheezy) as signature below
Code:
root@pi2:/var/run/mysqld# service mysqld stop
mysqld: unrecognized service

So I amended your script to read service mysql stop, which I think worked (except that when I replicated the stop, there is no mysql.sock to rm)
Code:
#!/bin/bash

service mysql stop
rm -Rf /var/lib/mysql/mysql.sock
service mysql start

That would mean that my Long Term Fix (LTF) would/should read:-

Code:
echo "service mysql stop" >> /etc/rc.d/rc.local
echo "rm -Rf /var/lib/mysql/mysql.sock" >> /etc/rc.d/rc.local
echo "service mysql start" >> /etc/rc.d/rc.local

I have not tested that LTF. I hope I got that right?
No-Joy :oops:its not there - try echo "rm -Rf /run/mysql/mysql.sock"
Code:
root@pi2:/etc# ls -Al /var/lib/mysql/mysql.sock
ls: cannot access /var/lib/mysql/mysql.sock: No such file or directory

root@pi2:/etc# ls -Al  /var/run/mysqld/mysqld.sock
srwxrwxrwx 1 mysql mysql 0 Nov 10 03:43 /var/run/mysqld/mysqld.sock

added code below to /etc/rc.local Trying with 'rm -Rf /run/mysqld/mysql.sock'.
Code:
# the folowing is to cleanup 'mysql.sock' if exist when mysql stopped
#exit 0
service mysql stop
rm -Rf  /run/mysqld/mysql.sock  # or is it ?  rm -Rf /var/run/mysqld/mysql.sock
service mysql start

exit 0
 
Last edited:

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,224
@ostridge: You've dredged up a thread that's over 2 years old. The syntax for Debian/Ubuntu/Raspbian is different than what's used on the RedHat/CentOS/SL platforms. None of those implementations even existed when this thread was created. :yikes:

Also be sure your entries precede the exit 0 line in rc.local.
 

ostridge

Guru
Joined
Jan 22, 2015
Messages
1,634
Reaction score
523
@ostridge: You've dredged up a thread that's over 2 years old. The syntax for Debian/Ubuntu/Raspbian is different than what's used on the RedHat/CentOS/SL platforms. None of those implementations even existed when this thread was created. :yikes:

Also be sure your entries precede the exit 0 line in rc.local.

Thanks for the pointer I had spotted the EXIT 0 and wasnt sure where it wanted to be.
Shouldn't that script have magically found its way into the updates/distros? :angel:

I'm getting a delay with incoming/7777/internal calls due to mysql gone away.
By the time call rings and gets answered caller gone away.

rc.local not at /etc/rc.d/rc.local
in Wheezy its at /etc/rc.local and there is not an /etc/rc.d directory
Regards
 
Last edited:

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,202
Reaction score
5,224
/etc/rc.local should be symlinked to /etc/rc.d/rc.local
 

Members online

Forum statistics

Threads
25,815
Messages
167,790
Members
19,245
Latest member
rahee
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top