Can't copy and save /var/lib/asterisk/bin/amportal


I am running into this error after an upgrade:

file /usr/sbin/amportal missing

So I ran:

cp /usr/local/sbin/amportal /var/lib/asterisk/bin/amportal

And then when I reload the amportal (amportal a reload)
I get the error:

Fetching FreePBX settings with gen_amp_conf.php..

Error(s) have occured, the following is the retrieve_conf output:
exit: -1

And /var/lib/asterisk/bin/amportal becomes an empty file. I cannot seem to properly copy it and it stays even after a restart.

Any advice is appreciated.



Unless you are running a very old version, amportal is deprecated and has been replaced by fwconsole…

Every call to amportal is actually forwarded to fwconsole…

Also, is it under /usr/sbin/amportal or /usr/local/sbin/amportal on your system? You mention that /usr/sbin/amportal is missing but then you copy /usr/local/sbin/amportal to /var/lib/asterisk/bin/amportal (my guess is that you wanted the exact reverse of what you did…).

I believe you followed the suggestion given in the link in that post

which was not the right fix…

Also,/usr/sbin/amportal, at least on FreePBX 14 distro but most likely at least a few earlier versions as well, is a symbolic link to /var/lib/asterisk/bin/amportal not the other way around and you don’t want to copy it but actually do a symbolic link to it.


ln -s /var/lib/asterisk/bin/amportal /usr/sbin/amportal

(I assumed here /usr/sbin/ is the right path…)

Could you please give more info about what you are running, which FreePBX version and which Linux distro you are running? Missing files makes me think that rounded down it has something to do with 3… :wink:

Good luck and have a nice day!



Firstly, thanks very much for taking the time out to respond to my question. I am running:

PBX Firmware: 6.12.65-32
PBX Service Pack:

Yes this was a very old version being upgraded. I used the module to upgrade for the most part.

/usr/sbin/amportal does not exist, /usr/local/sbin/amportal does.

I ran this per your advice:

[[email protected] ~]# ln -s /var/lib/asterisk/bin/amportal /usr/local/sbin/amportal
ln: creating symbolic link `/usr/local/sbin/amportal’: File exists

amportal still works by me, not fwconsole, and I can’t seem to properly upgrade past where I am, or uograde any modules (it takes me to a broken page when I click process updates) so I am sort of stuck in this upgrade.



FreePBX 12 distro?

You seem to be at the latest version, to move past that would require to run the scripts that gets you to FreePBX 13…

Which file is it complaining is missing, /usr/sbin/amportal or /usr/local/sbin/amportal?

If it is /usr/sbin/amportal than could you please type the command I gave you previously without modifying the path.


ln -s /var/lib/asterisk/bin/amportal /usr/sbin/amportal

Let’s see if that fixes things somewhat…

If it doesn’t can you take screenshots or pictures of what you see so that we have a better idea of what is wrong with your system?

Good luck and have a nice day!


Hi Marbled! You are too nice!

This is what happened when I do that:

[[email protected] ~]# ln -s /var/lib/asterisk/bin/amportal /usr/sbin/amportal
ln: creating symbolic link `/usr/sbin/amportal': File exists

If you really want to see all my errors – here they are:

I get rotating errors when reloading:

[[email protected] ~]# amportal a reload

Fetching FreePBX settings with gen_amp_conf.php..

Error(s) have occured, the following is the retrieve_conf output:
exit: 255
PHP Fatal error:  Uncaught exception 'Exception' with message 'Unable to start GPG, the command was: [/usr/bin/gpg --homedir /home/asterisk/.gnupg --no-permission-warning --keyserver-options auto-key-retrieve=true,timeout=5 --status-fd 3 --list-keys 2016349F5BC6F49340FCCAF99F9169F4B33B4659]' in /var/www/html/admin/libraries/BMO/GPG.class.php:354
Stack trace:
#0 /var/www/html/admin/libraries/BMO/GPG.class.php(190): GPG->runGPG('--list-keys 201...')
#1 /var/www/html/admin/libraries/BMO/GPG.class.php(249): GPG->getKey()
#2 /var/lib/asterisk/bin/retrieve_conf(23): GPG->trustFreePBX()
#3 {main}
  thrown in /var/www/html/admin/libraries/BMO/GPG.class.php on line 354


[[email protected] ~]# amportal a reload

Fetching FreePBX settings with gen_amp_conf.php..

Error(s) have occured, the following is the retrieve_conf output:
exit: -1

and when i try to “check online” for upgrades to the modules, it spins for a bit until I get an ERR_EMPTY_RESPONSE broken page

Here’s my GUI home page, it’s pretty mad at me:

This is the tampered file error:

Basically my freepbx is not happy :frowning: but the phones (incoming and outgoing calls) do not seem upset about all this red.

Basically I was on a really old version, so I purchased the upgrade module (because we had a hack and I wanted better security), and had it go as far as it go in one click and this is basically where ive been since more or less.

I really appreciate your time, and I imagine this may be a beast. So I’m just trying to work through one error at a time.



OK, so the file is present now…

It might not be a symbolic link like it is probably supposed to be but something is there…

Let’s focus on the rest…

Something is very much broken with your GPG…

That’s why you are getting all those tampered files/signatures problem…

I belive someone had a very similar problem a day or two ago, let me find the thread…

Good luck and have a nice day!



Which upgrade module? There are free solutions to upgrade from like FreePBX 2.something to current so what are you talking about?

Good luck and have a nice day!


I used the system admin pro, where you don’t have to do each upgrade at a time but instead i just clicked the latest available upgrade from the list.


