Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 218302 - sys-apps/openrc: rc_depend_strict="NO" doesn't work correctly
Summary: sys-apps/openrc: rc_depend_strict="NO" doesn't work correctly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-18 18:20 UTC by Oldrich Jedlicka
Modified: 2011-02-16 15:38 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
My configuration (rc.conf,4.43 KB, text/plain)
2008-04-19 09:00 UTC, Oldrich Jedlicka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oldrich Jedlicka 2008-04-18 18:20:42 UTC
When net.lo (boot runlevel) is started, net.lan is inactive (without cable, default runlevel) and rc_depend_strict="NO" is in rc.conf, the starting sshd says this:

oldium init.d # /etc/init.d/net.lo status
net.lo            | * status: started
oldium init.d # /etc/init.d/net.lan status
net.lan           | * status: inactive
oldium init.d # /etc/init.d/sshd restart
sshd              | * Stopping sshd ...                                                                                      [ ok ]
sshd              | * WARNING: sshd is scheduled to start when net.lan has started

The provider for "net" is net.lo, so there is no reason to wait for net.lan. I was using RC_NET_STRICT_CHECKING="lo" in baselayout-1 without any problem.

I'm using openrc-0.2.2, baselayout-2.0.0.
Comment 1 Roy Marples 2008-04-18 23:04:18 UTC
rc_depend_strict yes/no only works when there are NO sevices that supply the depend in the runlevel.

In other words, you need to remove net.lan from the default runlevel and allow it to be coldplugged.
Comment 2 Roy Marples 2008-04-18 23:04:47 UTC
If you could supply better documentation for this, it would be great :)
Comment 3 Oldrich Jedlicka 2008-04-19 08:59:12 UTC
(In reply to comment #1)
> In other words, you need to remove net.lan from the default runlevel and allow
> it to be coldplugged.

It looks like there is some problem with checking the "same" runlevel. I will show results from your proposal (the scenario is completely valid I think).

1. System started, net.lan was coldplugged. The net.wifi is blacklisted from coldplugging, because I want to have control over net.wifi. Result is that all "net" services were scheduled to be started after net.lan:

oldium ~ # rc-status
Runlevel: default
 dbus          [  started  ]
...
 pdnsd         [ scheduled ]
 netmount      [ scheduled ]
 sshd          [ scheduled ]
 apache2       [ scheduled ]
 ntpd          [ scheduled ]
 shorewall     [ scheduled ]
...
 local         [  started  ]
Runlevel: UNASSIGNED
 net.lan       [ inactive  ]
 udev-postmount[  started  ]

Anyway, where is boot level?

2. I started net.wifi manually, then I tried to start pdnsd:

oldium ~ # /etc/init.d/pdnsd stop
pdnsd             | * WARNING: pdnsd is already stopped
oldium ~ # /etc/init.d/pdnsd start
pdnsd             | * WARNING: pdnsd is scheduled to start when net.lan has started
oldium ~ # rc-status
Runlevel: default
...
 pdnsd         [ scheduled ]
...
Runlevel: UNASSIGNED
 net.lan       [ inactive  ]
 net.wifi      [  started  ]
 udev-postmount[  started  ]

I had to stop net.lan first to be able to start pdnsd. I think the dependency checking should take into account already started/inactive services, not only those in the same run level. But as you see, checking the "same" runlevel doesn't work either (or at least it looks like it doesn't work for me somehow).

I will attach my rc.conf just to be sure it is correct.
Comment 4 Oldrich Jedlicka 2008-04-19 09:00:19 UTC
Created attachment 150263 [details]
My configuration
Comment 5 Roy Marples 2008-04-19 09:11:49 UTC
Try setting rc_depend_strict to yes
Comment 6 Oldrich Jedlicka 2008-04-19 11:39:23 UTC
(In reply to comment #5)
> Try setting rc_depend_strict to yes

Yeah, that works. Kinda tricky :-)
Comment 7 Roy Marples 2008-04-19 17:05:30 UTC
You're also not the first to hit this, so maybe suggest better wording in /etc/rc.conf?
Comment 8 Oldrich Jedlicka 2008-04-20 07:32:39 UTC
(In reply to comment #7)
> You're also not the first to hit this, so maybe suggest better wording in
> /etc/rc.conf?

Actually the switch does something I really do not understand. It might be useful, but it does not check all dependencies, only some dependencies and only sometimes (yes/no). My opinion is that openrc should be extended to be more clever to actually match the wording :-)

I think it should check all already started services (all runlevels), current runlevel and boot runlevel for dependencies (as far as I know there are no more runlevels used during system start-up...?).

