TIPS "DB ERROR: Connect Failed"

Status
Not open for further replies.

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
I tried upgrading to the new version of aastra xml scripts. I followede all the instructions of removing the old and installing the new ones.

The new onels failed on install. Which is no big deal, however, now I cant connect to freepbx, I get an "Fatal Error DB ERROR: Connect Failed" error.

I did not make any other changes.

Thanks
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
This suggests a mismatch between the MySQL password and the settings in /etc/amportal.conf

Log onto mysql with the credentials in amportal.conf at the command line to check these are in order.

Also, do check that you can ping localhost.

Joe
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
I am able to ping localhost.

When I try to connect, (mysql -u asteriskuser -h localhost -p)I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


The settings in the amportal.conf file ar ethe default:

AMPDBUSER=asteriskuser
AMPDBPASS=amp109
AMPDBNAME=asterisk
ASTETCDIR=/etc/asterisk


"status" shows everything is okay.


Thanks
 

MyKroFt

Guru
Joined
Oct 31, 2008
Messages
659
Reaction score
3
shutdown mysql - /etc/init.d/mysqld stop
remove the sockets file(s)
and then restart it - /etc/init.d/mysqld start

or update-fixes should fix it as well - looks like your permissions on the socket file got hosed
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
I went to "/var/lib/mysql" but I dont see any socket file there.


When I try to run update-fixes, it completes with out it showing anything being done, and then when I choose not to display a log, it shows:

Code:
Insufficient disk space; try again later
Insufficient disk space; try again later
returntosender: cannot select queue for root
Insufficient disk space; try again later
returntosender: cannot select queue for postmaster
putbody: write error: No space left on device
Error writing control file qfo621QTmO024544: No space left on device


Thank you
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
When I run df, I get:

Code:
root@pbx:~ $ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2             27536316  26662688         0 100% /
/dev/hda1               101086     11156     84711  12% /boot
tmpfs                   127552         0    127552   0% /dev/shm
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
I deleted everything in the tftboot directory, but it still shows the same and gives same error
 

The Deacon

Guru
Joined
Jan 29, 2008
Messages
296
Reaction score
14
To see where the largest (or fullest) directory is do this (as root):

cd /
du -sk * | sort -n

This will tell you which directories are the fullest, starting with the emptiest. Then start in that directory and work your way backwards.
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
File: full.4 in var/log/asterisk is about 22GB big.

I am assuming I can delete it. How does that get to be so big, and how do I stop that from happening again?

Thanks
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
I deleted the file, and every started working. No need to delete the socket file.

How do I stop this from happening again?
 

blanchae

Guru
Joined
Mar 12, 2008
Messages
1,910
Reaction score
9
Regularly monitor your asterisk log file and delete it... It is a text file that can grow quite large as you found out. Regularly monitoring it should be part of your routine admin duties. The more familar you are with it, the better you will be able to troubleshoot problems when they come. At first it seems daunting but it's easy after a while.

The alternative is to rewrite the cron script to delete the log file after so many days...
 

blanchae

Guru
Joined
Mar 12, 2008
Messages
1,910
Reaction score
9
Forgot to mention, thanks for posting the solution. Monitoring the log file is easy to overlook when you first start using PiaF and you've given a very good example of how something as simple as a log file can have dramatic impact.
 

amygrant

Guru
Joined
Apr 4, 2010
Messages
132
Reaction score
3
Well, it looks like your main drive partition is full. Mysql isn't a fan of full drives as it needs to be able to create temp files. If there is no room to make said temp file, then mysql won't run.

If you make some room on /hda2, you can then probably start mysql and your problem will be fixed.
 

The Deacon

Guru
Joined
Jan 29, 2008
Messages
296
Reaction score
14
Here is a script that I've been using for quite a while on most of my Linux/Mac boxes:

Code:
#!/bin/bash
#-------------------------------------------------------------------
# Quick script to monitor disk space - cron this to run every hour
# If disk used space >= $ALERT send an email to $ADMIN
#-------------------------------------------------------------------
# Set our alert level (as a percentage of capacity)
ALERT=90
# When threshold has been met / exceeded, who do we tell
ADMIN="QUALIFIED_USER@VALID_TLD.COM"

df -H | grep -vE 'cdrom|devfs|^Filesystem|tmpfs'| awk '{ print $5 " " $1 }' | while read line;
do
  used=$(echo $line | awk '{ print $1}' | cut -d'%' -f1 )
  filesystem=$(echo $line | awk '{ print $2 }' )
  if [ $used -ge $ALERT ]; then
    echo "$filesystem on $(hostname) is at $used% of capacity" | mail -s "ALERT: $filesystem on $(hostname) is at $used% of capacity!" $ADMIN
  fi
done
 

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
Thank you for help.


Is there a way to automatically limit how big the log file will get? That way one does not need to go manually delete the log file?


