[Pkg-nginx-maintainers] Bug#942817: nginx when ipv6 is disabled

Eric Desrochers eric.desrochers at canonical.com
Tue Oct 22 01:41:23 BST 2019


Package: nginx
Version: 1.14.2-2+deb10u1
Severity: normal

Dear Maintainer,

Old reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779825

nginx fails at install time to start[1] if the system has ipv6 disabled.
While I understand the chances intentionally disabled ipv6 are not common, it does happen or certain company with strict policy.
It think it is safe to say that we want nginx to start out of box for both scenarios (ipv4 and ipv6)

Would it be reasonable to provide 2 vhosts as follow (instead of actual 'default'):
* default-ipv6
        listen 80 default_server;
        listen [::]:80 default_server;

* default-noipv6
        listen 80 default_server;

and then instruct the maintainer script "nginx-common.postinst" to check for the presence of "/proc/net/if_inet6" and symlink the right vhost accordingly[2]

Regards,
Eric

[1] # nginx -t  # On a non-ipv6 system
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
nginx: configuration file /etc/nginx/nginx.conf test failed

# During nginx installation:
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2019-10-22 00:28:16 UTC; 6ms ago
     Docs: man:nginx(8)
  Process: 1290 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Oct 22 00:28:16 debianbuster systemd[1]: Starting A high performance web server and a reverse proxy server...
Oct 22 00:28:16 debianbuster nginx[1290]: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
Oct 22 00:28:16 debianbuster nginx[1290]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 22 00:28:16 debianbuster systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Oct 22 00:28:16 debianbuster systemd[1]: nginx.service: Failed with result 'exit-code'.
Oct 22 00:28:16 debianbuster systemd[1]: Failed to start A high performance web server and a reverse proxy server.

[2] nginx-common.postinst
     # If a symlink doesn't exist and can be created, then create it.
+   # NO IPV6
     if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] &&
-       [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ]; then
-      ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
+       [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ] &&
+       [ ! -f /proc/net/if_inet6 ]; then
+       ln -s /etc/nginx/sites-available/default-noipv6 /etc/nginx/sites-enabled/default
+    fi
+
+    # IPV6
+    if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] &&
+       [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ] &&
+       [ -f /proc/net/if_inet6 ]; then
+       ln -s /etc/nginx/sites-available/default-ipv6 /etc/nginx/sites-enabled/default
     fi

-- System Information:
Debian Release: 10.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.3.0-18-generic (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nginx depends on:
ih  nginx-full  1.14.2-2+deb10u1

nginx recommends no packages.

nginx suggests no packages.

-- no debconf information


More information about the Pkg-nginx-maintainers mailing list