Bug 1352139

Summary: httpd fails to start
Product: [Fedora] Fedora Reporter: David A. De Graaf <dad>
Component: httpdAssignee: Jan Kaluža <jkaluza>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: jkaluza, jorton, pahan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-04 11:25:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David A. De Graaf 2016-07-01 18:32:01 UTC
Description of problem:
On a fresh installation of Fedora 24, httpd fails to start.
journalctl -b shows these errors:
  Jun 27 10:33:17 garfield httpd[1100]: (99)Cannot assign requested
  address: AH00072: make_sock: could not bind to address
  192.168.10.99:80
  Jun 27 10:33:17 garfield httpd[1100]: no listening sockets
  available, shutting down


Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1.  Configure httpd to listen on a specific (local) IP.
2.  Reboot.
3.  Observe that httpd failed to start.

Actual results:
httpd startup fails.

Expected results:
httpd startup succeeds.

Additional info:

It can be started manually later, readily enough, with
  systemctl start httpd
but that's a PITA.

Sam Varshavchik, on the users.org, replied to me that privoxy exhibits the same failure.  I tried his recommended fix by adding
/etc/systemd/system/httpd.service with these changes:

# diff /usr/lib/systemd/system/httpd.service /etc/systemd/system/httpd.service
19c19,21
< After=network.target remote-fs.target nss-lookup.target
---
> Wants=network-online.target
> After=network-online.target remote-fs.target nss-lookup.target
> ## After=network.target remote-fs.target nss-lookup.target

but it had no effect.  
I surely don't understand the intricacies of systemd notation.  

I also discovered BZ 1119787, which suggests this is a long-standing problem with many systemd startups, desperately seeking a solution.

Comment 1 David A. De Graaf 2016-07-01 21:38:02 UTC
Another comment from Jose Maria Terry Jimenez suggested that it's also
necessary to:
   systemctl enable NetworkManager-wait-online

And with that service also added, httpd now starts correctly.
Sheesh!

Comment 2 David A. De Graaf 2016-07-03 19:24:44 UTC
Comment 1 was based on a single test.
Two reboots following a dnf update, and a new kernel (4.6.3-300.fc24.x86_64)
have failed to start httpd.
So, the fixes fix nothing!

I'm baffled and bewildered.

Comment 3 Joe Orton 2016-07-04 11:25:40 UTC
Sorry, bugzilla isn't a support forum.  

In the default configuration, httpd does not require any specific IP address to be associated; the shipped systemd httpd.service works for the vast majority of users.  The advice around using wait-online looks correct unless systemd behaviour has changed recently there.

We've worked on adding support for IP_FREEBIND [1] to upstream httpd, in the longer-run this may be a more appropriate way to configure the server than adjusting (or re-configuring) the systemd service.

[1] See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/