Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Init script "need net" problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
pberndt
n00b
n00b


Joined: 21 Jan 2005
Posts: 22

PostPosted: Mon Jul 25, 2005 1:45 pm    Post subject: Init script "need net" problem Reply with quote

I used to configure my /etc/conf.d/net to use dhcpcd and the address 192.168.0.4 as a fallback.
One of the latest updates updated hdcpcd to version 1.3.22_p4-r11, which is not supported by the init script (It says that it needed version r10). At boot time it automatically noticed that and used dhclient.

Sine then, when I'm in a network with no dhcpd (and the script has to use the fallback configuration) it seems to miss putting the "provide net" line.

Resulting of that every service (sshd, apache, ...) which depends on net fails to start.
It does not show any error message, the init script just hangs.

I'm not sure whether I did something terribly wrong or if theres a bug in the init scripts :)

Any ideas?
Back to top
View user's profile Send private message
fraktalek
n00b
n00b


Joined: 28 Mar 2004
Posts: 18

PostPosted: Mon Jul 25, 2005 5:50 pm    Post subject: Reply with quote

You mean that even though the network is working it is not set up properly by your system? (in case of no dhcp server)

I also don't know what you mean by the "provide net" line..., but the hanging is most probably caused by the dhcp client that tries to search for some dhcpc server. It just searches too long - default timeout is 60 seconds. Try to modify your /etc/conf.d/net so that you have there:
Code:
 dhcpcd_eth0="-t 3"

in the case your network interface is eth0.
This passes the "-t 3" option to dhcpcd which makes it to change the default timeout to 3 seconds. (man dhcpcd)
Back to top
View user's profile Send private message
pberndt
n00b
n00b


Joined: 21 Jan 2005
Posts: 22

PostPosted: Mon Jul 25, 2005 6:55 pm    Post subject: Reply with quote

Quote:
I also don't know what you mean by the "provide net" line..., but the hanging is most probably caused by the dhcp client that tries to search for some dhcpc server. It just searches too long - default timeout is 60 seconds. Try to modify your /etc/conf.d/net so that you have there:

No, the net.eth0 script finishes with the information, that the fallback configuration was used.
Execution stopps after the net.eth0 script, when the services depending on net should get started. (In my case this was sshd, but the problem occurs with other services as well)

Quote:
I also don't know what you mean by the "provide net" line...

Uhm.. sorry. Didn't know how to express this better :)

As far as I understood the init scripts, the scripts net.foo provide the virtual service net.
Other scripts (like sshd, apache, ...) have a line containing
Code:
need net
, which means that those services need a network device running.
The runscript command takes care of those dependencies and starts those services before others. (For example, if you start apache without having net.foo started, the net.foo script is executed automatically before apache)

(Correct me if I'm wrong)
Back to top
View user's profile Send private message
foofoo
n00b
n00b


Joined: 28 Jul 2004
Posts: 28

PostPosted: Sun Jan 21, 2007 1:55 am    Post subject: runscript dependencies ... Reply with quote

Don't know if you're running ifplugd, but I am and my workaround for the apache start problem was in

/etc/conf.d/net:
Code:
...
#########################################################################
# ifplugd fussing
#########################################################################
modules_wlan0=( "!plug" )
modules_rausb0=( "!plug" )
modules_eth0=( "!plug" )
plug_timeout="10"
...


which is sad because I was so pleased with how neat it was to just plug the ethernet cord into the laptop and have eth0 start up automagically. But these weird dependencies with apache, etc.. when the interface is down seem to make ifplugd just not worth it... (There is probably a way to configure it to handle stuff like this?)

Now that eth0 (and no other interface for that matter,) is dependent on ifplugd, they are allowed to start on their fallback configuration and then the apache start script decides it's cool to start too.

Before:
Quote:
/etc/init.d/net.eth0 restart
* Stopping eth0
* Bringing down eth0
* Stopping ifplugd on eth0 ... [ ok ]
* Shutting down eth0 ... [ ok ]
* Starting eth0
* Starting ifplugd on eth0 ... [ ok ]
* Backgrounding ...
spock # /etc/init.d/apache2 start
* WARNING: netmount is scheduled to start when net.eth0 has started.
* WARNING: apache2 is scheduled to start when net.eth0 has started.
spock # /etc/init.d/apache2 status
* status: stopped


After:
Quote:
/etc/init.d/net.eth0 restart
* Caching service dependencies ... [ ok ]
* Stopping eth0
* Bringing down eth0
* Shutting down eth0 ... [ ok ]
* Starting eth0
* Bringing up eth0
* dhcp
* Running dhcpcd ... [ !! ]
* Trying fallback configuration
* xxx.xxx.xxx.xxx [ ok ]
* Adding routes
* default via xxx.xxx.xxx.xxx ...
spock # /etc/init.d/apache2 start
* Mounting network filesystems ... [ ok ]
* Starting apache2 ... [ ok ]


:P :x

Incidentally, the reason this works is because my eth0 has a fallback configuration:
/etc/conf.d/net:
Code:
...
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 5"
dhcp_eth0="nodns"
routes_eth0=( "default via xxx.xxx.xxx.xxx" )
fallback_eth0=( "xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx" )
fallback_route_eth0=( "default via xxx.xxx.xxx.xxx" )
...


there is probably a cleaner way to do this, but honestly as a laptop yooser running around trying to run apache locally and hoppin' around between wireless APs, ad-hocs, dhcpc'd and static ethernets at will I find myself editing "/etc/conf.d/net" and "/etc/resolv.conf" frequently or just configuring things manually the good ol' fashion way with iwconfig, /sbin/route and ifconfig. Especially with baselayout, wireless-tools, etc.. changing often.
go figure.
_________________
"Stolen's a strong word. It's copyrighted content that the owner wasn't paid for."
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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