Bug 1253798 - lighttpd.service fails on boot
Summary: lighttpd.service fails on boot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: lighttpd
Version: epel7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-14 17:57 UTC by Chris Adams
Modified: 2017-05-01 23:53 UTC (History)
4 users (show)

Fixed In Version: lighttpd-1.4.44-1.1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-12 03:20:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Chris Adams 2015-08-14 17:57:51 UTC
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 15:10:22 UTC
Interesting.  If you have it bind only to an ipv4 address, does it work?

Comment 2 Chris Adams 2015-08-24 15:14:04 UTC
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 15:28:54 UTC
Does it behave the same way on Fedora?

Comment 4 Chris Adams 2015-09-09 23:49:56 UTC
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-02 04:23:53 UTC
(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-09 01:12:08 UTC
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 13:51:37 UTC
Is this still occurring?

Comment 8 Chris Adams 2016-09-30 17:38:28 UTC
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 15:19:17 UTC
Any updates?

Comment 10 Chris Adams 2016-12-21 15:58:28 UTC
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 15:42:06 UTC
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 15:46:26 UTC
Excellent, thanks.  I'll get a fix out ASAP.

Comment 13 Fedora Update System 2016-12-27 15:54:40 UTC
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-28 00:20:18 UTC
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-12 03:20:29 UTC
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 23:53:18 UTC
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.