I have not always been very lucky with this but I understand why you used it considering how many updates you had to do…

OK, since the most visible problem right now appears to be with gpg, can you try this:

su asterisk
/usr/bin/gpg --homedir /home/asterisk/.gnupg --no-permission-warning --keyserver-options auto-key-retrieve=true,timeout=5 --list-keys 2016349F5BC6F49340FCCAF99F9169F4B33B4659

Can you please post the output of this?

I am hoping we will get some error message out of this (permission problem, missing executable, etc…)…

Good luck and have a nice day!


[[email protected] ~]# su asterisk
[[email protected] root]$ /usr/bin/gpg --homedir /home/asterisk/.gnupg --no-permission-warning --keyserver-options auto-key-retrieve=true,timeout=5 --list-keys 2016349F5BC6F49340FCCAF99F9169F4B33B4659
pub   4096R/B33B4659 2014-04-30
uid                  FreePBX Module Signing (This is the master key to sign FreePBX Modules) <[email protected]>
sub   4096R/5C2FE148 2014-04-30

Did I do this right?

Thanks again Nick! You’re a pro at this!


As far as I can tell you did but I was expecting to see an error message of some kind, something that would help figure out what is happening…

Unfortunately that didn’t give us much to go on…

You are welcome and I wish I was… I am usually pretty good at debugging things even when I don’t know how the whole thing works but I was really hoping we would get a clue as to what is wrong by executing that command manually…

There is a difference between what the code runs and what I had you do, the output of the command is redirected into a file descriptor opened by FreePBX most likely to parse it something we could not do from the command line…

Out of curiosity, did you try doing

amportal ma refreshsignatures

in the attempts to fix you did earlier?

I am pretty sure I read about a similar problem recently but can’t seem to find it…

Good luck and have a nice day!


between your cp and ln then to see what’s actually there

find /usr -type f \( -name "amportal" -o -name "fwconsole" \) -exec ls -l {} \;

notice the size, if one is 0 than you probably did it wrong, you can “ln -f” to overwrite a file if you are sure that that would b a “good thing”

[[email protected] ~]# amportal ma refreshsignatures

Fetching FreePBX settings with gen_amp_conf.php…

-------------FreePBX Control Script-----------------------------------------------

Usage: amportal start|stop|restart|kill|chown

start: Starts Asterisk and Flash Operator Panel server if enabled
stop: Gracefully stops Asterisk
restart: Stop and Starts
kill: Kills Asterisk
chown: Sets appropriate permissions on files

I am pretty sure I was able to refresh some other way before.

[[email protected] ~]# find /usr -type f \( -name "amportal" -o -name "fwconsole" \) -exec ls -l {} \;
-rw-r--r-- 1 root root 2428 Mar 19  2015 /usr/src/freepbx-12.0.45/amp_conf/bin/amportal
-rwxr-xr-x 1 root root 2428 Mar 19  2015 /usr/src/freepbx-12.0.45/amp_conf/sbin/amportal
-rw-r--r-- 1 root root 2428 Mar 19  2015 /usr/src/freepbx-12.0.45/amp_conf/htdocs/admin/modules/framework/amp_conf/bin/amportal
-rwxr-xr-x 1 root root 2428 Mar 19  2015 /usr/src/freepbx-12.0.45/amp_conf/htdocs/admin/modules/framework/amp_conf/sbin/amportal
-rwxr-xr-x 1 root root 2226 Oct  1  2014 /usr/src/freepbx-
-rwxr-xr-x 1 root root 2226 Oct  1  2014 /usr/src/freepbx-
-rwxr-xr-x 1 asterisk asterisk 2428 Sep  2 16:07 /usr/local/sbin/amportal

I am not sure where I see the size here. And they all look like files that haven’t been touched in a while…

Thanks everyone!!

the size is the 5th column (be careful of fifth columnists ! :-))

that show us that you installed freepbx 2.11 from source and then upgraded to FreePBX 12 also from source , chances are that you need to ignore the signatures in the advanced settings, and when you try go to FreePBX 13 then likely fwconsole will appear, but be careful how you do it as any “commercial but free”. modules might well eff you up.

It would also help us all if you stated what OS you are using.

Thanks! So should I follow these instructions even though I cannot upgrade modules at this time through the GUI?

I’m on linux maybe?! It’s a hosted PBX in the cloud.

Well I usually just

amportal a ma upgradeall
amportal a ma download versionupgrade
amportal a ma install versionupgrade
amportal a r

then go to modules admin and run the “12 to 13 upgrade tool”

Unable to install module announcement:
 - FreePBX version or higher is required, you have 13.0.0alpha1
chmod: cannot access `/var/log/prosody': No such file or directory
Removing any dangling symlinks
Dangling symlinks removed
    [[email protected] ~]# amportal a ma install versionupgrade

    Fetching FreePBX settings with gen_amp_conf.php..

    Unable to install module versionupgrade:
     - FreePBX version or higher is required, you have 13.0.0alpha1

PBX Upgrader Stable Sangoma Technologies Corporation Commercial Not Installed (Locally available:
Publisher: Sangoma Technologies Corporation
License: Commercial
Description: Fully automates and upgrades the PBX to the next major release for free.
More info: Get help for PBX Upgrader
Missing Requirements:
FreePBX version or higher is required, you have 13.0.0alpha1
Track: Stable
Action: No Action

Everything is so buggy!! At leaaast the phones work lol!

My guess is you forgot the

amportal a ma download versionupgrade



Well you seemto already have FreePBX 13, but not apparently fwconsole I am out of suggestions if th\e upgradeall didn’t work.