Re: rc.d unbound daemon start order
> If an alternative server for syslogd, ldattach, pflogd, named, nsd, > ntpd, isakmpd, iked, sasyncd, or ldapd isn't suitable then why is it > even in ports ? Don't be a jerk. syslogd is obviously different -- it is the daemon which is started very early.
Re: rc.d unbound daemon start order
Mark Kettenis [mark.kette...@xs4all.nl] wrote: > > Perhaps not as stupid as you think. > > OpenBSD provides a complete base OS. In principle you only need to > install packages for add-on software. And there should be no need for > such add-on software to be started before the base system is up and > running. You only run into "problems" when you try to replace things > from the base system with stuff from ports. I'd argue that in that > case you're no longer running OpenBSD, and therefore it is a good > thing you need to go through some hoops in order to do this. > > In the particular case of unbound, there is some consensus that we > should replace BIND in base with nsd and unbound. But it seems nobody > actually cares enough to do the work to make this happen. If rc.d provides functionality, it should be usable in cases where you expect it to, or it should at least be documented why it is broken. If an alternative server for syslogd, ldattach, pflogd, named, nsd, ntpd, isakmpd, iked, sasyncd, or ldapd isn't suitable then why is it even in ports ? Some people have specific needs that most people don't? Some of these tools are generally known to be lower quality, yet stay in ports for the same reason. They're useful, but not encouraged. We don't want to make rc.d good enough to help these people because it's "another knob". So, the perception here is that rc.d is aimed at the "set it and forget it" folks who aren't qualified to use ports? Do you use rc.d? I use rc.d. And, probably like you, I used it because it was convenient. And, I am satisfied with it. So while I understand the arguments against fully implementing rc.d, I can't agree that I don't want the pkg_early_scripts convenience there for myself.
Re: rc.d unbound daemon start order
> Date: Fri, 10 Feb 2012 09:21:04 -0800 > From: Chris Cappuccio > > Stuart Henderson [s...@spacehopper.org] wrote: > > iirc there were some objections to it. > > > > I don't see any other way to accommodate ports that require early > start in the rc.d system other than to PUT THEM FIRST. Otherwise, > rc.d scripts for certain items need to be manually inserted into > /etc/rc. How stupid is that ? Perhaps not as stupid as you think. OpenBSD provides a complete base OS. In principle you only need to install packages for add-on software. And there should be no need for such add-on software to be started before the base system is up and running. You only run into "problems" when you try to replace things from the base system with stuff from ports. I'd argue that in that case you're no longer running OpenBSD, and therefore it is a good thing you need to go through some hoops in order to do this. In the particular case of unbound, there is some consensus that we should replace BIND in base with nsd and unbound. But it seems nobody actually cares enough to do the work to make this happen.
Re: rc.d unbound daemon start order
Antoine Jacoutot [ajacou...@bsdfrog.org] wrote: > > > > I don't see any other way to accommodate ports that require early start in > > the rc.d system other than to PUT THEM FIRST. Otherwise, rc.d scripts for > > certain items need to be manually inserted into /etc/rc. How stupid is that > > ? > > First calm down. > > For now you can try cp /etc/rc.d/syslog-ng /etc/rc.d/syslogd. > I'm not saying the current situation is perfect but what would be next after > pkg_early_scripts? pkg_late_scripts for stuffs that need to be started after > apm or cron or xdm ...? Honestly, I'm not aware of any examples where this is necessary. Where it actually is necessary is for items that replace system daemons that need to start earlier than everything else. Any example where you have to edit /etc/rc or have to replace /etc/rc.d scripts makes upgrades more complicated than need to be. Of course, replacing an /etc/rc.d script is preferrable to editing /etc/rc. Adding pkg_early_scripts which solves every problem and the only complaint is that it's 'another knob'. But as long as ports exist which need to start early, it's a useful knob that actually makes sense. > I don't want to introduce a new knob^variable for each and every situation, > sorry can't please everyone. > > That said we may be able to come with something else in the future I don't > know. > Like what?
Re: rc.d unbound daemon start order
On Fri, Feb 10, 2012 at 09:21:04AM -0800, Chris Cappuccio wrote: > Stuart Henderson [s...@spacehopper.org] wrote: > > iirc there were some objections to it. > > > > I don't see any other way to accommodate ports that require early start in > the rc.d system other than to PUT THEM FIRST. Otherwise, rc.d scripts for > certain items need to be manually inserted into /etc/rc. How stupid is that ? First calm down. For now you can try cp /etc/rc.d/syslog-ng /etc/rc.d/syslogd. I'm not saying the current situation is perfect but what would be next after pkg_early_scripts? pkg_late_scripts for stuffs that need to be started after apm or cron or xdm ...? I don't want to introduce a new knob^variable for each and every situation, sorry can't please everyone. That said we may be able to come with something else in the future I don't know. -- Antoine
Re: rc.d unbound daemon start order
Stuart Henderson [s...@spacehopper.org] wrote: > iirc there were some objections to it. > I don't see any other way to accommodate ports that require early start in the rc.d system other than to PUT THEM FIRST. Otherwise, rc.d scripts for certain items need to be manually inserted into /etc/rc. How stupid is that ?
Re: rc.d unbound daemon start order
iirc there were some objections to it. On 2012/02/10 11:14, Peter Bisroev wrote: > On Fri, Jan 6, 2012 at 14:16, Chris Cappuccio wrote: > > Peter Bisroev [pe...@int19h.net] wrote: > >> > >> Thank you for a quick response guys! Chris if you are talking about > >> modifying /etc/rc does that mean that there could be a plan in the > >> future to add that to the CVS? In the interim, should I test your > >> patch or is Stuart's way of starting unbound should be used for now? > >> > >> Cheers, > >> --peter > > > > This might be suitable to commit. Stuart? > > > > Index: etc/rc > > === > > RCS file: /cvs/src/etc/rc,v > > retrieving revision 1.397 > > diff -u -r1.397 rc > > --- etc/rc 9 Dec 2011 14:52:26 - 1.397 > > +++ etc/rc 6 Jan 2012 19:10:29 - > > @@ -232,6 +232,9 @@ > > if [ X"$1" = X"shutdown" ]; then > >dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 > > >/dev/null 2>&1 > >chmod 600 /var/db/host.random >/dev/null 2>&1 > > + if [ -n "${pkg_early_scripts}" ]; then > > + pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" > > + fi > >local _c=$? > >if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then > >echo -n 'stopping package daemons:' > > @@ -396,7 +399,14 @@ > > make_keys > > > > echo -n 'starting early daemons:' > > -start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd > > +start_daemon syslogd > > +# Run rc.d(8) early scripts from packages > > +if [ -n "${pkg_early_scripts}" ]; then > > + for _r in $pkg_early_scripts; do > > + [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} > > + done > > +fi > > +start_daemon ldattach pflogd named nsd ntpd isakmpd iked sasyncd > > start_daemon ldapd > > echo '.' > > > > Index: share/man/man8/rc.conf.8 > > === > > RCS file: /cvs/src/share/man/man8/rc.conf.8,v > > retrieving revision 1.19 > > diff -u -r1.19 rc.conf.8 > > --- share/man/man8/rc.conf.88 Jul 2011 17:43:58 - 1.19 > > +++ share/man/man8/rc.conf.86 Jan 2012 19:10:29 - > > @@ -103,7 +103,9 @@ > > .Pp > > The fourth section contains the > > .Va pkg_scripts > > -variable, responsible for starting and stopping > > +and > > +.Va pkg_early_scripts > > +variables, responsible for starting and stopping > > .Xr rc.d 8 > > scripts installed by packages in the specified order. > > For example, the following line > > @@ -120,6 +122,16 @@ > > argument at boot time and in reverse order with the > > .Va stop > > argument at shutdown. > > +Packages listed in the > > +.Va pkg_early_scripts > > +variable are started before any other system daemons, except syslogd. The > > +.Va pkg_early_scripts > > +variable is suitable for starting package daemons needed early, such > > +as syslog or resolver packages which are replacing system daemons. > > +Many packages can not be started early, as ldconfig has not initialized > > +the shared library cache for package libraries prior to the > > +.Va pkg_early_scripts > > +entry point. > > .Sh SEE ALSO > > .Xr init 8 , > > .Xr intro 8 , > > Index: share/man/man8/rc.d.8 > > === > > RCS file: /cvs/src/share/man/man8/rc.d.8,v > > retrieving revision 1.20 > > diff -u -r1.20 rc.d.8 > > --- share/man/man8/rc.d.8 9 Oct 2011 08:54:29 - 1.20 > > +++ share/man/man8/rc.d.8 6 Jan 2012 19:10:29 - > > @@ -45,7 +45,9 @@ > > .Xr packages 7 > > may be started at boot time in the order specified by the > > .Va pkg_scripts > > -variable from > > +and > > +.Va pkg_early_scripts > > +variables from > > .Xr rc.conf 8 ; > > the order will be reversed during shutdown. > > Services comprising > > > > Hi Chris, Stuart, > > What are your thoughts on this commit? Do you think that it will make > it to the next release? > > Thanks! > --peter
Re: rc.d unbound daemon start order
On Fri, Jan 6, 2012 at 14:16, Chris Cappuccio wrote: > Peter Bisroev [pe...@int19h.net] wrote: >> >> Thank you for a quick response guys! Chris if you are talking about >> modifying /etc/rc does that mean that there could be a plan in the >> future to add that to the CVS? In the interim, should I test your >> patch or is Stuart's way of starting unbound should be used for now? >> >> Cheers, >> --peter > > This might be suitable to commit. Stuart? > > Index: etc/rc > === > RCS file: /cvs/src/etc/rc,v > retrieving revision 1.397 > diff -u -r1.397 rc > --- etc/rc B B B 9 Dec 2011 14:52:26 - B B B 1.397 > +++ etc/rc B B B 6 Jan 2012 19:10:29 - > @@ -232,6 +232,9 @@ > B if [ X"$1" = X"shutdown" ]; then > B B B B dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 > B B B B chmod 600 /var/db/host.random >/dev/null 2>&1 > + B B B if [ -n "${pkg_early_scripts}" ]; then > + B B B B B B B pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" > + B B B fi > B B B B local _c=$? > B B B B if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then > B B B B B B B B echo -n 'stopping package daemons:' > @@ -396,7 +399,14 @@ > B make_keys > > B echo -n 'starting early daemons:' > -start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd > +start_daemon syslogd > +# Run rc.d(8) early scripts from packages > +if [ -n "${pkg_early_scripts}" ]; then > + B B B for _r in $pkg_early_scripts; do > + B B B B B B B [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} > + B B B done > +fi > +start_daemon ldattach pflogd named nsd ntpd isakmpd iked sasyncd > B start_daemon ldapd > B echo '.' > > Index: share/man/man8/rc.conf.8 > === > RCS file: /cvs/src/share/man/man8/rc.conf.8,v > retrieving revision 1.19 > diff -u -r1.19 rc.conf.8 > --- share/man/man8/rc.conf.8 B B 8 Jul 2011 17:43:58 - B B B 1.19 > +++ share/man/man8/rc.conf.8 B B 6 Jan 2012 19:10:29 - > @@ -103,7 +103,9 @@ > B .Pp > B The fourth section contains the > B .Va pkg_scripts > -variable, responsible for starting and stopping > +and > +.Va pkg_early_scripts > +variables, responsible for starting and stopping > B .Xr rc.d 8 > B scripts installed by packages in the specified order. > B For example, the following line > @@ -120,6 +122,16 @@ > B argument at boot time and in reverse order with the > B .Va stop > B argument at shutdown. > +Packages listed in the > +.Va pkg_early_scripts > +variable are started before any other system daemons, except syslogd. The > +.Va pkg_early_scripts > +variable is suitable for starting package daemons needed early, such > +as syslog or resolver packages which are replacing system daemons. > +Many packages can not be started early, as ldconfig has not initialized > +the shared library cache for package libraries prior to the > +.Va pkg_early_scripts > +entry point. > B .Sh SEE ALSO > B .Xr init 8 , > B .Xr intro 8 , > Index: share/man/man8/rc.d.8 > === > RCS file: /cvs/src/share/man/man8/rc.d.8,v > retrieving revision 1.20 > diff -u -r1.20 rc.d.8 > --- share/man/man8/rc.d.8 B B B 9 Oct 2011 08:54:29 - B B B 1.20 > +++ share/man/man8/rc.d.8 B B B 6 Jan 2012 19:10:29 - > @@ -45,7 +45,9 @@ > B .Xr packages 7 > B may be started at boot time in the order specified by the > B .Va pkg_scripts > -variable from > +and > +.Va pkg_early_scripts > +variables from > B .Xr rc.conf 8 ; > B the order will be reversed during shutdown. > B Services comprising > Hi Chris, Stuart, What are your thoughts on this commit? Do you think that it will make it to the next release? Thanks! --peter
Re: rc.d unbound daemon start order
Peter Bisroev [pe...@int19h.net] wrote: > > Thank you for a quick response guys! Chris if you are talking about > modifying /etc/rc does that mean that there could be a plan in the > future to add that to the CVS? In the interim, should I test your > patch or is Stuart's way of starting unbound should be used for now? > > Cheers, > --peter This might be suitable to commit. Stuart? Index: etc/rc === RCS file: /cvs/src/etc/rc,v retrieving revision 1.397 diff -u -r1.397 rc --- etc/rc 9 Dec 2011 14:52:26 - 1.397 +++ etc/rc 6 Jan 2012 19:10:29 - @@ -232,6 +232,9 @@ if [ X"$1" = X"shutdown" ]; then dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 chmod 600 /var/db/host.random >/dev/null 2>&1 + if [ -n "${pkg_early_scripts}" ]; then + pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" + fi local _c=$? if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then echo -n 'stopping package daemons:' @@ -396,7 +399,14 @@ make_keys echo -n 'starting early daemons:' -start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd +start_daemon syslogd +# Run rc.d(8) early scripts from packages +if [ -n "${pkg_early_scripts}" ]; then + for _r in $pkg_early_scripts; do + [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} + done +fi +start_daemon ldattach pflogd named nsd ntpd isakmpd iked sasyncd start_daemon ldapd echo '.' Index: share/man/man8/rc.conf.8 === RCS file: /cvs/src/share/man/man8/rc.conf.8,v retrieving revision 1.19 diff -u -r1.19 rc.conf.8 --- share/man/man8/rc.conf.88 Jul 2011 17:43:58 - 1.19 +++ share/man/man8/rc.conf.86 Jan 2012 19:10:29 - @@ -103,7 +103,9 @@ .Pp The fourth section contains the .Va pkg_scripts -variable, responsible for starting and stopping +and +.Va pkg_early_scripts +variables, responsible for starting and stopping .Xr rc.d 8 scripts installed by packages in the specified order. For example, the following line @@ -120,6 +122,16 @@ argument at boot time and in reverse order with the .Va stop argument at shutdown. +Packages listed in the +.Va pkg_early_scripts +variable are started before any other system daemons, except syslogd. The +.Va pkg_early_scripts +variable is suitable for starting package daemons needed early, such +as syslog or resolver packages which are replacing system daemons. +Many packages can not be started early, as ldconfig has not initialized +the shared library cache for package libraries prior to the +.Va pkg_early_scripts +entry point. .Sh SEE ALSO .Xr init 8 , .Xr intro 8 , Index: share/man/man8/rc.d.8 === RCS file: /cvs/src/share/man/man8/rc.d.8,v retrieving revision 1.20 diff -u -r1.20 rc.d.8 --- share/man/man8/rc.d.8 9 Oct 2011 08:54:29 - 1.20 +++ share/man/man8/rc.d.8 6 Jan 2012 19:10:29 - @@ -45,7 +45,9 @@ .Xr packages 7 may be started at boot time in the order specified by the .Va pkg_scripts -variable from +and +.Va pkg_early_scripts +variables from .Xr rc.conf 8 ; the order will be reversed during shutdown. Services comprising
Re: rc.d unbound daemon start order
On Thu, Jan 5, 2012 at 04:17, Chris Cappuccio wrote: > Stuart Henderson [s...@spacehopper.org] wrote: >> >> Alternatively I think it would work to add "!/etc/rc.d/unbound start" >> to a suitable hostname.if file, though that's a bit of a hack and this >> seems like a useful additioto use an alternative >> syslogd which is another good candidate for starting early) . > > This is slightly better for the unbound use case, keeps from adding another line of text at startup, and still works fine if you were going to usurp syslogd with an early script as well. > > --- /etc/rc B B Fri Dec B 9 10:13:53 2011 > +++ rc B Thu Jan B 5 01:00:21 2012 > @@ -232,6 +232,9 @@ > B if [ X"$1" = X"shutdown" ]; then > B B B B dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 > B B B B chmod 600 /var/db/host.random >/dev/null 2>&1 > + B B B if [ -n "${pkg_early_scripts}" ]; then > + B B B B B B B pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" > + B B B fi > B B B B local _c=$? > B B B B if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then > B B B B B B B B echo -n 'stopping package daemons:' > @@ -396,7 +399,14 @@ > B make_keys > > B echo -n 'starting early daemons:' > -start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd > +start_daemon syslogd > +# Run rc.d(8) early scripts from packages > +if [ -n "${pkg_early_scripts}" ]; then > + B B B for _r in $pkg_early_scripts; do > + B B B B B B B [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} > + B B B done > +fi > +start_daemon ldattach pflogd named nsd ntpd isakmpd iked sasyncd > B start_daemon ldapd > B echo '.' > Thank you for a quick response guys! Chris if you are talking about modifying /etc/rc does that mean that there could be a plan in the future to add that to the CVS? In the interim, should I test your patch or is Stuart's way of starting unbound should be used for now? Cheers, --peter
Re: rc.d unbound daemon start order
Stuart Henderson [s...@spacehopper.org] wrote: > > Alternatively I think it would work to add "!/etc/rc.d/unbound start" > to a suitable hostname.if file, though that's a bit of a hack and this > seems like a useful additioto use an alternative > syslogd which is another good candidate for starting early) . This is slightly better for the unbound use case, keeps from adding another line of text at startup, and still works fine if you were going to usurp syslogd with an early script as well. --- /etc/rc Fri Dec 9 10:13:53 2011 +++ rc Thu Jan 5 01:00:21 2012 @@ -232,6 +232,9 @@ if [ X"$1" = X"shutdown" ]; then dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 chmod 600 /var/db/host.random >/dev/null 2>&1 + if [ -n "${pkg_early_scripts}" ]; then + pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" + fi local _c=$? if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then echo -n 'stopping package daemons:' @@ -396,7 +399,14 @@ make_keys echo -n 'starting early daemons:' -start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd +start_daemon syslogd +# Run rc.d(8) early scripts from packages +if [ -n "${pkg_early_scripts}" ]; then + for _r in $pkg_early_scripts; do + [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} + done +fi +start_daemon ldattach pflogd named nsd ntpd isakmpd iked sasyncd start_daemon ldapd echo '.'
Re: rc.d unbound daemon start order
Stuart Henderson [s...@spacehopper.org] wrote: > > Alternatively I think it would work to add "!/etc/rc.d/unbound start" > to a suitable hostname.if file, though that's a bit of a hack and this > seems like a useful addition (some people like to use an alternative > syslogd which is another good candidate for starting early). After reading this, it occurs to me, syslogd should be moved above pkg_early_scripts initialization, so if you happen to be using the system syslogd, you won't miss any opening messages from unbound (e.g. "your config file is broke")
Re: rc.d unbound daemon start order
On 2012/01/04 23:48, Chris Cappuccio wrote: > Peter Bisroev [pe...@int19h.net] wrote: > > > > After looking in the 'starting early daemons:' section in /etc/rc I ccan > > see that > > named and nsd are started before ntpd. If named is used as a recursive > > caching > > DNS server everything would work as expected. But with nsd that would not > > be the > > case since it is an authoritative only server. > > I suspect you want a feature like this. It would give you a pkg_early_scripts > option to go in rc.conf.local along with your pkg_scripts. Alternatively I think it would work to add "!/etc/rc.d/unbound start" to a suitable hostname.if file, though that's a bit of a hack and this seems like a useful addition (some people like to use an alternative syslogd which is another good candidate for starting early).
Re: rc.d unbound daemon start order
Peter Bisroev [pe...@int19h.net] wrote: > > After looking in the 'starting early daemons:' section in /etc/rc I ccan see > that > named and nsd are started before ntpd. If named is used as a recursive caching > DNS server everything would work as expected. But with nsd that would not be > the > case since it is an authoritative only server. I suspect you want a feature like this. It would give you a pkg_early_scripts option to go in rc.conf.local along with your pkg_scripts. --- /etc/rc Fri Dec 9 10:13:53 2011 +++ rc Wed Jan 4 23:26:17 2012 @@ -232,6 +232,9 @@ if [ X"$1" = X"shutdown" ]; then dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 chmod 600 /var/db/host.random >/dev/null 2>&1 + if [ -n "${pkg_early_scripts}" ]; then + pkg_scripts="${pkg_scripts} ${pkg_early_scripts}" + fi local _c=$? if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then echo -n 'stopping package daemons:' @@ -394,6 +397,15 @@ dmesg >/var/run/dmesg.boot make_keys + +# Run rc.d(8) early scripts from packages +if [ -n "${pkg_early_scripts}" ]; then + echo -n 'starting early package daemons:' + for _r in $pkg_early_scripts; do + [ -x /etc/rc.d/${_r} ] && start_daemon ${_r} + done + echo '.' +fi echo -n 'starting early daemons:' start_daemon syslogd ldattach pflogd named nsd ntpd isakmpd iked sasyncd
rc.d unbound daemon start order
Hi All, I have tried searching the mailing lists but did not seem to find the answer to the problem that I am having. If someone can point me in the right direction I will really appreciate it. Currently I am testing this on OpenBSD 5.0 release. I am trying to use unbound from ports as a recursive caching DNS server. For the most part everything works great and as expected. The daemon's name, unbound, is added to 'pkg_scripts' in /etc/rc.conf.local and starts when the package daemons start. Unfortunately, there are services that start before unbound that require DNS resolution. For example, one such daemon is ntpd. After looking in the 'starting early daemons:' section in /etc/rc I can see that named and nsd are started before ntpd. If named is used as a recursive caching DNS server everything would work as expected. But with nsd that would not be the case since it is an authoritative only server. So, is it possible to start unbound with other early daemons without adding entries to /etc/rc? I know the situation that I have described above can be solved by manually restarting services dependent on the DNS server after unbound is started. But in general, what would be the right approach to address issues like these when the ports package replaces the functionality in base? For example, named functionality is replaced by nsd/unbound combination. Thanks! --peter