WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Nginx not start

Open exileed opened this issue 10 years ago • 58 comments

2016/04/08 11:34:44 [emerg] 10843#0: setsockopt(IPV6_V6ONLY) [::]:80 failed, ignored (22: Invalid argument) 2016/04/08 11:34:44 [emerg] 10843#0: bind() to [::]:80 failed (22: Invalid argument)

exileed avatar Apr 08 '16 11:04 exileed

If you comment the second line of listen works. But, not work on Windows accessing the localhost:. =/

deyvisonrocha avatar Apr 08 '16 12:04 deyvisonrocha

Same here. I guess the IPv6 is not fully implemented. However, after commenting out the IPv6 config in /etc/nginx/sites-available/default, I got another error:

2016/04/10 18:03:54 [emerg] 594#0: setsockopt(IPV6_V6ONLY) [::]:80 failed, ignored (22: Invalid argument)
2016/04/10 18:03:54 [emerg] 594#0: bind() to [::]:80 failed (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)
2016/04/10 18:06:52 [alert] 661#0: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)

hungys avatar Apr 10 '16 18:04 hungys

Can confirm from our side that the socket option IPPROTO_IPV6\IPV6_V6ONLY is not yet implemented. We have opened a bug on our side to track this. No ETA at this time.

sunilmut avatar Apr 12 '16 20:04 sunilmut

@sunilmut What about accessing nginx from Windows? I've got it running, but http://localhost won't work.

luisfavila avatar Apr 13 '16 16:04 luisfavila

@luisfavila If the nginx server is listening on the port, then you should be able to connect from Windows. 'netstat' is probably currently broken on WSL. Can you try 'netstat' on Windows to see if anyone is listening on the server port? If nginx is listening on the server port, you can also check your firewall settings (or disable it) to see if that makes any difference?

sunilmut avatar Apr 13 '16 17:04 sunilmut

@sunilmut Actually, nginx wasn't started at all. It did not show any error when starting, but reading logs it was due to IPV6, which is disabled now. It won't start anyway, though, showing the following error: ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument) Apache2 seems to work, while presenting the following warning (after disabling IPv6, with IPv6 enabled will show one more warning): Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT

luisfavila avatar Apr 13 '16 18:04 luisfavila

@luisfavila Regarding "ioctl(FIONBIO)" error, do you know on which file it is calling that IOCTL?

sunilmut avatar Apr 13 '16 20:04 sunilmut

@luisfavila - Also, glad to know that you got apache to work. We are working on getting support for IPV6_V6ONLY. Hopefully, you should see that light up soon.

sunilmut avatar Apr 13 '16 20:04 sunilmut

@luisfavila did you get apache to work? I get ipv6 errors but I didn't manage to disable it, all guides on how to disable ipv6 on ubuntu refered to config files that did not exists or didn't change anything when edited. How did you disable ipv6?

afridlund85 avatar Apr 14 '16 07:04 afridlund85

@afridlund85 Edited /etc/apache2/ports.conf and changed Listen 80 to Listen 0.0.0.0:80

Regarding "ioctl(FIONBIO)" error, do you know on which file it is calling that IOCTL?

@sunilmut No idea, it doesn't tell

Also, glad to know that you got apache to work. We are working on getting support for IPV6_V6ONLY. Hopefully, you should see that light up soon.

@sunilmut Great! Looking forward to test it!

luisfavila avatar Apr 14 '16 13:04 luisfavila

I compile nginx without enabling IPv6 support bot it doesn't start either

i got this error: nginx: [emerg] bind() to 0.0.0.0:80 failed (22: Invalid argument)

i compile nginx with this command: /usr/local/nginx/sbin/nginx -V

nginx version: nginx/1.8.1
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configure arguments: --prefix=/usr/local/nginx --without-http_autoindex_module --without-http_userid_module --without-http_auth_basic_module --without-http_fastcgi_module --without-http_empty_gif_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module

Geeknux avatar Apr 17 '16 09:04 Geeknux

@Geeknux Have you disabled IPv6 following my instructions? They were for Apache2; the way to do it in Nginx is different: edit the file /etc/nginx/sites-enabled/default and comment the line listen [::]:80 default_server ipv6only=on;, leaving only the listen 80 default_server; line.

luisfavila avatar Apr 17 '16 18:04 luisfavila

@luisfavila Yes i did that, but it didn't resolve the problem, at least not for me

Update: it seams Skype is The problem: Skype automatically updated itself, and turned the "use port 80" option back on. after disabling that on skype i can start nginx without any error but it doesn't respond in any way.

Geeknux avatar Apr 18 '16 07:04 Geeknux

@Geeknux I didn't get nginx to work either, only apache2. Nginx seemed load fine, but checking the error log in /var/log/nginx presented me ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument) as I said above in this thread

luisfavila avatar Apr 18 '16 13:04 luisfavila

Still encounter the same issue on the latest build.

ioctl(FIONBIO) failed while spawning "worker process" (22: Invalid argument)

hungys avatar Apr 23 '16 03:04 hungys

Same issue.

Initially did not bind, so I removed the IPV6 config item. Now I'm getting the ioctl(FIONBIO) failed while spawning 'worker process' (22: Invalid argument) error

kjhughes097 avatar Apr 26 '16 12:04 kjhughes097

I have verified that with IPV6ONLY fix and the fix to return EADDRINUSE in bind() when a port is already in use, apache2 starts fine (although it emits a warning around APR_TCP_DEFER_ACCEPT). I was able to connect to the apache webserver port using a browser and access the default page. These fixes should show up soon in the insider builds. Thanks for trying out WSL and providing feedback!

sunilmut avatar May 05 '16 00:05 sunilmut

Confirmed that apache2 is working in the latest build with no need to edit any config files.

However, nginx still doesn't work. I get a slightly different error (FIOASYNC)

2016/05/12 04:07:38 [alert] 354#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

adityanag avatar May 12 '16 04:05 adityanag

I took a deeper look at 'Nginx'. It first binds to an IPv4 address and then to an IPv6 address (to the same port by default) using the IPV6_V6ONLY option. Unfortunately, we are not able to support the scenario immediately and we have a bug tracking this. As an alternative, there are couple of options as workarounds: Edit the default configuration of Nginx to start at different ports on IPv4 and IPv6. Or, use either IPv4 or IPv6. The port configuration for Nginx is stored in '/etc/nginx/sites-enabled/default'. I was able to verify that both these workarounds work and the Nginx server starts successfully on build 14342. We know its not ideal, but at least gets your one step further. Meanwhile, we have an understanding of the bug on our side, but unfortunately, it might take some time to fix it because of dependencies outside of WSL.

sunilmut avatar May 19 '16 19:05 sunilmut

@sunilmut nginx still dosent start.

Shows this error now

2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument) 2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument) 2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument) 2016/05/27 20:06:36 [alert] 79#0: ioctl(FIOASYNC) failed while spawning "worker process" (22: Invalid argument)

I'm using the latest windows 10 build insider as of today.

paladox avatar May 27 '16 19:05 paladox