View previous topic :: View next topic |
Author |
Message |
pizzach Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/4954305934616a1d26f1b7.jpg)
Joined: 28 Aug 2006 Posts: 195
|
Posted: Sat Jun 12, 2010 4:06 pm Post subject: Why does init.d/apache2 require net? |
|
|
I don't always have a wireless connection on my laptop and sometimes I like to use my computer to show clients specific webpages on my local hard drive. Since they use PHP, I have no choice and have to have a web server running to parse the code.
Once I removed the requirement for net from /etc/init.d/apache2, all has become fine. Shouldn't apache start up fine anyway as long as net.lo is running? I mean, the loopback device is why you can use localhost etc to connect to yourself right? It just doesn't lead to the outside world. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
John R. Graham Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/1323583785534df64897db0.jpg)
Joined: 08 Mar 2005 Posts: 10733 Location: Somewhere over Atlanta, Georgia
|
Posted: Sat Jun 12, 2010 4:26 pm Post subject: |
|
|
Probably more than 99% of all Apache deployments serve web pages off of localhost, so requiring net is the more correct implementation for the vast majority of users. You've discovered the correct modified solution for your particular case, so all is well with the world.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23094
|
Posted: Sat Jun 12, 2010 4:39 pm Post subject: Re: Why does init.d/apache2 require net? |
|
|
pizzach wrote: | Shouldn't apache start up fine anyway as long as net.lo is running? I mean, the loopback device is why you can use localhost etc to connect to yourself right? | Not necessarily. Apache needs to be able to bind to its specified listen addresses when it starts. If you have configured it to listen to a specific non-loopback address, then Apache cannot start until some interface is configured with that address. Hence, Apache cannot start until the initscript for that interface has run. In theory, the Apache initscript could be enhanced to examine the Apache configuration file and choose either need net or need net.interface, depending on whether Apache has a wildcard/loopback bind or a specific non-loopback bind. However, Apache configuration files are complicated, so it might be easier just to move that to a variable in /etc/conf.d/apache2 and let the administrator set it properly for his site. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
pizzach Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/4954305934616a1d26f1b7.jpg)
Joined: 28 Aug 2006 Posts: 195
|
Posted: Sat Jun 12, 2010 5:53 pm Post subject: |
|
|
Sorry guys. Let me try to be clear about what I think it wrong. Shouldn't net.lo be sufficient to start apache2/vsftpd etc when the init.d script has net required? I think I am either missing something, or that may be a bug in gentoo marked as a feature. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
broken_chaos Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 18 Jan 2006 Posts: 370 Location: Ontario, Canada
|
Posted: Sat Jun 12, 2010 7:32 pm Post subject: |
|
|
Have you set RC_NET_STRICT_CHECKING="lo" in /etc/conf.d/rc (if using baselayout-1)?
If you're using baselayout-2/openrc, you might be able to set rc_apache2_need="!net" in /etc/rc.conf to accomplish the same thing as you've already done, without editing the init.d script. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23094
|
Posted: Sat Jun 12, 2010 8:19 pm Post subject: |
|
|
pizzach wrote: | Let me try to be clear about what I think it wrong. Shouldn't net.lo be sufficient to start apache2/vsftpd etc when the init.d script has net required? I think I am either missing something, or that may be a bug in gentoo marked as a feature. | I understand exactly what you want, and I am saying that it is configured the way it is because for most users, the shipped behavior is correct. Your need to run a webserver without offering service to any other machines, although not unpredecented, is atypical. Configuring the system as you have done allows the initscript to start Apache at a time when, for a more typical configuration, functionality required by Apache would not be available, resulting in a startup failure. For your use case, starting net.lo is adequate, but the initscript currently has no way to recognize that, so it requests the more complete functionality offered by bringing up a non-loopback interface.
As broken_chaos notes, there are configuration settings you can use to affect this without modifying the initscript. I grant that the support for your particular situation is not as simple as it could be. I think the developers would be willing to accept patches to improve that support, if the patches were well written and free of negative side effects. I think that the relatively rare nature of your use case results in a lack of interest in improving that support on the hope that someone might find it useful. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|