Manually started and cold/hotplugged services (shown in runlevel UNASSIGNED) could be included/excluded by one additional switch, but this might not be necessary.
Comment 9 Oldrich Jedlicka 2008-04-20 07:51:23 UTC
And one more note. With the extended checking the original RC_NET_STRICT_CHECKING could be fully simulated:

RC_NET_STRICT_CHECKING="none":
rc_<some_boot_service>_provide="net", rc_depend_strict="NO"

RC_NET_STRICT_CHECKING="no":
rc_net_lo_provide="!net", rc_depend_strict="NO"

RC_NET_STRICT_CHECKING="lo":
rc_depend_strict="NO"

RC_NET_STRICT_CHECKING="yes":
rc_depend_strict="YES"
Comment 10 Doug Goldstein (RETIRED) gentoo-dev 2008-10-07 15:58:15 UTC
documentation..
Comment 11 Henk Spaaij 2008-12-09 17:47:49 UTC
Yes I'd like to have the old behavior back. Currently there is no way to prevent apache/ssh from stopping if an interface is reset. Previously you'd use the option 'lo'.
Oldrich's last suggestion is a good one.
Comment 12 William Hubbs gentoo-dev 2009-12-19 23:30:11 UTC
The following are the comments in rc.conf:

# Do we allow any started service in the runlevel to satisfy the depedency
# or do we want all of them regardless of state? For example, if net.eth0
# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
# both will be started, but services that depend on 'net' will work if either
# one comes up. With rc_depend_strict="YES" we would require them both to
# come up.

In other words, rc_depend_strict applies to the current runlevel only.

Is that clear enough for everyone?  Can we close this bug?

Comment 13 Oldrich Jedlicka 2009-12-20 00:21:54 UTC
I don't think this is a documentation bug, I think that checking only the current run level is somehow a broken idea. But I do not want to argue, because I've already found a workaround. I'm using this line in rc.conf:

rc_apache2_need="!net net.lo"

