Installing freepbx 17.0.19.12 on Debian 12.7

Hello,

I have a problem after installing freepbx 17.0.19.12 on Debian 12.7 with the installation script provided on this page:
https://sangomakb.atlassian.net/wiki/spaces/FP/pages/295403538/Step+By+Step+Debian+12+Installation

No errors occur, but after restart, asterisk service is not running. I can start asterisk manually. But after reboot, the service is not running again.

While booting and in syslog, I got two messages:

apache2.service: Found ordering cycle on freepbx.service/start
apache2.service: Job freepbx.service/start deleted to break ordering cycle starting with apache2.service/start
root@pbx:# service asterisk status
 asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: inactive (dead)

I don’t know how to solve this issue.

Regards Thomas

Hi @tweyhr3156 can you please remove “freepbx.service” from After option in apache2 service file present in “/lib/systemd/system/apache2.service”.

This got fixed in the latest script.

thanks

Hi @kgupta ,
thank you for your answer. And really, it works for me. All services start as usual.
But the shutdown or reboot takes a very long time. More than 4 minutes.

Last entry in syslog before sleeping 4 minutes:

Starting systemd-journal-flush.service - Flush Journal to Persistent Storage...

But now the next Problem while accessing the Web UI after activating the pbx:

Whoops \ Exception \ ErrorException (E_ERROR)
Allowed memory size of 536870912 bytes exhausted (tried to allocate 1281717103 bytes)
PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 1281717103 bytes) in /var/www/html/admin/modules/sysadmin/functions.inc/Ioncube.php on line 22

I changed memory_limit in /etc/php/8.2/mods-available/freepbx.ini from 512MB to 1500MB and reboot.

Apache service is up, but I cannot access Web UI. After restart apache2 service, I can access Web UI until reboot.
Restapps-Daemon is down and can be started with fwconsole start restapps

Regards
Thomas

yes for slow shutdown we have github issue present to debug.

for memory issue, if you restart apache2 then does that fix ? We had similar issue in the past where apache2 / freepbx both were trying to start at the same time causing this issue.

yes, when I restart apache2 and restapps-Daemon, both are working.

Is there a solution for this problem?
Starting the Apache service manually every time is not nice :frowning:

This bug has still not been fixed. I did a fresh install of FreePBX 17 on Debian 12.7 today and after the reboot the webserver did not come up with an error from ioncube.php saying “Allowed memory size of 536870912 bytes exhausted (tried to allocate 1281717103 bytes)”

In /lib/systemd/system/freepbx.service the “After=apache2.service” was already present
In /lib/systemd/system/apache2.service there is no After=freepbx.service” present that I can remove

After restarting Apache2 the webinterface works. It also doesn’t make much sense that it complains about not enough memory, the system has 8GB RAM and 5GB swap, surely that should be enough to start the webinterface on a fresh system with 0 configured users or clients.

PS: many other threads about this issue have unfortunately already been closed, those auto-closing threads here are really a horrible idea… Not all issues are permanently resolved in 30 days.

Just fyi -

2 Likes

I can confirm that I am also seeing this issue. Latest Debian and FreePBX fully patched. First I tried to up the memory_limit in /etc/php/8.2/apache2/php.ini to 1024 and then “systemctl restart apache2” and that worked. Then I rebooted and got the error again so I upped it to 2048 and restarted apache2, that worked until the 3rd reboot. I realized that it wasn’t me changing the memory that was fixing it, it was just restarting apache2. I set the php.ini back to its default of 128MB and it works fine until I restart it. All I need to do is restart apache2 and it seems to “fix” it.

started my own topic before I found this issue that I’m also having.

@kgupta posted a fix in the following github issue: [bug]: Apache2 is failing due to memory issue on reboot · Issue #496 · FreePBX/issue-tracker · GitHub

Check it out it fixed my issue as well.

1 Like

Thanks for the solution :slight_smile:

I can confirm this on the latest install script (Nov 12, 2024).

I did a fresh install yesterday and didn’t touch anything except creating 2 extensions.

There are two issue at the moment:

  1. apache2 won’t start after system boot: ordering cycle issue mentioned above solved by removing dependencies in freepbx.service
  2. rebooting/shutdown takes a very long time (2-3 minutes)
1 Like

Just updating my findings.
I wiped a machine and installed Debian new per the FreePBX website. Then I ran the new script and it errored out. I typed in the last command it tried to run (fwconsole ma upgradeall) and it seemed to run ok. I then ran “bash /tmp/sng_freepbx_debian_install.sh” again and it seemed to complete with the FreePBX logo on the console. However, apache2 is not serving up pages. In Chrome I get “This page can’t be reached”. If I go into the console and type “systemctl restart apache2” and then I get the web GUI.

-----edit-----
OK after installing the new script today I still had to go into /lib/systemd/system/freepbx.service and delete the line “After:apache2”. Rebooted and the GUI came up without having to do anything else.

1 Like

Need to build/release new “freepbx 17” rpm , after that this step would not be required.

Thanks

1 Like

Looks like exactly the issue I have been wrestling with for a couple of days. Definitely seemed like a race condition.

Making the changes as described on github above seems to have resolved the problem. Thanks.

Is this fix going to be pushed out to current version 17 servers?

You mean a .deb file right? Since this is Debian and RPM’s are for CentOS/RHEL. It’s a bit worrisome when things like this are being confused by the developers.

2 Likes

Yes sorry for the typo, CentOS is still alive somewhere in my mind :slight_smile:

1 Like

I just installed a new FreePBX 17 install two days ago and am having this same issue. Has the install script not been updated yet?

I removed the “After:apache2” in freepbx.service, but that didn’t fix the issue. I see in the bug report that I need to add “After=freepbx.service” in the apache2 service file. I didn’t try that yet, hopefully that will help.

It sure took google awhile before it found this thread for me. :neutral_face: :grinning:

On a fresh install of deb 12.8, and the latest git install script moments ago, this bug still exists.

Issue:

This site can’t be reached.

  • This is because the FreePBX developers have created a circular dependency between apache2.service and freePBX.service and have not fixed it (even though it’s been mentioned in this thread that this was fixed).

SOLUTION:
Edit: /lib/systemd/system/freepbx.service, and comment out the line:
#After=apache2.service

root@voip:~# cat /lib/systemd/system/freepbx.service
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
#After=apache2.service
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop

[Install]
WantedBy=multi-user.target

YET ANOTHER REASON TO HATE “systemd”
systemd is a cancer that plagues modern linux.

–
Out the 802.11, through the Cat6e, past the open-wrt, down the cable modem, over the fiber line, off the i-net peer,… nothing but NET.