Asterisk server status - ERROR [SOLVED]

I am currently runnning Asterisk (Ver. 1.8.16.0)

I installed few months ago, but dont know what problem caused. This morning when I did a system reboot.

Then I begin to receive Asterisk error

STARTING ASTERISK
Asterisk ended with exit status 1
Asterisk died with code 1.
Automatically restarting Asterisk.
mpg123: no process killed


Asterisk could not start!
Use ‘tail /var/log/asterisk/full’ to find out why.
[[email protected] ~]# tail /var/log/asterisk/full
[2013-02-22 14:37:18] VERBOSE[12842] loader.c: app_page.so => (Page Multiple Phones)
[2013-02-22 14:37:18] VERBOSE[12842] pbx.c: == Registered application ‘DumpChan’
[2013-02-22 14:37:18] VERBOSE[12842] loader.c: app_dumpchan.so => (Dump Info About The Calling Channel)
[2013-02-22 14:37:18] VERBOSE[12842] pbx.c: == Registered application ‘Originate’
[2013-02-22 14:37:18] VERBOSE[12842] loader.c: app_originate.so => (Originate call)
[2013-02-22 14:37:18] VERBOSE[12842] translate.c: == Registered translator ‘ilbctolin’ from format ilbc to slin, cost 2999
[2013-02-22 14:37:18] VERBOSE[12842] translate.c: == Registered translator ‘lintoilbc’ from format slin to ilbc, cost 13998
[2013-02-22 14:37:18] VERBOSE[12842] loader.c: codec_ilbc.so => (iLBC Coder/Decoder)
[2013-02-22 14:37:18] VERBOSE[12842] config.c: == Parsing ‘/etc/asterisk/cdr_mysql.conf’: [2013-02-22 14:37:18] VERBOSE[12842] config.c: == Found
[2013-02-22 14:37:18] ERROR[12842] cdr_mysql.c: Unable to query table description!! Logging disabled.

DO you have any idea what’s going on? I dint work on any modification or configuration of my system script. I just did a system reboot. Then the system not working anymore.

OMG… pls Help…

Thank you so much!!

OK, here’s what you try. It seems like Asterisk is spitting out errors with CDR

We will try to disable cdr first and see if this is the real issue or not.

do this, edit the file /etc/asterisk/modules.conf

Add this line right at the bottom
noload => cdr_mysql.so

Then stop and start asterisk.

Dear Sanjayws,

Thank you so much!! its work!! But may I know what is the error that caused this? Since you found the solutions for it.

Besides, is there any effect to my system since I noload cdr mysql?

Thank you soooo much!

Yes absolutely CDR wont work

Please share

  1. Content of your /etc/asterisk/cdr_mysql.conf (remove the passwords of course)
  2. The db called asteriskcdrdb
    mysqldump asteriskcdrdb --compact --no-data -u root -p (key in your root password if it does prompt)

also, for the heck of it, see if mysql is running

/etc/init.d/mysql status

1 Like

[[email protected] ~]# cat /etc/asterisk/cdr_mysql.conf
;
; Note - if the database server is hosted on the same machine as the
; asterisk server, you can achieve a local Unix socket connection by
; setting hostname = localhost
;
; port and sock are both optional parameters. If hostname is specified
; and is not “localhost”, then cdr_mysql will attempt to connect to the
; port specified or use the default port. If hostname is not specified
; or if hostname is “localhost”, then cdr_mysql will attempt to connect
; to the socket file specified by sock or otherwise use the default socket
; file.
;
[global]
hostname = localhost
dbname=asteriskcdrdb
password =
user = freepbxuser
userfield=1
;port=3306
;sock=/tmp/mysql.sock

2.(i tired many times, with different password, but non of them worked)
[[email protected] ~]# mysqldump asteriskcdrdb --compact --no-data -u root -p
Enter password:
mysqldump: Got error: 1045: Access denied for user ‘root’@‘localhost’ (using password: YES) when trying to connect

[[email protected] ~]# cat /etc/init.d/mysqld status
#!/bin/bash

mysqld This shell script takes care of starting and stopping

the MySQL subsystem (mysqld).

chkconfig: - 64 36

description: MySQL database server.

processname: mysqld

config: /etc/my.cnf

pidfile: /var/run/mysqld/mysqld.pid

Source function library.

. /etc/rc.d/init.d/functions

Source networking configuration.

. /etc/sysconfig/network

prog=“MySQL”

extract value of a MySQL option from config files

Usage: get_mysql_option SECTION VARNAME DEFAULT

result is returned in $result

We use my_print_defaults which prints all options from multiple files,

with the more specific ones later; hence take the last match.

get_mysql_option(){
result=/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1
if [ -z “$result” ]; then
# not found, use default
result="$3"
fi
}

get_mysql_option mysqld datadir “/var/lib/mysql"
datadir=”$result"
get_mysql_option mysqld socket “$datadir/mysql.sock"
socketfile=”$result"
get_mysql_option mysqld_safe log-error “/var/log/mysqld.log"
errlogfile=”$result"
get_mysql_option mysqld_safe pid-file “/var/run/mysqld/mysqld.pid"
mypidfile=”$result"

start(){
touch “$errlogfile"
chown mysql:mysql “$errlogfile"
chmod 0640 “$errlogfile”
[ -x /sbin/restorecon ] && /sbin/restorecon “$errlogfile"
if [ ! -d “$datadir/mysql” ] ; then
action $“Initializing MySQL database: " /usr/bin/mysql_install_db --datadir=”$datadir” --user=mysql
ret=$?
chown -R mysql:mysql “$datadir"
if [ $ret -ne 0 ] ; then
return $ret
fi
fi
chown mysql:mysql “$datadir"
chmod 0755 “$datadir”
# Pass all the options determined above, to ensure consistent behavior.
# In many cases mysqld_safe would arrive at the same conclusions anyway
# but we need to be sure.
/usr/bin/mysqld_safe --datadir=”$datadir” --socket=”$socketfile”
–log-error="$errlogfile" --pid-file="$mypidfile"
–user=mysql >/dev/null 2>&1 &
ret=$?
# Spin for a maximum of N seconds waiting for the server to come up.
# Rather than assuming we know a valid username, accept an “access
# denied” response as meaning the server is functioning.
if [ $ret -eq 0 ]; then
STARTTIMEOUT=30
while [ $STARTTIMEOUT -gt 0 ]; do
RESPONSE=/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1 && break
echo “$RESPONSE” | grep -q “Access denied for user” && break
sleep 1
let STARTTIMEOUT=${STARTTIMEOUT}-1
done
if [ $STARTTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to start MySQL Daemon."
action $"Starting $prog: " /bin/false
ret=1
else
action $"Starting $prog: " /bin/true
fi
else
action $"Starting $prog: " /bin/false
fi
[ $ret -eq 0 ] && touch /var/lock/subsys/mysqld
return $ret
}

stop(){
MYSQLPID=cat "$mypidfile" 2>/dev/null
if [ -n “$MYSQLPID” ]; then
/bin/kill “$MYSQLPID” >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
STOPTIMEOUT=60
while [ $STOPTIMEOUT -gt 0 ]; do
/bin/kill -0 “$MYSQLPID” >/dev/null 2>&1 || break
sleep 1
let STOPTIMEOUT=${STOPTIMEOUT}-1
done
if [ $STOPTIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1
action $"Stopping $prog: " /bin/false
else
rm -f /var/lock/subsys/mysqld
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
fi
else
action $"Stopping $prog: " /bin/false
fi
else
ret=1
action $"Stopping $prog: " /bin/false
fi
return $ret
}

restart(){
stop
start
}

condrestart(){
[ -e /var/lock/subsys/mysqld ] && restart || :
}

See how we were called.

case “$1” in
start)
start
;;
stop)
stop
;;
status)
status mysqld
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|condrestart|restart}"
exit 1
esac

