Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]How do I make it so that eth0 does not default start
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
athena810
Apprentice
Apprentice


Joined: 23 Jun 2012
Posts: 176

PostPosted: Mon Sep 03, 2012 2:57 am    Post subject: [solved]How do I make it so that eth0 does not default start Reply with quote

I'm running gentoo on my laptop, the annoying thing is that everytime it boots, it defaults try to start eth0. It says
Code:
*bringing up interface eth0
*no configuration specified,
*defualt to dhcp"


I don't use wlan0 since I'm on a laptop so it trying to bring up eth0 everytime is annoying because I always have to wait for it to time out. Any solutions?


Last edited by athena810 on Mon Sep 03, 2012 4:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
The Doctor
Veteran
Veteran


Joined: 27 Jul 2010
Posts: 1371

PostPosted: Mon Sep 03, 2012 3:17 am    Post subject: Reply with quote

make sure its not the default run level

next modify this file: /etc/rc.conf

look for this line:
RC_PLUG_SERVICES=""

and change it so it includes this:

RC_PLUG_SERVICES="!net.*"

You might need to uncomment the line, I don't remember. It should exist.
_________________
First things first, but not necessarily in that order.
Back to top
View user's profile Send private message
Odward
n00b
n00b


Joined: 21 Mar 2012
Posts: 65

PostPosted: Mon Sep 03, 2012 3:21 am    Post subject: Reply with quote

If you don't need eth0 to start, I think the most likely solution would be
Code:
rc-update del net.eth0 default
Back to top
View user's profile Send private message
The Doctor
Veteran
Veteran


Joined: 27 Jul 2010
Posts: 1371

PostPosted: Mon Sep 03, 2012 3:55 am    Post subject: Reply with quote

Odward wrote:
If you don't need eth0 to start, I think the most likely solution would be
Code:
rc-update del net.eth0 default


Unfortunately, this will not solve the problem completely. The init system is smart enough to autostart the net.eth0 for scrips that need="net". You also need to edit the file I specified to tell the init system not to start the net. But you are quite right, it is the first step to solving the problem.
_________________
First things first, but not necessarily in that order.
Back to top
View user's profile Send private message
Odward
n00b
n00b


Joined: 21 Mar 2012
Posts: 65

PostPosted: Mon Sep 03, 2012 4:38 am    Post subject: Reply with quote

The Doctor wrote:
The init system is smart enough to autostart the net.eth0 for scrips that need="net".

Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

Also I assumed, I know that's dangerous, athena810 meant to say s/he uses wireless on the laptop so would still need networking.
If I understand your instructions it will not load any network at all by default. I know the post said "I don't use wlan0" but then mentions
being a laptop, so it just seemed more likely that was a typo. If that wasn't a typo, sorry for assuming :P
Back to top
View user's profile Send private message
The Doctor
Veteran
Veteran


Joined: 27 Jul 2010
Posts: 1371

PostPosted: Mon Sep 03, 2012 5:04 am    Post subject: Reply with quote

Odward wrote:
The Doctor wrote:
The init system is smart enough to autostart the net.eth0 for scrips that need="net".

Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?


Oh don't worry. Its right on topic and a very good question. net.lo is a local loopback device and yes I think it does something about providing net. But there we go with clever programmers who know that and also know that the external network is not provided. The innit scripts know what they need so they do not need to be explicitly enabled in the right order by user, unlike some other systems. so when the innit scripts say "I need this" the innit system looks for "this". In this case "this" is the network and the Gentoo innit system knows that "net.lo" is not the net it needs so it looks for the other nets.* scripts. In this case, the innit scrips think they need to start the scrips but that is not what you want so you need to tell the innit program that the net scripts are off the menu. Of course, it might not. It depends on what other scrips are started during the boot process.

The reason one would do this is to run something like wicd or other GUI which handles the network but doesn't quite do it in the same way.

Of course, blacklisting the net.wlan0 script only is possible by specifying RC_PLUG_SERVICES="!net.wlan0"
_________________
First things first, but not necessarily in that order.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2167

PostPosted: Mon Sep 03, 2012 7:58 am    Post subject: Reply with quote

Odward wrote:
The Doctor wrote:
The init system is smart enough to autostart the net.eth0 for scrips that need="net".

Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

Odward ... you might be interested in this thread from the gentoo-dev mailing list.

athena810 ... if you don't want 'net.eth0' to provide net (and I mean 'provide' in the openrc sense) then you would add the following to /etc/conf.d/net or /etc/rc.conf

Code:
rc_net_eth0_provide="!net"

As The Doctor pointed out, an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'. The init system scripts have a syntax like the following (from /etc/init.d/pdnsd which is a DNS daemon and so obviously needs access to the network to function correctly).

Code:
depend() {
   need net
   provide dns
}

So, pdnsd needs 'net' and provides 'dns', and the same is true of other services. This can make things complicated for systems that have intermitant network connectivity, or who's network is not guarenteed to be available on boot. In this case it is advisable not to add these services to the 'default' run level but have them start when network is available. There are a number of ways this could be approached, but probably the simplist [EDIT: a better method using 'run-levels'] is to create an 'online' run-level.

Code:
# cd /etc/runlevels
# mkdir online
# rc-update -s add default online # the '-s' is for 'stacked'
# rc-update add net.wlan0 online # where wlan0 would be providing 'net'
# rc-update add <service> online # add all service you want started when wlan0 is started

Then, when you want to go online issue 'rc online' and all the additional services for this run-level will be started.

best ... khay

EDIT: changed to using a 'stacked' run-level


Last edited by khayyam on Tue Sep 04, 2012 7:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4141

PostPosted: Mon Sep 03, 2012 11:20 am    Post subject: Reply with quote

khayyam wrote:

As The Doctor pointed out, an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'. The init system scripts have a syntax like the following (from /etc/init.d/pdnsd which is a DNS daemon and so obviously needs access to the network to function correctly).


3 :)
devices can initiate service, per example udev discovering an ethernet card might load its driver and initiate the start of net.eth0
As a "it's there, it provide something, but even none ask it yet, it's there so run it".

On subject, you can just blacklist the module loading for your network card, removing the hardware function until you load the module by hand (if need at all)
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2167

PostPosted: Mon Sep 03, 2012 11:53 am    Post subject: Reply with quote

krinn wrote:
khayyam wrote:
[...] an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'.

3. devices can initiate service, per example udev discovering an ethernet card might load its driver and initiate the start of net.eth0.

krinn ... I've never seen this happen, and I load and unload the ath5k driver on occasion, perhaps this is the case if dbus is running, or rc_hotplug="*" is set in rc.conf (which it isn't by default).

best ... khay
Back to top
View user's profile Send private message
athena810
Apprentice
Apprentice


Joined: 23 Jun 2012
Posts: 176

PostPosted: Mon Sep 03, 2012 4:52 pm    Post subject: Reply with quote

Odward wrote:
The Doctor wrote:
The init system is smart enough to autostart the net.eth0 for scrips that need="net".

Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

Also I assumed, I know that's dangerous, athena810 meant to say s/he uses wireless on the laptop so would still need networking.
If I understand your instructions it will not load any network at all by default. I know the post said "I don't use wlan0" but then mentions
being a laptop, so it just seemed more likely that was a typo. If that wasn't a typo, sorry for assuming :P


yeah, that was a typo, I'll try some things and get back to you guys on what worked. Thanks for your replies.

'rc-update del net.eth0 defaul't worked perfectly flawless. Thanks everyone.
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