Unable to apply configuration changes: Reload failed because retrieve_conf encountered an error: 1

Dear All,

I have followed the exact instructions written by Moshe brevda in order to restrict some extensions from making outbound calls, as stated in: http://mbrevda.blogspot.com/2008/11/restricting-outbound-calls-in-freepbx_15.html
however, when i ran the amportal command, i no longer was able to apply any changes to system, no matter what i do. I’m not good at using linux, however i tried giving 777 permission to any files i felt would help, but without any benefit. here is a log of what happens when i try to apply configuration changes:

exit: 1
Checking for PEAR DB…OK
Checking for PEAR Console::Getopt…OK
Checking for /etc/amportal.conf …OKBootstrapping /etc/amportal.conf …OK
Parsing /etc/amportal.conf …OK
Parsing /etc/asterisk/asterisk.conf …OK
Connecting to database…OK
Connecting to Asterisk manager interface…OK
Added to globals: ASTETCDIR = /etc/asterisk
Added to globals: ASTMODDIR = /usr/lib/asterisk/modules
Added to globals: ASTVARLIBDIR = /var/lib/asterisk
Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
Added to globals: ASTSPOOLDIR = /var/spool/asterisk
Added to globals: ASTRUNDIR = /var/run/asterisk
Added to globals: ASTLOGDIR = /var/log/asterisk
Added to globals: CWINUSEBUSY = true
Added to globals: AMPMGRUSER = admin
Added to globals: AMPMGRPASS = elastix456
[FATAL] Cannot write Queues configurations Failed creating/overwriting Queues extensions file: /etc/asterisk
/queues_additional.conf
1 error(s) occured, you should view the notification log on the dashboard or main screen to check for more details.

Regards,

/etc/asterisk/queues_additional.conf existed, i tried deleting it before hence,
however it didnt solve the problem. Infact, it didn’t create a new one either.
Later i created one and set permission 777 and gave root ownership
Could you enlighten me on how to exactly do it.
Thanks for your fast reply

If /etc/asterisk/queues_additional.conf exists then try to delete it, freepbx will recreate it.

if it does not exist try to create it yourself with owner and group as asterisk.

type ‘chown asterisk.asterisk queues_additional.conf’ to change the ownership of the file to the correct one.

Mickecarlsson,

I’ve applied the command mentioned, but it didn’t fix it.
I still get the same fatal error.

Delete the file, it will be created when you run retrieve_conf.
If you get the same error after deleting the file, then check that the directory /etc/asterisk is owned by asterisk (ls -l in /etc):
drwxrwxr-x 2 asterisk asterisk 4096 Dec 30 23:19 asterisk

[FATAL] Cannot write Queues configurations Failed creating/overwriting Queues extensions file: /etc/asterisk
/queues_additional.conf

the file was not created!

checking the ownership of the directory, here are some of the results:
-rwxrwxrwx 1 root root 6314 Dec 1 13:35 amportal.conf
drwxrwxrwx 2 asterisk asterisk 4096 Jan 4 11:29 asterisk
drwxr-xr-x 2 root root 4096 Dec 1 13:32 asterisk.elastix

This is getting strange. Do this:
go to /etc/asterisk
type ‘su asterisk’ so that you change the user to asterisk.
then type ‘rm queues_additional.conf’ if you get this error:
rm: cannot remove `queues_additional.conf’: No such file or directory
then we know that the file does not exist. If you get nothing back the file was deleted, if you get anything else please post it here.

Now go to /var/www/html/admin and type /var/lib/asterisk/bin/retrieve_conf
and see if you get any errors.

the remove command confirms that:

bash-3.1$ rm queues_additional.conf
rm: cannot remove `queues_additional.conf’: No such file or directory

cd var/www/html/admin
/var/lib/asterisk/bin/retrieve_conf

