Bug 1253798 - lighttpd.service fails on boot
lighttpd.service fails on boot
Status: CLOSED ERRATA
Product: Fedora EPEL
Classification: Fedora
Component: lighttpd (Show other bugs)
epel7
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Gwyn Ciesla
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-14 13:57 EDT by Chris Adams
Modified: 2017-05-01 19:53 EDT (History)
4 users (show)

See Also:
Fixed In Version: lighttpd-1.4.44-1.1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-01-11 22:20:29 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Chris Adams 2015-08-14 13:57:51 EDT
I have an up-to-date CentOS 7 system with lighttpd 1.4.36-1.el7 installed from Fedora EPEL.  When I reboot the system for updates and such, lighttpd fails to start on boot; systemctl status lighttpd.service shows:

Aug 14 09:21:34 hosting.cmadams.net lighttpd[875]: 2015-08-14 09:21:34: (network.c.410) can't bind to port: 2001:408:0:6::179 80 Cannot assign requested address

I can log in and start it later just fine.  It looks like the service is being started before the network is configured.  I'm using the "old-style" network.service, not NetworkManager, and the above address is configured in /etc/sysconfig/network-scripts/ifcfg-etho.  I see the systemd unit file for lighttpd.service does include network.service in After, and systemctl status network.service says:

Aug 14 09:21:33 hosting.cmadams.net systemd[1]: Starting Network.
Aug 14 09:21:33 hosting.cmadams.net systemd[1]: Reached target Network.

so it would seem that the network should have been up.  I'm starting with lighttpd (since that's the only service that fails), but maybe there's something deeper going on?
Comment 1 Gwyn Ciesla 2015-08-24 11:10:22 EDT
Interesting.  If you have it bind only to an ipv4 address, does it work?
Comment 2 Chris Adams 2015-08-24 11:14:04 EDT
Yes, it appears to be specific to IPv6.

I'm not sure what's happening actually.  I put in a systemd service that ran a script before lighttpd.service that would watch to make sure the IPv6 address was assigned to the interface, but lighttpd still failed to bind it.  Is there something in the kernel that would keep it from being bound right away?

I'm not really sure where to ask (don't know if there's an issue with the way lighttpd is trying to bind the IPv6 address, an issue with the kernel showing an address before it can be bound, or an issue with systemd coordinating/timing startup).
Comment 3 Gwyn Ciesla 2015-08-24 11:28:54 EDT
Does it behave the same way on Fedora?
Comment 4 Chris Adams 2015-09-09 19:49:56 EDT
Sorry it took a bit to test, but yes, it does have the same issue on Fedora 21 with lighttpd-1.4.36-1.fc21.x86_64.  Setting it to listen on a specific IPv6 address means it won't start on boot.
Comment 5 jon 2015-12-01 23:23:53 EST
(In reply to Jon Ciesla from comment #1)
> If you have it bind only to an ipv4 address, does it work?

Not for my CentOS 7.1 droplet at DigitalOcean. 

lighttpd binds to a specific IPv4 address, and uses two non-standard ports.

Yesterday I rebooted the droplet, and lighttpd did not start. 
"(network.c.410) can't bind to port: x.x.x.x xxxx Cannot assign requested address". 

lighttpd runs OK when manually started.

Until I found this bug report I thought I'd misconfigured lighttpd. 

jon h
Comment 6 Chris Adams 2015-12-08 20:12:08 EST
Hmmm, this may be a more generic problem (possibly some race condition in systemd?).  I just ran into a CentOS 7 server with rsyslogd configured to listen on a specific IPv4 address, and it had the same problem (couldn't bind to that IP at boot).  In the rsyslogd case, it ran anyway, it just didn't listen on the network (so logs weren't logged).

Not sure where to go with this now...
Comment 7 Gwyn Ciesla 2016-09-30 09:51:37 EDT
Is this still occurring?
Comment 8 Chris Adams 2016-09-30 13:38:28 EDT
I don't have an easy way to test it at this point - I had to change my configs to bind IPs in other ways.  I'll see what I can do, but it'll take me a bit.
Comment 9 Gwyn Ciesla 2016-12-15 10:19:17 EST
Any updates?
Comment 10 Chris Adams 2016-12-21 10:58:28 EST
I apologize; I haven't had a chance to check.  I should have time next week.

However, I think this may be the underlying issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1119787
Comment 11 Chris Adams 2016-12-27 10:42:06 EST
Okay, tested with a fresh and up-to-date CentOS 7 + lighttpd install.  I just added a server.bind option to the default config, and lighttpd does still fail to start on boot because it can't bind.  I added a systemd override for lighttpd with:

[Unit]
After=network-online.target

With that, it starts on boot fine.  So, this is an instance of BZ 1119787, and changing the systemd unit file from network.target to network-online.target should fix it.
Comment 12 Gwyn Ciesla 2016-12-27 10:46:26 EST
Excellent, thanks.  I'll get a fix out ASAP.
Comment 13 Fedora Update System 2016-12-27 10:54:40 EST
lighttpd-1.4.44-1.1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-854f12305e
Comment 14 Fedora Update System 2016-12-27 19:20:18 EST
lighttpd-1.4.44-1.1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-854f12305e
Comment 15 Fedora Update System 2017-01-11 22:20:29 EST
lighttpd-1.4.44-1.1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.
Comment 16 Andre Taniguchi 2017-05-01 19:53:18 EDT
tested with a fresh and up-to-date Fedora 25 + lighttpd 1.4.45.  I just added a server.bind option to the default config, and lighttpd does still fail to start on boot because it can't bind.  I added a systemd override for lighttpd with:

[Unit]
After=network-online.target

With that, it starts on boot fine. But before changing the systemd unit file from network.target to network-online.target, first activate the service:  sudo systemctl enable NetworkManager-online.service, should fix it!

Note You need to log in before you can comment on or make changes to this bug.