Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Why does init.d/apache2 require net?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
pizzach
Apprentice
Apprentice


Joined: 28 Aug 2006
Posts: 195

PostPosted: Sat Jun 12, 2010 4:06 pm    Post subject: Why does init.d/apache2 require net? Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10733
Location: Somewhere over Atlanta, Georgia

PostPosted: Sat Jun 12, 2010 4:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23094

PostPosted: Sat Jun 12, 2010 4:39 pm    Post subject: Re: Why does init.d/apache2 require net? Reply with quote

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
View user's profile Send private message
pizzach
Apprentice
Apprentice


Joined: 28 Aug 2006
Posts: 195

PostPosted: Sat Jun 12, 2010 5:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
broken_chaos
Guru
Guru


Joined: 18 Jan 2006
Posts: 370
Location: Ontario, Canada

PostPosted: Sat Jun 12, 2010 7:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23094

PostPosted: Sat Jun 12, 2010 8:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum