retrieve_Conf failed, config not appied

Since upgrading one of my systems from 2.9beta1.10 to 2.9beta2.0 and now beta2.1, I am getting this error in the freepbx.log file:

[2011-Mar-08 21:58:19] [PHP-NOTICE] (/var/www/html/admin/modules/customcontexts/functions.inc.php:51) - Undefined variable: results
[2011-Mar-08 21:58:19] [CRITICAL] (admin/functions.inc.php:234) - [NOTIFICATION]-[freepbx]-[RCONFFAIL] - retrieve_conf failed, config not applied
[2011-Mar-08 21:58:19] [PHP-NOTICE] (/var/www/html/admin/libraries/gui_auth.php:49) - Constant FREEPBX_IS_AUTH already defined
[2011-Mar-08 21:58:20] [PHP-NOTICE] (/var/www/html/admin/modules/paging/functions.inc.php:102) - Undefined variable: vxml_url

and the orange reload area says:
Reload failed because retrieve_conf encountered an error: 255
However, that spot doesn’t give an error everything listed looks fine.

Sorry I’ve been out for a few days, but getting back to this. I have tried running retrieve_conf with a debug flag, reading through it I think this works, but it doesn’t give anything different, and I enabled POST_RELOAD Debug Mode in the advanced settings, but neither have given anything beyond what I was getting. Where should I the dbug() statements? The odd thing is that everything seems to be working ok, new modules are getting added and nothing has changed as far as the phones.

This problem was fixed by downloading the source, and doing an install-amp --force-version=2.8, then updating. Still don’t know what the problem was, but it is fixed now.

I have gotten down to the one error prior to it giving the failed notice:

[2011-Apr-08 08:48:50] [PHP-NOTICE] (/var/www/html/admin/modules/customcontexts/functions.inc.php:51) - Undefined variable: results

I have turned on devel debuging in Advanced Settings, but don’t know where I should be putting debug tags, or what they look like to get at what I’m looking for. I’m pretty novice to php.

that PHP error is likely harmless. Not to say we don’t try to fix all reported undefined variable warnings when they are reported in tickets since occasionally one is a real error, but … I’m guess that is not related to any issues.

You can disable the custom context module though to see if the problem goes away, Disabling a module will never remove any of it’s data, it will simply result in the module not running (and thus any of the configuration it would normally do not being generated of course).

As far as dbug() statements, you can simply put in the code where ever appropriate:

dbug("I am here");

or you can put in a variable to see what it’s output is. Saying where to put it is a difficult thing to describe and involves looking through and understanding the code at least at some basic level. In general, you are somewhat doing trial and error to see how far your dbug() statements get until they suddenly are not printed because the script apparently ends/crashes just prior to that point and the last place you put one in.

You’re right, the PHP-notice goes away when the custom contexts is disabled, but this doesn’t fix the problem. I have found that the last thing in the freepbx.log file prior to the error is

[2011-Mar-08 21:57:21] [INFO] (core/functions.inc.php:1576) - Added to globals: MIXMON_DIR =

and then the Orange window shows:

exit 255
Added to globals: ASTETCDIR = /etc/asterisk

So this seems to be a cutoff point. In examining functions.inc.php, it seems that it doesn’t run these in order, so I am having a tough time trying to get at where to look.

that comes from core’s core_get_config() function, which is the last one to be run.

so the question is, does it get past that loop in retreive_conf and fail somewhere further down, or does it die somewhere in core but is not being reported.

I am purely guessing at things to do to figure that out, but in looking at that function, is there a reason the version_compare entries don’t have anything for asterisk 1.8?

I’m sure there is a better way to do this, but I put a
print(“LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL”);
as the first line of that function, and now I get the exit 255 then the line of L’s in the Orange window, then the rest of the Added to Globals. So it looks like it is erroring out before it get’s to that point.

The error

Unable to connect to Asterisk Manager from indicates that your asterisk manager credentials have gotten hosed.

The manager credentials in /etc/asterisk/manager.conf and /etc/amportal.conf must match.

exit: 1
Mon, 16 May 2011 20:55:18 -0700 - Failed to login.

[FATAL] Unable to connect to Asterisk Manager from /var/lib/asterisk/bin/retrieve_conf, aborting
1 error(s) occurred, you should view the notification log on the dashboard or main screen to check for more details.

Close Retry
FreePBX 2.9.0.2 on 192.168.0.30Admin Reports Panel Recordings Help
Apply Configuration ChangesLogged in: k6biv (Logout)
Setup Tools
Admin
FreePBX System Status
Module Admin
Basic
SIPSTATION
DAHDi
Extensions
Fax Configuration
Feature Codes
General Settings
Outbound Routes
Trunks
Voicemail Admin
Extension Settings
Administrators
Inbound Call Control
Inbound Routes
Zap Channel DIDs
Announcements
Blacklist
Call Flow Control
CallerID Lookup Sources
Directory
Follow Me
IVR
Queue Priorities
Queues
Ring Groups
Time Conditions
Time Groups
Internal Options & Configuration
Callback
Conferences
DISA
Languages
Misc Applications
Misc Destinations
Music on Hold
PIN Sets
Paging and Intercom
Parking Lot
Phone Restart
System Recordings
Voicemail Blasting
Third Party Addon
Custom Contexts
Set CallerID

