Bug 1373495 - Nginx can't bind to IPv6 address at system boot but later can
Summary: Nginx can't bind to IPv6 address at system boot but later can
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: nginx
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: network-online.target
TreeView+ depends on / blocked
 
Reported: 2016-09-06 12:17 UTC by Christopher Meng
Modified: 2020-11-05 09:31 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 11:45:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Christopher Meng 2016-09-06 12:17:58 UTC
I'm encoutering this issue recently, after some diagnostics I believe it's caused by race between nginx startup and network online process.

Log:

nginx[1300]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx[1300]: nginx: [emerg] bind() to [XXX]:80 failed (99: Cannot assign requested address)
nginx[1300]: nginx: configuration file /etc/nginx/nginx.conf test failed
systemd[1]: nginx.service: Control process exited, code=exited status=1
systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
systemd[1]: nginx.service: Unit entered failed state.
audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nginx comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
systemd[1]: nginx.service: Failed with result 'exit-code'.
kernel: r8169 0000:03:00.0 enp3s0: link up
kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0: link becomes ready
NetworkManager[1265]: <info>  [1473136936.1439] device (enp3s0): link connected
NetworkManager[1265]: <info>  [1473136936.1450] device (enp3s0): state change: unavailable -> disconnected (reason 'carrier-changed') [20 30 40]
NetworkManager[1265]: <info>  [1473136936.1466] policy: auto-activating connection 'enp3s0'
NetworkManager[1265]: <info>  [1473136936.1487] device (enp3s0): Activation: starting connection 'enp3s0' (486d4510-43ac-405c-ad56-2ec052ec0ad9)
NetworkManager[1265]: <info>  [1473136936.1489] device (enp3s0): state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[1265]: <info>  [1473136936.1491] manager: NetworkManager state is now CONNECTING
NetworkManager[1265]: <info>  [1473136936.1497] device (enp3s0): state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[1265]: <info>  [1473136936.1509] device (enp3s0): state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[1265]: <info>  [1473136936.1519] dhcp4 (enp3s0): activation: beginning transaction (timeout in 45 seconds)
NetworkManager[1265]: <info>  [1473136936.2407] dhcp4 (enp3s0): dhclient started with pid 1341
dhclient[1341]: DHCPREQUEST on enp3s0 to 255.255.255.255 port 67 (xid=0x737c396a)
dhclient[1341]: DHCPREQUEST on enp3s0 to 255.255.255.255 port 67 (xid=0x737c396a)
dhclient[1341]: DHCPACK from YYY (xid=0x737c396a)

As you can see network was ready after nginx start, thus causing trouble for nginx unable to bind address.

I simply modified the nginx target with override.conf and now it works:

# /etc/systemd/system/nginx.service.d/override.conf
[Unit]
After=
After=network-online.target remote-fs.target nss-lookup.target

Currently nginx uses:

# systemctl cat nginx.service
# /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

I'm not 100% sure if this solution is proper or there are some better ones, but please consider this as an improvement.

Comment 1 Fedora End Of Life 2017-02-28 10:12:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Fedora End Of Life 2018-05-03 08:31:32 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2018-05-29 11:45:44 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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