apache2 failure to start on boot when binding to IPv6 address

Bug #1207384 reported by Nicholas Meyer
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Invalid
Medium
Unassigned
ifupdown (Debian)
New
Unknown

Bug Description

Pertinent info:
Description: Ubuntu 12.04.2 LTS
Release: 12.04

apache2:
  Installed: 2.2.22-1ubuntu1.4
  Candidate: 2.2.22-1ubuntu1.4
  Version table:
 *** 2.2.22-1ubuntu1.4 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.2.22-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Issue:
Apache fails to start on boot when attempting to bind to an IPv6 address. boot.log shows the following (IP changed for privacy purposes):

(99)Cannot assign requested address: make_sock: could not bind to address [2001:db8::1]:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
 * Starting web server apache2 [fail]

Starting manually (apachectl start) after boot starts the daemon as expected.

Here is the inet6 section of my /etc/network/interfaces. Again, IPs removed for privacy. The post-up/pre-down route directives are required to access my provider's network:

iface eth0 inet6 static
 address 2001:db8::1
 netmask 64
 up /sbin/ifconfig eth0 inet6 add 2001:db8::2/64
 down /sbin/ifconfig eth0 inet6 del 2001:db8::2/64
 post-up /sbin/ip -f inet6 route add 2001:db8::ff:ff:ff:ff dev eth0
 post-up /sbin/ip -f inet6 route add default via 2001:db8::ff:ff:ff:ff
 pre-down /sbin/ip -f inet6 route del default via 2001:db8::ff:ff:ff:ff
 pre-down /sbin/ip -f inet6 route del 2001:db8::ff:ff:ff:ff dev eth0

Doing a little bit of research, it appears apache is trying to bind to an IP in the tentative state. (source: http://pyro.eu.org/how-to/micro/nginx-cannot-assign-requested-address-ipv6.txt).

Adding the while loop shown on at that URL to /etc/network/interfaces did not help; however, adding it to the beginning of /etc/init.d/apache2 resolved the issue. Suggest implementing something similar as a fix; have /etc/init.d/apache2 check for IPs in the tentative state and sleep until resolved.

description: updated
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

It sounds like this issue would affect Debian too. Please could you investigate and file a bug in Debian if appropriate?

Setting Priority to Medium as a workaround is available. I appreciate you documenting this.

Changed in apache2 (Ubuntu):
importance: Undecided → Medium
tags: added: needs-upstream-report
Revision history for this message
Nicholas Meyer (nickmeyer07) wrote :
Changed in apache2 (Debian):
status: Unknown → New
Revision history for this message
Stefan Fritsch (sf-sfritsch) wrote :

I don't think this should be fixed in apache'2 init script. It depends on '$network' and whatever is providing $network must ensure that the network is actually usable. Also, it makes much more sense to fix this in one place instead of hundreds of network daemons which are affected by the same issue.

If apache2's upstart configuration is missing the equivalent of the dependency on $network, this should be fixed. But this would be a Ubuntu specific issue because upstart support is not included in the Debian package. OTOH, if apache2's upstart configuration is correct, reassign this report to whatever is doing the network configuration under Ubuntu. Because then the bug must be there.

Revision history for this message
Nicholas Meyer (nickmeyer07) wrote :

Whatever is happening is happening independent of Upstart, as I was able to duplicate the issue on Debian Wheezy.

affects: apache2 (Debian) → ifupdown (Debian)
Revision history for this message
Fabio Augusto Miranda Martins (fabio.martins) wrote :

Thank you for submitting this bug. We're sorry, but this problem needs to be fixed in ifupdown, not in apache2. Ubuntu 12.04 is no longer a supported version. This bug is being changed to invalid for this reason.

Changed in apache2 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.