exit
quit
bash: command substitution: line 1: unexpected EOF while looking for matching '' bash: command substitution: line 13: syntax error: unexpected end of file bash: bad substitution: no closing "" in `queues_additional.conf’:

Checking for PEAR DB…OK
Checking for PEAR Console::Getopt…OK
Checking for /etc/amportal.conf …OK
Bootstrapping /etc/amportal.conf …OK
Parsing /etc/amportal.conf …OK
Parsing /etc/asterisk/asterisk.conf …OK
Connecting to database…OK
Connecting to Asterisk manager interface…OK
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
PHP Warning: symlink(): No such file or directory in /var/lib/asterisk/bin/ret rieve_conf on line 535
/parking_additional.inc): failed to open stream: No such file or directory in / var/www/html/admin/modules/parking/functions.inc.php on line 41
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/parking/functions.inc.php on line 42
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/parking/functions.inc.php on line 70
PHP Warning: fclose(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/parking/functions.inc.php on line 72
PHP Warning: chmod(): No such file or directory in /var/www/html/admin/modules /parking/functions.inc.php on line 73
Added to globals: ASTETCDIR = /etc/asterisk
Added to globals: ASTMODDIR = /usr/lib/asterisk/modules
Added to globals: ASTVARLIBDIR = /var/lib/asterisk
Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
Added to globals: ASTSPOOLDIR = /var/spool/asterisk
Added to globals: ASTRUNDIR = /var/run/asterisk
Added to globals: ASTLOGDIR = /var/log/asterisk
Added to globals: CWINUSEBUSY = true
Added to globals: AMPMGRUSER = admin
Added to globals: AMPMGRPASS = elastix456
/indications.conf): failed to open stream: No such file or directory in /var/ww w/html/admin/modules/core/functions.inc.php on line 3792
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3793
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fwrite(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3797
PHP Warning: fclose(): supplied argument is not a valid stream resource in /va r/www/html/admin/modules/core/functions.inc.php on line 3799
/extensions_additional.conf): failed to open stream: No such file or directory in /var/lib/asterisk/bin/retrieve_conf on line 470
/meetme_additional.conf): failed to open stream: No such file or directory in / var/lib/asterisk/bin/retrieve_conf on line 470
/sip_additional.conf): failed to open stream: No such file or directory in /var /lib/asterisk/bin/retrieve_conf on line 470
/sip_registrations.conf): failed to open stream: No such file or directory in / var/lib/asterisk/bin/retrieve_conf on line 470
/iax_additional.conf): failed to open stream: No such file or directory in /var /lib/asterisk/bin/retrieve_conf on line 470
/iax_registrations.conf): failed to open stream: No such file or directory in / var/lib/asterisk/bin/retrieve_conf on line 470
/zapata_additional.conf): failed to open stream: No such file or directory in / var/lib/asterisk/bin/retrieve_conf on line 470
/sip_general_additional.conf): failed to open stream: No such file or directory in /var/lib/asterisk/bin/retrieve_conf on line 470
/iax_general_additional.conf): failed to open stream: No such file or directory in /var/lib/asterisk/bin/retrieve_conf on line 470
/features_general_additional.conf): failed to open stream: No such file or dire ctory in /var/lib/asterisk/bin/retrieve_conf on line 470
/features_applicationmap_additional.conf): failed to open stream: No such file or directory in /var/lib/asterisk/bin/retrieve_conf on line 470
/features_featuremap_additional.conf): failed to open stream: No such file or d irectory in /var/lib/asterisk/bin/retrieve_conf on line 470
Use of uninitialized value in string eq at /var/lib/asterisk/bin/retrieve_op_co nf_from_mysql.pl line 415.
/queues_additional.conf): failed to open stream: No such file or directory in / var/lib/asterisk/bin/libfreepbx.confgen.php on line 248
[FATAL] Cannot write Queues configurations Failed creating/overwriting Queues e /queues_additional.confterisk
bash: var/www/html/admin: No such file or directory
bash: syntax error near unexpected token `newline’
exit
[[email protected] asterisk]#

I no longer have the apply changes problem now, however iam unable to make any changes to existing extensions, nor can i add new ones!!! please help

Revert the thing that you did:
Start by opening /etc/asterisk/extensions_custom.conf and REMOVE the following context:

[from-internal-restricted]
#exec /var/lib/asterisk/bin/restricted.sh

Save and do ‘amportal stop’ then amportal start.

What version of FreePBX do you run?

I already had commented the lines i’ve added by using semicolon, i removed them permanently now.
still unable to do any changes to any extensions.
adding new extension also would produce this error for voicemail, which i even didnt request to add
FATAL ERROR
Error: Trying to write null voicemail file! I refuse to contiune!

Try this: amportal stop then amportal chown then amportal start

Then type this ps aux |grep asterisk and post the outcome.

What version of FreePBX do you use?

i use FreePBX 2.4.0.0 .

