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.
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.
If you could supply better documentation for this, it would be great :)
(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.
Created attachment 150263 [details] My configuration
Try setting rc_depend_strict to yes
(In reply to comment #5) > Try setting rc_depend_strict to yes Yeah, that works. Kinda tricky :-)
You're also not the first to hit this, so maybe suggest better wording in /etc/rc.conf?
(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.
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"
documentation..
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.
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?
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 :-)
(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?
(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?
(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.
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.
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?
(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.
(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"
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.
(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".
(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.
(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.
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.