Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
openRC:net dependency and unavaible nics:Service don't 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
AnarKEY
n00b
n00b


Joined: 20 Apr 2010
Posts: 14

PostPosted: Fri Feb 13, 2015 1:41 pm    Post subject: openRC:net dependency and unavaible nics:Service don't start Reply with quote

Hi there,

I have an issue with init scripts and net dependendy.

I've got two ethernet devices (wired enp12s0 and wireless wlp6s0) and therefore two symlinks in /etc/init.d/) with symlinks net.enp12s0 -> net.lo and the same with net.enp12s0)

Additionally I run some services which depends on net like shorewall & tor, see /etc/init.d/tor for example:
Code:
depend() {
  need net
}


Now I get the problem that when I boot my machine without the network cable plugged in, net.enp12s0 couldn't be started and therefore tor isn't started as well. Also when I start tor manually (/etc/init.d/tor start) without the cable plugged in, starting tor fails:
Code:
localhost markus # /etc/init.d/tor start
 * Bringing up interface enp12s0
 *   config_enp12s0 not specified; defaulting to DHCP
 *   dhcp ...
 *     Running dhcpcd ...
dhcpcd[8009]: version 6.6.7 starting
dhcpcd[8009]: enp12s0: waiting for carrier
dhcpcd[8009]: timed out
dhcpcd[8009]: exited                                                                                                                                                                                                        [ !! ]
 * ERROR: net.enp12s0 failed to start
 * ERROR: cannot start tor as net.enp12s0 would not start


Have I configured sth. wrong? When I've no ethernet available, I use to remove the symlink net.enp12s0 temporary to get the services started, but I would really appreciaty an automatic solution.

Many thanks for any assistance.
Markus


Last edited by AnarKEY on Fri Feb 13, 2015 1:53 pm; edited 2 times in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Feb 13, 2015 1:50 pm    Post subject: Reply with quote

AnarKEY ... that looks like you pressed 'submit' before your question, or sentence, was complete ... anyhow, your looking to change what service is providing 'net', or the net.*(s) which should be activated in order to satisfy that dependency? ... or some other question?

edit: ok, I see you've since completed it.

best ... khay


Last edited by khayyam on Fri Feb 13, 2015 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
AnarKEY
n00b
n00b


Joined: 20 Apr 2010
Posts: 14

PostPosted: Fri Feb 13, 2015 1:52 pm    Post subject: Reply with quote

khayyam wrote:
AnarKEY ... that looks like you pressed 'submit' before your question, or sentence, was complete ... anyhow, your looking to change what service is providing 'net', or the net.*(s) which should be activated in order to satisfy that dependency? ... or some other question?

best ... khay


Thanks for your answer and sorry, wanted to press preview instead of submit. Here's my whole question now.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Feb 13, 2015 1:58 pm    Post subject: Reply with quote

AnarKEY wrote:
khayyam wrote:
AnarKEY ... that looks like you pressed 'submit' before your question, or sentence, was complete ... anyhow, your looking to change what service is providing 'net', or the net.*(s) which should be activated in order to satisfy that dependency? ... or some other question?

Thanks for your answer and sorry, wanted to press preview instead of submit. Here's my whole question now.

AnarKEY ... ok, no problem. Well, your probably looking for something like sys-apps/ifplugd ... and so have the interfaces started based on being plugged.

There are various other mechanisms like 'runlevels', or 'rc_*_need' that could be used to stipulate what services are started and their dependency for 'net' ... but that doesn't look to be what you're after ... clarify if I'm wrong.

best ... khay
Back to top
View user's profile Send private message
AnarKEY
n00b
n00b


Joined: 20 Apr 2010
Posts: 14

PostPosted: Fri Feb 13, 2015 2:53 pm    Post subject: Reply with quote

khayyam wrote:
AnarKEY wrote:
khayyam wrote:
AnarKEY ... that looks like you pressed 'submit' before your question, or sentence, was complete ... anyhow, your looking to change what service is providing 'net', or the net.*(s) which should be activated in order to satisfy that dependency? ... or some other question?

