Issue with Apache2 not starting

I have installed a few Freepbx instances, but I have one that is causing me problems.

I am using a cloud hosted provider with a templated Debian 12 install. The provider is Binarylane.com.au

I bypass the actual Debian install components as this is a ready to run install. It is a base Debian with no services other than SSH server.

Before I start I apt-update and apt-dist upgrade, then install the pre-requisites
apt-get -y install net-tools htop screen tshark vim sngrep

I then run the install script commands

cd /tmp
wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh -O /tmp/sng_freepbx_debian_install.sh
bash /tmp/sng_freepbx_debian_install.sh

It went off and did its thing, then errored near the end. It failed trying to sign the modules. OK, from that point I ran fwconsole ma refreshsignatures a couple of times and that was sorted.

I then logged into the UI and activated it. I then lost touch with it remotely and had to jump onto a virtual server in the same datacentre subnet to access it again. Not sure why, but that worked, so I setup a Let’s Encrypt cert and made it default. I then went to system config / ports and applied it. It did not make the secure ports column become available, but then I lost touch again.

So I went into fwconsole sa installHttpsCert default and this applied the cert. I restarted apache2 and I could access the site from my remote location.

It is working, but I am not happy I have a good install. Every time I reboot, apache won’t start. It throws an error briefly on the console

“systemd[1]: freepbx.service: Job apache2.service/start deleted to e starting with feepbx.service/start”

I can start it with systemctl start apache manually and it is fine.

None of my other instances have these issues. I can’t figure out what the above message means and whether I am going to have ongoing issues with this instance. I have done the install process twice now. The first time I restarted the process from the beginning (new Debian OS) after the script error. The second time I did all the steps above after the script error to continue. My other installs have not had errors at all.
VM is 2 vCPU, 4Gig RAM, 60Gig HDD. I have other Debian (11) and Windows instances on this platform and I have never had issues with it in the past. I have installed many 3CX on Debian 10 and 11 as well without issues, so I don’t think it is the OS.

The only thing I will mention, even though I don’t think it iwill be the cause is that the system uses systemd-networkd and this is flagged in the Freepbx message list in the dashboard. The firewall looks happy though. The NIC is in the correct zone and my remote address is whitelisted.

Any ideas? This is a production system, so it has to be reliable. The apache2 not starting is a real problem.

Did you run the installer as root? It really sounds like with the problems that whatever user ID you ran the installer as, that it did not have full perms. Some of the cloud providers supply modded images that are almost but not entirely quite unlike tea…oops I mean Debian 12 (sorry Douglas Adams, lol)

what does journalctl say?

Anything here?

I’ll check journalctl. Good call. At 1am I wasn’t really at my best.

Yes all done as root. Running systemctl start apache2 as soon as I log in brings it straight up. It’s like a dependency issue, but the error that pops up on the console is strange.

So here is the issue from journalctl

freepbx.service: Found ordering cycle on apache2.service/start
Nov 17 00:31:08 pbx systemd[1]: freepbx.service: Found dependency on freepbx.service/start
Nov 17 00:31:08 pbx systemd[1]: freepbx.service: Job apache2.service/start deleted to break ordering cycle starting wit>
Nov 17 00:31:08 pbx systemd[1]: Queued start job for default target graphical.target.

It appears to be a dependency issue where Freepbx does not want apache to start before it.
However, in the apache2.service config file, the dependency is there.
After=network.target remote-fs.target nss-lookup.target freepbx.service

but then in freepbx.service, we have this After=apache2.service
So seems like a circular dependency. This is not giving me confidence with this install script.

Is this still the correct installation doco link?
FreePBX 17 Installation - FreePBX Open Source - Sangoma Documentation

Yes.

Go to www.freepbx.org click Getting Started at the top, click Follow Step BY Step Debian Install guide, and the link to FreePBX17 Installation in the first paragraph points to where you linked.

Check your apache2.service and freepbx.service config files with ones from a correctly running FreePBX server and see if they are the same.

I blew away the datacentre image and installed from the ISO. This allowed it to complete with no errors, so there are obviously subtle differences in the base Debian installs that upset the script.

Still have the dependency loop. Fix for that is to edit the freepbx.service file and comment out the apache dependency (after line).

A lot of the datacenters will have a package you can install if you roll your own Linux image that plug in drivers for the different monitoring, etc. that the cloud providers do.