Really, the workaround works for me, so I'm satisfied. Feel free to close the bug, if you are satisfied with the documentation :-)
Comment 14 Oldrich Jedlicka 2009-12-27 18:45:31 UTC
(In reply to comment #12)
> The following are the comments in rc.conf:
> 
> # Do we allow any started service in the runlevel to satisfy the depedency
> # or do we want all of them regardless of state? For example, if net.eth0
> # and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
> # both will be started, but services that depend on 'net' will work if either
> # one comes up. With rc_depend_strict="YES" we would require them both to
> # come up.
> 
> In other words, rc_depend_strict applies to the current runlevel only.
> 
> Is that clear enough for everyone?  Can we close this bug?

This looks bogus to me. If I have some (already started) service that provides "net" in the boot runlevel, why it cannot fullfill the dependency of the service in the "default" runlevel?
Comment 15 William Hubbs gentoo-dev 2010-01-20 17:27:21 UTC
(In reply to comment #14)
> This looks bogus to me. If I have some (already started) service that provides
> "net" in the boot runlevel, why it cannot fullfill the dependency of the
> service in the "default" runlevel?

This is what happens if you do not have any services that provide "net" in the default runlevel.

If you have any services that provide "net" in the default runlevel also, that is when the setting of rc_depend_strict takes affect.

Does that make sense?
Comment 16 Oldrich Jedlicka 2010-01-23 20:07:57 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > This looks bogus to me. If I have some (already started) service that provides
> > "net" in the boot runlevel, why it cannot fullfill the dependency of the
> > service in the "default" runlevel?
> 
> This is what happens if you do not have any services that provide "net" in the
> default runlevel.
> 
> If you have any services that provide "net" in the default runlevel also, that
> is when the setting of rc_depend_strict takes affect.
> 
> Does that make sense?

Yes, that makes sense. The rc_depend_strict is only about one run level. This is where my problem starts.

With RC_NET_STRICT_CHECKING="lo" all network services depended only on "net.lo". That was prefectly fine. Now I'm not able to do that, because net.lo is in "boot" runlevel (that is apparently not checked), and rc_depend_strict doesn't help me in any way.

So the problem is that it seems that there is no way to control network dependency of init scripts. I should also note, that steps in my comment #13 don't work, apache2 again waits for net.wifi (which is already fully started, but in runlevel "hotplugged"). It really looks like the dependency checking is broken.

But maybe I've just missed something.
Comment 17 Oldrich Jedlicka 2010-01-23 20:11:16 UTC
Please also note that I'm not arguing about the documentation of rc_depend_strict, but about the _functionality_ of network dependency checking. I'm just not able to do something that was easy in previous versions.
Comment 18 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-02-04 22:47:34 UTC
Can everybody here please read comments 22-28 on bug 337140?
Does documenting how to set specific providers cover your requirements for restarting services and non-strict actions?
Comment 19 Oldrich Jedlicka 2011-02-05 09:06:20 UTC
(In reply to comment #18)
> Can everybody here please read comments 22-28 on bug 337140?
> Does documenting how to set specific providers cover your requirements for
> restarting services and non-strict actions?

Playing with the net_xxx_provide is also what I suggest. My current requirement is that some services could start with only net.lo, but others after the real network comes up (openvpn for example). But you inspired me at least:

Maybe I could achieve my goals by:

  rc_depend_strict="NO"
  rc_net_lo_provide="!net"

And do for all services that doesn't need full net:

  rc_<service>_need="!net net.lo"

That is for apache2 (I use it locally only) and its dependencies. I will try it in the following days.
Comment 20 William Hubbs gentoo-dev 2011-02-05 09:41:04 UTC
(In reply to comment #19)
> Playing with the net_xxx_provide is also what I suggest. My current requirement
> is that some services could start with only net.lo, but others after the real
> network comes up (openvpn for example). But you inspired me at least:
> Maybe I could achieve my goals by:
>   rc_depend_strict="NO"
>   rc_net_lo_provide="!net"

I don't think you need these lines to do what you want. If you want services to depend on net.lo, you don't need to mess with whether or not net.lo provides net, or the rc_depend_strict setting.

> And do for all services that doesn't need full net:
>   rc_<service>_need="!net net.lo"

I think this line for each service that you want to not use full net is all you need.

I'm thinking this, because, since you removed the "need net" with this line, the services you want will start after net.lo instead of net.

Also, if you put these lines in the service's conf.d file instead of in rc.conf, you can use a shorter form of the variable name. For example, you mention apache2. If you put the line in /etc/conf.d/apache2 instead of /etc/rc.conf, it can be:

rc_need="!net net.lo"


Comment 21 Oldrich Jedlicka 2011-02-07 18:06:34 UTC
So my problem (not the original one, because the conditions have changed) is finally fixed. I've added those lines to rc.conf:

rc_depend_strict="NO"

rc_apache2_need="!net net.lo"
rc_mysql_need="!net net.lo"
rc_postgresql_9_0_need="!net net.lo"
rc_pdnsd_need="!net net.lo"

Apache no longer depends on inactive net.wifi.
Comment 22 William Hubbs gentoo-dev 2011-02-07 19:24:41 UTC
(In reply to comment #21)
> So my problem (not the original one, because the conditions have changed) is
> finally fixed. I've added those lines to rc.conf:
> rc_depend_strict="NO"
> rc_apache2_need="!net net.lo"
> rc_mysql_need="!net net.lo"
> rc_postgresql_9_0_need="!net net.lo"
> rc_pdnsd_need="!net net.lo"
> Apache no longer depends on inactive net.wifi.

Since you have removed net from the dependencies for the services you need things should be fine without changing the setting of rc_depend_strict. I recommend allowing that to stay "yes".
Comment 23 William Hubbs gentoo-dev 2011-02-15 08:17:59 UTC
(In reply to comment #22)
> (In reply to comment #21)
> > So my problem (not the original one, because the conditions have changed) is
> > finally fixed. I've added those lines to rc.conf:
> > rc_depend_strict="NO"
> > rc_apache2_need="!net net.lo"
> > rc_mysql_need="!net net.lo"
> > rc_postgresql_9_0_need="!net net.lo"
> > rc_pdnsd_need="!net net.lo"
> > Apache no longer depends on inactive net.wifi.
> Since you have removed net from the dependencies for the services you need
> things should be fine without changing the setting of rc_depend_strict. I
> recommend allowing that to stay "yes".

Oldrich,

can you please attempt resetting rc_depend_strict to yes and report back whether this breaks things? It should not because you have removed net from the dependencies with the rc_foo_need lines.
Once you do that, which is the correct way to set this up, the rc_depend_strict=no setting is not needed.
Comment 24 Oldrich Jedlicka 2011-02-15 16:41:20 UTC
(In reply to comment #23)
> can you please attempt resetting rc_depend_strict to yes and report back
> whether this breaks things? It should not because you have removed net from the
> dependencies with the rc_foo_need lines.
> Once you do that, which is the correct way to set this up, the
> rc_depend_strict=no setting is not needed.

I've tried it (rc_depend_strict=YES) and it works.
Comment 25 William Hubbs gentoo-dev 2011-02-16 15:38:03 UTC
I am closing this bug since your current issue is resolved. It also appears that the resolution to the old situation with sshd would have been to add:

rc_sshd_need="!net net.lo"

to rc.conf or:

rc_need="!net net.lo"

to /etc/conf.d/sshd.