Error when running retrieve_conf

I’m having a little issue here, can’t get FreePBX to reload configuration. Here’s the error from the web interface:
exit: 126
sh: /var/lib/asterisk/bin/retrieve_conf: Permission denied

when I try running retrieve_conf from the console, I get this:
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
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 = /usr/share/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 = amp111
Name “main::numbuttonsx” used only once: possible typo at /var/lib/asterisk/bin/retrieve_op_conf_from_mysql.pl line 44.
Please update your modules and reload Asterisk by visiting http://192.168.0.105/admin

I’ve updated the modules, but that’s not getting me further than this. Any ideas?

There is some details missing that would help. OS, FreePBX and asterisk versions please? If you used a distro to build who,s and what version, of hand build which directions did you use (URL) please.

“/var/lib/asterisk/bin/retrieve_conf: Permission denied” Means that the the permissions needed are not set as expected and the operation was denied. If for example you didn’t setup the group and user rights correctly.

Frist off try and run amportal chown
this will reset the permissions the way we expect them to be. next do a amportal restart so that things are stopped and restarted with the right user rights.

Then let’s see based on the info you provide if that fixed the issue or where to go from here.

os - fedora 10 (downloaded Sunday)
FreePBX was just downloaded from the site as well - 2.5.0.1
asterisk should be 1.6 something (I’m not sitting in front of it right now)

I’ve rebooted a number of times
I’ve done the amportal chown a number of times with no effect
I’ve run amportal stop and everything looks like it shuts down fine, but I do get a bit of a weird message, something like asterisk.ctl might not exist, but I’ve checked and it does.
I’ve run amportal start and everything seems to start fine.

is there another method I should use to change permissions?

which set of directions did you use to build the box? httpd is running under the user asterisk? If not what user and group permissions did you setup.

The error is a classic issue of somebody not setting up the permissions the way asterisk expects them to be set. For FreePBX to work properly asterisk needs to be setup correctly with the proper ownership and group permissions.

Just reloaded everything and got it working right this time. Thanks for your help - it was vital to getting it working.

looks like it was an issue with either selinux or forgetting to chown asterisk /var/lib/php/sessions

After A fresh install of FreePBX on CentOS 5.4 I accidentally forgot to disable SELINUX. After 20 min of double checking config files and reseting file permissions the FreePBX was still unable to connect. Then I checked my SELINUX settings and sure enough it was enabled. This would explain why FreePBX was unable to access the config file.

So in conclusion, try the following if FreePBX is not connecting to asterisk

  1. Make Sure SELINUX is disabled (SELINUX=DISABLED in /etc/selinux/config) reboot after changing.
  2. Make Sure all file permissions are set correctly (run the “amportal chown” command)
  3. Check your /etc/hosts file and make sure that localhost is part of the definition (127.0.0.1 localhost)

Hope this helps!

I had the same problem, restarted, upgraded and nothing seem to help. Here is what I did:

  1. changed the shell for apache to /sbin/bash

[root@asterisk html]# su - apache
-bash-3.2$ /var/lib/asterisk/bin/retrieve_conf
-bash: /var/lib/asterisk/bin/retrieve_conf: Permission denied
-bash-3.2$ cd /var/lib/asterisk/
-bash: cd: /var/lib/asterisk/: Permission denied
-bash-3.2$ cd /var/lib
-bash-3.2$ ls

  1. directory /var/lib/apache is the culprit -> permissions

drwx-w---- 11 asterisk asterisk 4096 Dec 8 10:39 asterisk

  1. Looks right, but returns permission denied also me (apache) is in the asterisk group.

-bash-3.2$ id
uid=48(apache) gid=48(apache) groups=48(apache),101(asterisk)

  1. changed permissions to 770 and it worked:

drwxrwx— 11 asterisk asterisk 4096 Dec 8 10:39 asterisk

Wow,

I just spent 2 hours trying everything, from chmods to Apache’ usernames. None of it worked, that is , until I tried your simple instructions on the SELINUX disabling.

Boom…I’m in business. SELINUX was definitely the culprit on that one.

Wow,

I just spent 2 hours trying everything, from chmods to Apache’ usernames. None of it worked, that is , until I tried your simple instructions on the SELINUX disabling.

Boom…I’m in business. SELINUX was definitely the culprit on that one.