Starting FreePBX 13.0.171 on boot on Ubuntu 14.04

Hi All

I followed this guide for the installation This all works great except I don’t know the right way to start Asterisk automatically after a reboot. I have tried lots of suggestions from googling around but nothing works for me. Has anyone else done this successfully?


I found this on “Ask Ubuntu” by Googling for “Start up services at boot on Ubuntu”. Google first result seems to be a pretty good primer.

If you have a specific question, feel free to ask.

Hi Dave

Thank you for the info, I had tried something like this before but came unstuck, tried again:-

[email protected]:/etc/init.d# update-rc.d asterisk defaults
Adding system startup for /etc/init.d/asterisk …
/etc/rc0.d/K20asterisk -> …/init.d/asterisk
/etc/rc1.d/K20asterisk -> …/init.d/asterisk
/etc/rc6.d/K20asterisk -> …/init.d/asterisk
/etc/rc2.d/S20asterisk -> …/init.d/asterisk
/etc/rc3.d/S20asterisk -> …/init.d/asterisk
/etc/rc4.d/S20asterisk -> …/init.d/asterisk
/etc/rc5.d/S20asterisk -> …/init.d/asterisk
[email protected]:/etc/init.d#

This looked good, rebooted and asterisk is running, my phones work, but I can’t make changes from FreePBX as I can do when starting asterisk manually. The error I now get when applying config is:-

Reload failed because retrieve_conf encountered an error: 1

exit: 1
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Exception: Unable to connect to Asterisk through the CLI in file /var/lib/asterisk/bin/retrieve_conf on line 43
Stack trace:

  1. Exception->() /var/lib/asterisk/bin/retrieve_conf:43
    1 error(s) occurred, you should view the notification log on the dashboard or main screen to check for more details.

Checking further “/var/run/asterisk/asterisk.ctl” does exist and is zero bytes long. Can you help?

Thank you, Chris.

Make sure bot apache 2 are running as the asterisk user

ps -aux |grep asterisk

is telltale.

Hi dicko, this gives me:-

[email protected]:~# ps -aux |grep asterisk
root 1181 0.2 4.7 1470880 48340 ? Ssl 16:25 0:37 /usr/sbin/asterisk
asterisk 1380 0.0 2.3 382544 24352 ? S 16:25 0:00 /usr/sbin/apache2 -k start
asterisk 1381 0.0 2.0 385636 20608 ? S 16:25 0:00 /usr/sbin/apache2 -k start
asterisk 1382 0.0 3.5 389828 36468 ? S 16:25 0:00 /usr/sbin/apache2 -k start
asterisk 1383 0.0 2.7 386592 27828 ? S 16:25 0:00 /usr/sbin/apache2 -k start
asterisk 1384 0.0 1.4 382324 15128 ? S 16:25 0:00 /usr/sbin/apache2 -k start
asterisk 1694 0.0 1.9 385224 19472 ? S 16:26 0:00 /usr/sbin/apache2 -k start
asterisk 1715 0.0 2.8 386064 28528 ? S 16:26 0:00 /usr/sbin/apache2 -k start
asterisk 1766 0.0 1.9 383024 20232 ? S 16:26 0:00 /usr/sbin/apache2 -k start
asterisk 1781 0.0 2.9 389024 29556 ? S 16:26 0:00 /usr/sbin/apache2 -k start
asterisk 1782 0.0 1.7 382868 17712 ? S 16:26 0:00 /usr/sbin/apache2 -k start
root 4086 0.0 0.0 10464 932 pts/2 S+ 20:07 0:00 grep --color=auto asterisk
[email protected]:~#

Does this mean asterisk is running under root and apache under user asterisk? How do I fix it?

Yes,asterisk is running as root, you should adjust /etc/default/asterisk to suit if you are starting asterisk as a service (/etc/init.d/asterisk ‘sources’ that file) .and not with amportal/fwconsole

1 Like

Found the file, uncommented these two lines:-


rebooted and I think that has fixed it, thank you sir.

It seems this method of starting asterisk has introduced a new problem, quite often I get the message “Illegal instruction (core dumped)” when connecting to asterisk, this never happened when starting asterisk manually. I understand that this may be something to do with FreePBX running on an Amazon ec2 instance, do I need to compile asterisk with different flags, like this?

[email protected]:/usr/src/asterisk-13.10.0# menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts
[email protected]:/usr/src/asterisk-13.10.0# make

I then did:-

[email protected]:/usr/src/asterisk-13.10.0# make install
[email protected]:/usr/src/asterisk-13.10.0# ldconfig

Is that correct? Do I need to do anything else?

Thanks, Chris.

Well, that shouldn’t be a problem with asterisk perhaps something else that can now connect is crashing asterisk (look in /var/log/messages and /var/log/asterisk/full at the same point in time for a clue) . . .

If you rebuild asterisk I suggest you start with ‘make clean’ and don’t forget the ‘./configure’ before ‘make menu select’

But I am not knowledgeable about ec2 so maybe someone else . . .

I did a ‘make clean’ then ‘./configure’, but this caused this:-

[email protected]:/usr/src/asterisk-13.10.0# menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts
-bash: menuselect/menuselect: No such file or directory

If I follow the procedure above instead, it compiles okay and it does appear to fix the ‘Illegal instruction’ issue. Perhaps it is not essential to ‘make clean’ and ./configure because asterisk was only very recently compiled from its source anyway? I don’t really know, just guessing. I have recovered the ec2 instance from a snapshot so it is working okay at the moment.

Thanks for your help, it is much appreciated.

Never guess it it NEVER constructive :wink:

The BUILD_NATIVE is best chosen within make menuselect (your syntax is wrong) I would also suggest it would be a bad choice to disable it , but absolutely for a clean install over a possibly broken one, you need the ‘make clean’ and ‘./configure’ is necessary at any time you have changed/added/subtracted anything with dependencies/requisites for asterisk in your OS.

I thought it would be okay because the only thing that has changed is disabling the native architecture support.
I got the syntax from here:-
In the section ‘Building for non-native architectures’ which is appropriate because this is a virtual machine and it does appear to have done the trick.

That said I will take a copy of the machine and try what you suggest.