Apache fails to start at boot.

I find that on every boot Apache fails to start complaining that it cannot bind to the correct ip/port. Now I use Network Manager and run Network-Manager-wait-online so I thought that Apache should not start until the network is up but that I suspect is not happening. It starts fine as soon as my PC has completed the boot process and the network is up.

Can anyone suggest how I sort this out please?


Are you using wireless?
NetworkManager defaults to creating a “user connection”, which will only be established when the user logs in, i.e. much too late for Apache (and not even Network-Manager-wait-online will help as it will just time out).

If that’s the case, go into the connection settings and change it to a “system connection” (option “Allow other users to connect”), and make sure the password is saved system-wide (there should be a disk symbol in the password text entry field, clicking on it will allow you to configure where the password is stored).
Then it should connect during boot already before any user logs in, and Apache should start fine.

Or use wicked and not Network Manager. Which looks appropriate to me for an Apache server.

Agreed, but lots of us webdeveloppers run apache locally on a laptop. Using what wolfi describes.

Thanks for the updates. Firstly this is a hard wired connection on a desktop, and yes it is a test server for my live website hosted elsewhere.

The connection is already set as any user and there is no password (obviously), so I would have expected it to come up prior to the user login. Samba starts OK on boot.

I use Network Manager as that is what I’ve always used. Initially on first TW install wicked was used but not knowing it I switched, I suppose I should have not been lazy but my view was better the devil you know. It seems like only Apache fails to start because it cannot connect. Apart from a switch to wicked what else should I try?


I’ve just changed to wicked but I now remember why I dislike it, I have no systray widget to allow me to control the connection and have been unable to find anything. I like to be able to just click on the systray item and disconnect sometimes rather than jumping through hoops to do this. So either I need the systray item or I need to go back to Network Manager. I’ve not yet tried the re-boot with wicked to see if Apache starts. I’ll try that later.


When using Network Manager,
The network connection by default will always be initiated only <after> a User logs on (ie when you enter your Username/Password).
Since system services including Apache like to start up when the system boots and not wait for when a User logs on, you need to open the Network Connection in Network Manager and check the box to enable the network connection to be made on system boot.


Not in the case of wired Ethernet though. (and actually for any connection marked as “Allow all users to connect” as long as a possibly needed password is not stored in the user’s config)

I had a quick look and apache does wait for network.target to be reached.
You may try to change that to “network-online.target” in /usr/lib/systemd/system/apache2.service, that should wait for the network connection to actually become active.
Better copy the file to /etc/systemd/system/ though and change it there, as otherwise updates would revert your change.

I will carry on the be stubborn. So please ignore me.

Of course there is no widget to “control the connection”. Such widgets belong to the end-user’s GUI. And it is not normal for an end-user to check the connection. The connection is just there. Like the memory is there, like the CPU is there, etc. None of his/her business.

It is only the poor fellow that has a walk around system that has to connect to what is available in forlorn places that has to make/check/etc. connections as end-user, because the system administrator is not there. That is the situation where things like Network Manager are invented for. Not for stable computer room or desctop systems that are connected to the same network (cable or wireless) all the time.

End of very personal meaning :wink:

@hcvv I understand what you say, however for me I do need sometimes to disable the lan and dont want to climb under the desk to pull the plug, or risk pulling the wrong plug from the router. So I need a widget which allows me control. I think the option should be available in wicked even if you have to install it later.

@wolfi323 I tried that but still it does not start. At least not if I copy the file to /etc/systemd/system. I’ll try editing the original and see if it works.


Well that failed as well. So that change to network-online.target does not fix this issue. Anyone got any ideas? I’m sure that when I first installed TW Apache2 used to start on boot and that was with Netwrok Manager as I changed to that very early on after the initial install.


Ok, then try to increase the NM_ONLINE_TIMEOUT value in /etc/sysconfig/network/config.
The default is 0, which means do not wait for the connections to be up.

Though 0 does work fine here (also wired Ethernet with NetworkManager).

I checked my value for NM_ONLINE_TIMEOUT and it is already 30 which the comments on my system say is the default. I am loathed to increase it especially if it is seconds as it may slow down booting.


I have just rebooted having set NM_ONLINE_TIMEOUT to 40 (was 30) and now Apache starts on boot… Only thing is 40 seconds does seem to be an awful long time in processing time!


Just had to reboot again and this time Apache did NOT start this time :open_mouth: So now do I increase the timeout once more? The strnage thing is that after the previous boot where it did start I ran systemd-analyze blame and nothing too more that 34 seconds and that was udev all the other stuff was much faster. This time the slowest was the udev thing but at 13 seconds!

In the Yast etc/sysconfig editor there is an APACHE_START_TIMEOUT under WWW APACHE2 so as a test I have increased this from 2 to 5 to see if it makes a difference.


Well changing that APACHE_START_TIMEOUT made no difference. Apache still will not start. The systemd-analyze blame this time was just as fast but strangely NetWorkManager-wait-online did not show up. So I disabled it and enabled it again and will see if this makes a difference.


Well Apache simply refuses to start. I can see in the journal on the last boot that it started at 16:52:43 and failed at 16:52:44, the NetworkManager started at at 16:52:40 but network complete did not happen until 16:52:48 and that explains why Apache wont start as it cannot connect until after the network completes. Something has changed I feel somewhere as this did not happen when I first installed Tumbleweed and prior to that it worked on Leap 42.1 on this desktop PC. NetworkManager-wait-online does not show up still in systemd-analyze blame although I did enable it.

Anyone any ideas?


Whenever a service fails to start, you should always run the following which will include among other things a snippet of the system log that is likely related to the failure

systemctl status *service*

So, in your case likely

systemctl status apache2.service

If you don’t know how to analyze the output, post to these Forums so all can view.


I did that and mentioned earlier that it is unable to get the ip/port to monitor because the network is NOT up yet. If you read the whole thread you will get the picture of what I have said all along and been trying to resolve.

As far as NetworkManager-wait-online is concerned the status shows nothing as by the time the system is up it has always finished. I suspect in my case it is not even starting because I can find nothing about it in either systemd-analyze blame or the journal, what I can see in the journal is Apache starting and terminating before the network manager has completed and got the network up and running.


You did not post the output.
Do you really know how to interpret the output?
Remember, in computing it’s not enough to say that something didn’t work, the <specific error> can provide a hint at exactly what the problem is.
So, for instance it’s not enough to merely say that networking isn’t available when the service attempts to start, did something fail that led to that condition?

And, if you’re that certain that networking wasn’t enabled when Apache tried to start, then what do you think caused that condition?