Bug 1798841

Summary: [httpd] (99)Cannot assign requested address: AH00072: make_sock: could not bind to address
Product: Red Hat Enterprise Linux 8 Reporter: Sachin <sacpatil>
Component: httpdAssignee: Luboš Uhliarik <luhliari>
Status: CLOSED NOTABUG QA Contact: RHEL Stacks Subsystem QE <rhel-stacks-subsystem-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: fadamo, huali, jorton, jsynacek, luhliari, rainer.traut, systemd-maint-list
Target Milestone: rc   
Target Release: 8.0   
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: 2020-02-25 16:50:51 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 Sachin 2020-02-06 06:11:50 UTC
This bug was initially created as a copy of Bug #1438749

I am copying this bug because: 

If the NetworkManager.service is running and the service(say httpd) want to listen on explicitly configured IP address is unable to start. As per BZ#1438749, the issue was fixed in systemd-219-33.el7 but I face this issue on RHEL8(systemd-239-13.el8)  

Version-Release number of selected component (if applicable):
systemd-239-13.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Make sure NetworkManager is running.
2. httpd is configured to listen on IP:
```
# grep Listen /etc/httpd/conf/httpd.conf 
# Listen: Allows you to bind Apache to specific IP addresses and/or
# Change this to Listen on specific IP addresses as shown below to 
Listen 10.0.2.15:80
```
3. Reboot the system


Actual results:

After reboot, httpd service failed:

```
# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2020-02-06 00:49:41 EST; 2min 45s ago
     Docs: man:httpd.service(8)
  Process: 801 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 801 (code=exited, status=1/FAILURE)
   Status: "Reading configuration..."

Feb 06 00:49:41 rhel8-box systemd[1]: Starting The Apache HTTP Server...
Feb 06 00:49:41 rhel8-box httpd[801]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress t>
Feb 06 00:49:41 rhel8-box httpd[801]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 10.0.2.15:80
Feb 06 00:49:41 rhel8-box httpd[801]: no listening sockets available, shutting down
Feb 06 00:49:41 rhel8-box httpd[801]: AH00015: Unable to open logs
Feb 06 00:49:41 rhel8-box systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Feb 06 00:49:41 rhel8-box systemd[1]: httpd.service: Failed with result 'exit-code'.
Feb 06 00:49:41 rhel8-box systemd[1]: Failed to start The Apache HTTP Server.
```

Expected results:
httpd should be running fine


Additional info:

```
# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.0 (Ootpa)
```

Comment 1 Jan Synacek 2020-02-06 09:13:22 UTC
(In reply to Sachin from comment #0)
> This bug was initially created as a copy of Bug #1438749
> 
> I am copying this bug because: 
> 
> If the NetworkManager.service is running and the service(say httpd) want to
> listen on explicitly configured IP address is unable to start. As per
> BZ#1438749, the issue was fixed in systemd-219-33.el7 but I face this issue
> on RHEL8(systemd-239-13.el8)  

In that bugzilla, NetworkManager was NOT present on the system and the bug was something else.

> Feb 06 00:49:41 rhel8-box systemd[1]: Starting The Apache HTTP Server...
> Feb 06 00:49:41 rhel8-box httpd[801]: AH00558: httpd: Could not reliably
> determine the server's fully qualified domain name, using ::1. Set the
> 'ServerName' directive globally to suppress t>
> Feb 06 00:49:41 rhel8-box httpd[801]: (99)Cannot assign requested address:
> AH00072: make_sock: could not bind to address 10.0.2.15:80

This looks like a misconfiguration to me.

Anyway, not a systemd bug.

Comment 2 Sachin 2020-02-07 05:23:13 UTC
Hi Jan,

I'm aware that the NetworkManager was not present in BZ#1438749 but as in RHEL8 we don't have network.service to take over if NetworkManger.service is disabled, I decided to link the Bugzilla anyway.


> This looks like a misconfiguration to me. Anyway, not a systemd bug.

That is a relief. Any idea what exactly is misconfigured?

Comment 3 Joe Orton 2020-02-25 16:50:51 UTC
Please see section "Starting the service at boot time" in httpd.service(8) man page - "man httpd.service", this case is covered there.

       If httpd is configured to depend on any specific IP address (for example, with a
       "Listen" directive) which may only become available during start-up, or if httpd
       depends on other services (such as a database daemon), the service must be
       configured to ensure correct start-up ordering.

       For example, to ensure httpd is only running after all configured network interfaces
       are configured, create a drop-in file (as described above) with the following
       section:

           [Unit]
           After=network-online.target
           Wants=network-online.target

       See https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ for more
       information on start-up ordering with systemd.