these are the requested results:
[[email protected] ~]# ps aux|grep asterisk
asterisk 2398 0.7 1.6 35680 16632 ? S 08:48 3:22 /usr/sbin/httpd
asterisk 30202 0.4 1.5 34544 15580 ? S 04:02 3:19 /usr/sbin/httpd
asterisk 30203 0.4 1.6 35500 16452 ? S 04:02 3:19 /usr/sbin/httpd
asterisk 30204 0.4 1.6 35716 16652 ? S 04:02 3:22 /usr/sbin/httpd
asterisk 30205 0.4 1.6 35784 16772 ? S 04:02 3:16 /usr/sbin/httpd
asterisk 30209 0.4 1.6 35696 16668 ? S 04:02 3:19 /usr/sbin/httpd
asterisk 30210 0.4 1.6 35920 16996 ? S 04:02 3:26 /usr/sbin/httpd
asterisk 30211 0.4 1.6 35712 16680 ? S 04:02 3:18 /usr/sbin/httpd
asterisk 30212 0.4 1.5 34820 15336 ? S 04:02 3:16 /usr/sbin/httpd
root 31155 0.0 0.0 4460 528 pts/1 S 16:27 0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
asterisk 31166 1.7 0.9 25652 9516 pts/1 Sl 16:27 0:00 /usr/sbin/asterisk -f -U asterisk -G asterisk -g -c
asterisk 31232 0.0 0.0 4508 464 ? S 16:27 0:00 -bash -c cd /var/www/html/panel && /var/www/html/panel/safe_opserver &
asterisk 31233 0.0 0.1 4464 1048 ? S 16:27 0:00 sh /var/www/html/panel/safe_opserver
asterisk 31235 7.1 0.8 12240 8432 ? S 16:27 0:00 /usr/bin/perl -w /var/www/html/panel/op_server.pl
root 31241 0.0 0.0 3908 684 pts/1 R+ 16:27 0:00 grep asterisk
[[email protected] ~]#

tested to check if the chown helped, unfortunately, i got the same results

What happened here?:
{{{

cd var/www/html/admin
/var/lib/asterisk/bin/retrieve_conf

exit
quit
bash: command substitution: line 1: unexpected EOF while looking for matching '' bash: command substitution: line 13: syntax error: unexpected end of file bash: bad substitution: no closing "" in `queues_additional.conf’:
}}}

Where did you get this text?

There must be something wrong with permissions or you don’t have your FreePBX installed at /var/www/html/admin
Go to /var/www/html/admin and do an ls -l and post the outcome here

after running: retrieve_conf
there was a prompt on the screen, as if it was expecting me to enter something.
after waiting for a min, i decided to quit it
from which i got all the next outputs.

login as: root
[email protected]’s password:
Last login: Sun Jan 4 16:26:42 2009 from 192.168.100.101

Welcome to Elastix

For access to the Elastix web GUI use this URL
http://192.168.100.5

[[email protected] ~]# cd /var/www/html/admin
[[email protected] admin]# ls -l
total 376
-rw-rw-r-- 1 asterisk asterisk 0 Jan 4 14:42 cd
drwxrwxr-x 6 asterisk asterisk 4096 Dec 1 13:32 cdr
drwxrwxr-x 2 asterisk asterisk 4096 Dec 1 13:32 common
-rw-rw-r-- 1 asterisk asterisk 22391 Dec 10 2007 components.class.php
-rw-rw-r-- 1 asterisk asterisk 11413 Dec 2 2007 config.php
-rw-rw-r-- 1 asterisk asterisk 25811 Jan 13 2008 extensions.class.php
-rw-rw-r-- 1 asterisk asterisk 318 Sep 3 2007 favicon.ico
-rw-rw-r-- 1 asterisk asterisk 7439 Sep 3 2007 featurecodes.class.php
-rw-rw-r-- 1 asterisk asterisk 124492 Feb 8 2008 functions.inc.php
-rw-rw-r-- 1 asterisk asterisk 2973 Dec 5 2007 header_auth.php
-rw-rw-r-- 1 asterisk asterisk 5243 Sep 9 2007 header.php
drwxrwxr-x 10 asterisk asterisk 4096 Dec 1 13:32 i18n
drwxrwxr-x 2 asterisk asterisk 4096 Dec 1 13:32 images
-rw-rw-r-- 1 asterisk asterisk 41 Sep 3 2007 index.php
-rw-rw-r-- 1 asterisk asterisk 470 Sep 20 2007 module-builtin.xml
drwxrwxr-x 47 asterisk asterisk 4096 Dec 1 13:35 modules
-rw-rw-r-- 1 asterisk asterisk 35893 Feb 7 2008 page.modules.php
-rw-rw-r-- 1 asterisk asterisk 894 Sep 3 2007 panel.php
-rw-rw-r-- 1 asterisk asterisk 2578 Dec 6 2007 reports.php
-rw-rw-r-- 1 asterisk asterisk 5 Sep 22 05:19 version.txt
drwxrwxr-x 2 asterisk asterisk 4096 Dec 1 13:32 views
[[email protected] admin]#

Ok, the /var/lib/asterisk/bin/retrieve_conf run from /var/www/html/admin should just run, there should be no prompting whatsoever.

Try the command when logged in as root:
cd /var/www/html/admin
/var/lib/asterisk/bin/retrieve_conf --debug

This will produce a long output. Look for obvious errors in the output.

I’m sorry but no output at all
p.s : i’m logged in as root

Have you tried the ‘Windows approach’?
Reboot the machine and try it again.
If that fails, then I am sorry to say that you need to reinstall. I can’t help you more as the steps above should solve it.

Do you have a backup of the machine?

What you could try is to upgrade to FreePBX 2.5 but I can not guarantee that it will work as your system looks corrupt.