FreePBX System Status

FreePBX Notices
retrieve_conf failed, config not applied
Reload failed because retrieve_conf encountered an error: 1
Added 1 minute ago
(freepbx.RCONFFAIL)
show new
FreePBX Statistics
Total active calls0
Internal calls0
External calls0
Total active channels0
FreePBX Connections

Uptime

System Uptime: 14 minutes
Asterisk Uptime: 0 minutes
Last Reload: 0 minutes
System Statistics
Processor

Load Average0.01
CPU0%
Memory

App Memory12%
Swap0%
Disks

/11%
/boot10%
/dev/shm0%
Networks

eth0 receive0.27 KB/s
eth0 transmit0.52 KB/s
Server Status
AsteriskERROR
Op PanelOK
MySQLOK
Web ServerOK
SSH ServerOK

Let Freedom Ring™
FreePBX is a registered trademark of Bandwidth.com
FreePBX 2.9.0.2 is licensed under GPL

Assuming a standard install:

<?php
$amp_conf['AMPDBUSER']  = 'db_user';
$amp_conf['AMPDBPASS']  = 'db_pass';
$amp_conf['AMPDBHOST']  = 'localhost';
$amp_conf['AMPDBNAME']  = 'asterisk';
$amp_conf['AMPDBENGINE'] = 'mysql';
$amp_conf['datasource'] = ''; //for sqlite3
require_once('/var/www/html/admin/bootstrap.php');

It appears that my /etc/freepbx.conf was corrupted in the upgrade. So, how do I recreate the freepbx.conf? I can see some routines in /var/www/html/admin/utilities/freepbx.conf.class.php that would be useful. Is there a simple way to call them?

My retrieve_conf dies immediately with:

Sun, 20 Mar 2011 15:19:06 -0400 - Unable to connect to manager localhost:5038 (0):
[FATAL] Unable to connect to Asterisk Manager from /var/lib/asterisk/bin/retrieve_conf, aborting

Netstat show that the manger is up on 5038. I can telnet into 5038 - however, I don’t know its protocol to get anything useful.

Suggestions? I commented out the check to see if problems would occur later and get the following additional information:
found language dir fr for directory, not installed on system, skipping
sh: /usr/sbin/dahdi_genconf: No such file or directory
sh: /usr/sbin/dahdi_scan: No such file or directory
sh: /usr/sbin/dahdi_cfg: No such file or directory
not writablesh: asterisk: command not found
[FATAL] retreive_conf failed to get engine information and cannot configure up a softwitch with out it. Error: ERROR-UNABLE-TO-PARSE

which shows that “asterisk” is in /usr/sbin. “asterisk -V” shows
Asterisk 1.4.22-4 .

/proc/version: Linux version 2.6.18-128.1.10.el5
php -v: 5.2.5

Jack

yeah I think I took out a bunch of the debugs that were being printed when I updated all the logging facilities.

Placing the dbugs is really a matter of trial and error trying to determine how far down it is getting before failing so you can narrow it dow to where it is failing.

hmm,

the only explicit 255 exit is towards the top and that should print out a message first.

You many need to start to put a few debug statements in that file while running it manually each time to see how far it is really getting and try to track down where/who is making it exit like that.

you can either toss in explicit dbug() statements which will send it to the freepbx debug log. Or you can put in out() statements (or just echo) to output it directly. It’s a bit of ‘intelligent’ trial by error to try and track it down and find out why i it failing. (I’m pretty sure the debug flag to retrieve_conf had most of it’s debug statements removed so probably not worth trying that…)

That gives 255, same error number that the orange box shows.

after running from the command line, check the bash return code:

echo $?

see what that says, make sure it is not silently passing back an error.

I can’t speak for sure wrt to the customcontext undefined but the other undefined variables are harmless (though I think I already addressed them none the less)

have you tried running retreive_conf from the linux command line:

sudo -u asterisk /var/lib/asterisk/bin/retrieve_conf

and seeing if there is more useful information?

From the command line it looks like everything completes correctly, at least it doesn’t show any errors. The log file still shows the undefined variables, but not the [critical] line. However when I go to the web page, it still shows the orange bar, and when I hit that, it runs through, throws the error there and when I look at the log, it shows the [critical] line again. I have tried clearing my internet files and I get the same. Also, looking at one of my other systems, they don’t show the undefined variables. I’d been wondering how to run that from command line, so thank you for that.