Thanks for your answer and sorry, wanted to press preview instead of submit. Here's my whole question now.

AnarKEY ... ok, no problem. Well, your probably looking for something like sys-apps/ifplugd ... and so have the interfaces started based on being plugged.

There are various other mechanisms like 'runlevels', or 'rc_*_need' that could be used to stipulate what services are started and their dependency for 'net' ... but that doesn't look to be what you're after ... clarify if I'm wrong.

best ... khay


Thanks for your quick reply.
I'm not sure whether ifplugd will resolve that issue (but it's a good hint though) because I'll shorewall and tor to start even when no net.* is or could be started. Therefore I could remove the dependency of that service in the shorewall init script, but I'm unsure about side effects and init script updates, etc.

What I want is:
* Shorewall can be started even when any net.* device could not
* Start shorewall alongside as a dependency of any net.* script

Ultimately I want to exclude that case, that any net-device is started without shorewall & tor on the one hand and on the other hand I can (re-)start that services even when not all net.* scripts could be started. So maybe the other hint of you leads to the right direction ..

I hope I could make clear my issue.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Fri Feb 13, 2015 2:57 pm    Post subject: Re: openRC:net dependency and unavaible nics:Service don't s Reply with quote

AnarKEY wrote:
Have I configured sth. wrong? When I've no ethernet available, I use to remove the symlink net.enp12s0 temporary to get the services started, but I would really appreciaty an automatic solution.
Doing that with netifrc gets complicated but with DHCPCD works very well, some manual works required.
See also this topic
AnarKEY wrote:
Ultimately I want to exclude that case, that any net-device is started without shorewall & tor on the one hand and on the other hand I can (re-)start that services even when not all net.* scripts could be started. So maybe the other hint of you leads to the right direction ..
So then you'd need dhcpcd start after shorewall and tor.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri Feb 13, 2015 5:58 pm    Post subject: Reply with quote

AnarKEY wrote:
What I want is:
* Shorewall can be started even when any net.* device could not
* Start shorewall alongside as a dependency of any net.* script

AnarKEY ... ok, those two are basically incompatible requirements in a dependency based system. However it should suffice to do the following:

/etc/rc.conf
Code:
rc_shorewall_need="!net"
rc_shorewall_before="net"

AnarKEY wrote:
Ultimately I want to exclude that case, that any net-device is started without shorewall & tor on the one hand and on the other hand I can (re-)start that services even when not all net.* scripts could be started. So maybe the other hint of you leads to the right direction.

This sounds as though you're starting both net.${IFACE} which you really shouldn't ... if you want to be able to have these both active, or rather activated, then you should really use ifplugd (which can bring down one, and start the other based on a cable being connected/disconnected).

As for tor ... it does 'need net', so having it start without net seems somewhat pointless. If its just a question of starting it as the network becomes available then really this is more and issue with your expecting you can add everything to the default runlevel and everything will somehow work out. You should be using either a runlevel for this, or hooks from netifrc/dhcpcd/ifplugd to start it at the time when net is available.

charles17 wrote:
Doing that with netifrc gets complicated but with DHCPCD works very well

@charles ... no more complicated than dhcpcd, really ... its also more configurable as you have net.iface.runlevel and similar type mechanisms for fine tuning.

best ... khay
Back to top
View user's profile Send private message
AnarKEY
n00b
n00b


Joined: 20 Apr 2010
Posts: 14

PostPosted: Fri Feb 20, 2015 11:02 am    Post subject: Reply with quote

Thanks khayyam,

sorry for the late reply. I added rc_neet="!net" and rc_before="net" to /etc/conf.d/shorewall and it works fine now.

I'll also try out ifplugd to set up a more sophisticated network configuration instead trying to start everything at once and hoping in the end everything will be running.

Thanks again, I also learned a lot about openRC and will hopefully do also about ifplugd.

M
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