Thank you
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Look at logrotate, with the size option.

Joe
 

dghundt

Guru
Joined
Nov 15, 2007
Messages
603
Reaction score
52
Getting same error.
Cannot connect to any sip extensions either.

Code:
root@pbx:~ $ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             76024929  76024728         0 100% /
/dev/sda1               118523      9596    102905   9% /boot
tmpfs                  1037060         0   1037060   0% /dev/shm
root@pbx:~ $ cd/
-bash: cd/: No such file or directory
root@pbx:~ $ cd /
root@pbx:/ $ du -sk * | sort -n
du: cannot read directory `proc/12000': No such file or directory

0       misc
0       net
0       proc
0       sys
1       home
1       media
1       selinux
1       srv
12      lost+found
120     dev
1855    tmp
2766    tftpboot
5482    boot
6401    bin
29721   sbin
44849   etc
75509   lib
82149   opt
110862  tmp.mondo.19696
217912  root
666001  mondo.scratch.7136
1494296 usr
7494884 var
32770426        backup
32994124        mnt
In the backup folder, I see 50 mondo rescue iso's all created on 7/25/2010. There are 50 iso's in one day (a sunday).
mnt/usbmondo had another load of files, created on 7/18/2010 (which is 7 days difference)
So, I deleted these.

I see a scheduled cron job in webmin, three together
Code:
/etc/cron.weekly/0anacron
/etc/cron.weekly/disk-backup.cron
/etc/cron.weekly/makewhatis.cron
So I made these inactive. Any issues with this?
I ran update-fixes as suggested above after freeing disk space.

I've been running this system for over a year, never configured any mondo backups/crons????? Never checked if it was just running in background, and now file size finally maybe became too large.
I do not see any unauthorized calls in my cdr.

Code:
            PBX in a Flash Version 1.3 Daemon Status
********************************************************************
* Asterisk  * ONLINE  * Zaptel    * ONLINE  * MySQL      * ONLINE  *
* SSH       * ONLINE  * Apache    * ONLINE  * Iptables   * ONLINE  *
* Fail2ban  * ONLINE  * IP Connect* ONLINE  * Ip6tables  * ONLINE  *
* BlueTooth * ONLINE  * Hidd      * ONLINE  * NTPD       * ONLINE  *
* Sendmail  * ONLINE  * Samba     * OFFLINE * Webmin     * ONLINE  *
* Ethernet0 * ONLINE  * Ethernet1 *   N/A   * Wlan0      *   N/A   *
********************************************************************
* Running Asterisk Version : LOADING
* Asterisk Source Version  : 1.4.21.2
* Zaptel Source Version    : 1.4.12.1
* Libpri Source Version    : 1.4.7
* Addons Source Version    : 1.4.7
********************************************************************
pbx.local on 192.xx.xx.xx - eth0
CentOS release 5.2 (Final) :32 Bit Kernel: 2.6.18-92.1.6.el5
********************************************************************
 For help on PBX commands than you can run type help-pbx           *
********************************************************************
 

dghundt

Guru
Joined
Nov 15, 2007
Messages
603
Reaction score
52
yah, I deleted the mondo backups, killed the cron job with webmin (I use acronis image backups), and everything started to come alive again.

I added to this thread to share my learning curve in case someone else has the default mondo setup installed on their system with a small-ish hard drive. Great pbx. Great forum. Thanks!

what are these cron jobs? They were linked together in webmin with the backup cron.
/etc/cron.weekly/0anacron
/etc/cron.weekly/makewhatis.cron
 

drmurdoch

Member
Joined
May 26, 2008
Messages
576
Reaction score
11
Here is a script that I've been using for quite a while on most of my Linux/Mac boxes:

Code:
#!/bin/bash
#-------------------------------------------------------------------
# Quick script to monitor disk space - cron this to run every hour
# If disk used space >= $ALERT send an email to $ADMIN
#-------------------------------------------------------------------
# Set our alert level (as a percentage of capacity)
ALERT=90
# When threshold has been met / exceeded, who do we tell
ADMIN="QUALIFIED_USER@VALID_TLD.COM"

df -H | grep -vE 'cdrom|devfs|^Filesystem|tmpfs'| awk '{ print $5 " " $1 }' | while read line;
do
  used=$(echo $line | awk '{ print $1}' | cut -d'%' -f1 )
  filesystem=$(echo $line | awk '{ print $2 }' )
  if [ $used -ge $ALERT ]; then
    echo "$filesystem on $(hostname) is at $used% of capacity" | mail -s "ALERT: $filesystem on $(hostname) is at $used% of capacity!" $ADMIN
  fi
done

Would this be a good cron job to add for my PBX ? (in my sig) ?
 
Status
Not open for further replies.

Members online

No members online now.

Forum statistics

Threads
25,781
Messages
167,507
Members
19,200
Latest member
mricot
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