exit $?

let me know if you need more information.

Really thank you so much for your kind help.
THANKS

You will need a password for freepbxuser, restore that file from your “last known good” backup

your command line attempts to log into mysql as [email protected] chances are there is no password for that account ubless yo set it.,

Hi yes, per dicko suggestion, remove the -p in the mysqldump command

The
/etc/init.d/mysql status

should be executed not copy pasted here.

Why did you post a copy of the init script?

I think hr meant
echo “cat /etc/init.d/mysqld status”|sed ‘s/(.) (.) (.*)/bash \2/’

Thank you for all above advices.

I am actually a newbiew for Asterisk and Linux, just start to use it few months ago. My friend who setup this is oversea which I had not idea how to do solve the issue. Thats why I dint know I actually can executed the init.d file.

I tried to remove the -p in the mysqldump command. This is what I get:-
[[email protected] ~]# mysqldump asteriskcdrdb --compact --no-data -u root
mysqldump: Got error: 145: Table ‘./asteriskcdrdb/cdr’ is marked as crashed and should be repaired when using LOCK TABLES

This system was setup not more than 3 months, so we dint do any backup yet. Thus, I cant restore any backup file.

Can anyone guide me step by step?? really sorry that I am still in learning step, need more details information.

Really appreaciate all your kind advices.

Two comments, have you heard of google yet, it will give you your answer to repairing your mysql in two seconds. Three months and no backup, you should be absolutely ashamed of yourself , start to do so immediately and continue regularly. :slight_smile:

HI Dicko,

Thank you for your comment and advices.

Just to be honest with you. If I know all those skills or I have all those knowledge. I wont doing those stupid staff. I really still not clear with whats going on with the system. All I know about this system is I can manage my phone system through web-browser interface to check my call logs, setup my queue, IVR and etc. I have no knowledge about the sql, command line and all thats. The person who setup this is one of my friend who is in oversea right now and I cant contact him. I had google my issue for many hours but still cant found the right solution.

Therefore, I really appreciate your kind advice and comment.
Once this issue solved I definitly will do all those backup.

Thank you.

Hi

Try this run
mysqlcheck -u root --check asteriskcdrdb

Then try run this
mysql -b -u root -D asteriskcdrdb -e “REPAIR TABLE cdr” -u root

Once repaired, restart mysql, run this
/etc/init.d/mysql restart

Now, show us this (in case the above still fails), run
mysqldump asteriskcdrdb --compact --no-data -u root

If you don’t encounter errors, remove the noload thingy as stated above, restart Asterisk so that it loads CDR. Make a test call and see if data is there.

Dear Sanjayws,

Thank you so much!!

You saved my day!!

It’s worked now.

Thank you. I will do the backup first and then check the voicemail issue later.
THank you… really appreciate for your advices and time.

Have a nice day.

sanjayws you save my… week.
Actually, I run out of disk space and that corrupted the CDR Database. Usually the database processor should notice that and stop processing more inserts (among other transactions) before corrupting but, mysql is not (in that sense) ‘industrial grade’.

mysql -b -u root -D asteriskcdrdb -e “REPAIR TABLE cdr” -p
Enter password:
±------------------±-------±---------±-----------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
±------------------±-------±---------±-----------------------------------------------------+
| asteriskcdrdb.cdr | repair | info | Found block that points outside data file at 3649452 |
| asteriskcdrdb.cdr | repair | status | OK |
±------------------±-------±---------±-----------------------------------------------------+
mysql -b -u root -D asteriskcdrdb -e “REPAIR TABLE cdr” -p
Enter password:
±------------------±-------±---------±---------+
| Table | Op | Msg_type | Msg_text |
±------------------±-------±---------±---------+
| asteriskcdrdb.cdr | repair | status | OK |
±------------------±-------±---------±---------+

Thanks for your guidance… Saved a lots of time