Re: named and ntpd start order in rc.d
On Sat, 06 Dec 2008 01:11:38 +0100 cpghost <[EMAIL PROTECTED]> wrote: > RW wrote: > > I have a similar issue with PPP not having connected by the time > > ntpdate runs , so I just have a script that runs between named and > > ntpdate, and blocks waiting for access. > > > Those timing / start-order issues are getting more and more > annoying, IMHO. On my PPPoE / mpd5 connected systems, > it's the same problem: > * openntpd (from ports) can't start, because named is not ready > * pf can't parse /etc/pf.conf because the ng0 interface is not yet > there etc, etc, etc... > > Isn't there a generic way to delay some scripts from starting > until a specific subset is ready (say: networking fully up, > and named ready to reply)? Perhaps some keyword or class > to add to a startup script would be nice to have! I don't think there's a generic solution, but I've pasted my own script below, I think if you set "networkwait_ping_hosts" to a name, rather than IP addresses, it might solve both your problems. You'll be polling on dns, and then resyncing the pf rules. $ cat /usr/local/etc/rc.d/networkwait #!/bin/sh # # PROVIDE: networkwait # REQUIRE: named # BEFORE: ntpdate . /etc/rc.subr networkwait_enable=${networkwait_enable:-"NO"} name="networkwait" rcvar=`set_rcvar` stop_cmd=":" start_cmd="networkwait_start" networkwait_start(){ if [ "$networkwait_ping_hosts" ] ; then host_list="${networkwait_ping_hosts}" else # No hosts supplied - use external nameservers host_list=`awk '/^ *nameserver/ {print $2} '< /etc/resolv.conf | grep -E -v '^127\.0+\.0+\.0*1'` fi echo -n "Waiting for network access ... " while true ; do for inet_host in $host_list ; do if ping -nc1 $inet_host 2>&1 > /dev/null ; then echo "ping to ${inet_host} succeeded." # Re-Sync ipfilter and pf in case # they had failed DNS lookups /etc/rc.d/ipfilter resync /etc/rc.d/pf resync exit 0 fi done sleep 5 done } load_rc_config ${name} run_rc_command "$1" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
RW wrote: On Fri, 21 Nov 2008 16:47:50 -0800 "Nerius Landys" <[EMAIL PROTECTED]> wrote: I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd script, adding "named" to "REQUIRE" section in comments. In your opinion, is this a robust fix? For example the line in my /etc/rc.d/ntpd script that looks like so: # REQUIRE: DAEMON ntpdate cleanvar devfs would be changed to this: # REQUIRE: DAEMON ntpdate cleanvar devfs named This shouldn't be needed as ntpd already requires ntpdate and in turn ntpdate requires named. The issue is probably timing - that named isn't ready. I have a similar issue with PPP not having connected by the time ntpdate runs , so I just have a script that runs between named and ntpdate, and blocks waiting for access. Those timing / start-order issues are getting more and more annoying, IMHO. On my PPPoE / mpd5 connected systems, it's the same problem: * openntpd (from ports) can't start, because named is not ready * pf can't parse /etc/pf.conf because the ng0 interface is not yet there etc, etc, etc... Isn't there a generic way to delay some scripts from starting until a specific subset is ready (say: networking fully up, and named ready to reply)? Perhaps some keyword or class to add to a startup script would be nice to have! Thanks, --cpghost. -- Cordula's Web. http://www.cordula.ws/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
> That's not correct. BEFORE and REQUIRE are used by rcorder to > determine the ordering of the scripts without checking if they are > enabled. Actually all scripts get run - if you don't enable ntpdate then > rc.d/ntpdate still runs, but doesn't do anything. My mistake. But then I don't understand why enabling ntpdate in rc.conf fixed my problem of ntpd's DNS resolver child process not completing (returning). My guess was that NETWORK and named were guaranteed getting run before ntpd if I included ntpdate in rc.conf. I thought that perhaps NETWORK and named were not getting run before ntpd in my particular case when I didn't include ntpdate in rc.conf. But according to your information NETWORK and named scripts would get run before the ntpd script no matter if ntpdate was enabled in rc.conf or not (because NETWORK and named are required by ntpdate and ntpdate is required by ntpd). So why did enabling ntpdate in rc.conf fix my problem? ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
On Fri, 5 Dec 2008 13:22:29 -0800 "Nerius Landys" <[EMAIL PROTECTED]> wrote: > > This shouldn't be needed as ntpd already requires ntpdate and in > > turn ntpdate requires named. The issue is probably timing - that > > named isn't ready. > > Actually, the REQUIRE thing in the /etc/rc.d scripts means "if the > required service is enabled, start it before this one". It does not > mean "start the required service before this one". That's not correct. BEFORE and REQUIRE are used by rcorder to determine the ordering of the scripts without checking if they are enabled. Actually all scripts get run - if you don't enable ntpdate then rc.d/ntpdate still runs, but doesn't do anything. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
> This shouldn't be needed as ntpd already requires ntpdate and in > turn ntpdate requires named. The issue is probably timing - that named > isn't ready. Actually, the REQUIRE thing in the /etc/rc.d scripts means "if the required service is enabled, start it before this one". It does not mean "start the required service before this one". I had ntpd enabled but not ntpdate in my rc.conf. Therefore the ntpdate script which requires NETWORK and named did not get run. As mentioned earlier, my fix was to run ntpdate at bootup as well as ntpd. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
On Fri, 21 Nov 2008 16:47:50 -0800 "Nerius Landys" <[EMAIL PROTECTED]> wrote: > > I believe that the fix for this is to add a dependency > to /etc/rc.d/ntpd script, adding "named" to "REQUIRE" section in > comments. In your opinion, is this a robust fix? For example the > line in my /etc/rc.d/ntpd script that looks like so: > > # REQUIRE: DAEMON ntpdate cleanvar devfs > > would be changed to this: > > # REQUIRE: DAEMON ntpdate cleanvar devfs named This shouldn't be needed as ntpd already requires ntpdate and in turn ntpdate requires named. The issue is probably timing - that named isn't ready. I have a similar issue with PPP not having connected by the time ntpdate runs , so I just have a script that runs between named and ntpdate, and blocks waiting for access. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nerius Landys wrote: >> FreeBSD 7.0. I am having a problem when ntpd starts at bootup. It >> continues to have 2 processes running, the process which does the DNS lookup >> fails to exit, and ntpd fails to adjust the clock even after days of >> running. Immediately after bootup and several hours or days later this is >> what I get: >> >> # ps -U root | grep ntpd >> 87837 ?? Ss 0:00.03 /usr/sbin/ntpd -c /etc/ntp.conf -p >> /var/run/ntpd.pid >> 87838 ?? S 0:00.00 /usr/sbin/ntpd -c /etc/ntp.conf -p >> /var/run/ntpd.pid >> >> If I do a "/etc/rc.d/ntpd restart" on a running system it fixes the problem, >> and only one of the ntpd processes remains, and the clock gets adjusted. >> >> I have named running as a caching name server on my system. The contents of >> my /etc/resolv.conf: >> >> domain nerius.com >> nameserver 127.0.0.1 >> >> My /etc/rc.conf: >> >> ... >> named_enable="YES" >> ntpd_enable="YES" >> ... >> >> I believe that the problem with ntpd is that named is started AFTER ntpd. >> >> Trying to reproduce problem. On a running system. I shut down named. Then >> I restart ntpd, then I start named. I can reproduce the problem that >> happens on bootup - ntpd has 2 processes and does not adjust the clock. >> Restarting ntpd while named is running fixes the problem >> >> I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd >> script, adding "named" to "REQUIRE" section in comments. In your opinion, >> is this a robust fix? For example the line in my /etc/rc.d/ntpd script that >> looks like so: >> >> # REQUIRE: DAEMON ntpdate cleanvar devfs >> >> would be changed to this: >> >> # REQUIRE: DAEMON ntpdate cleanvar devfs named > > Modifying /etc/rc.d/ntpd in this manner did not fix the problem. I > still have 2 ntpd processes running indefinitely after bootup of the > system, until I manually issue a "/etc/rc.d/ntpd restart", after which > the ntpd runs fine. As a separate test, I tried adjusting my > resolv.conf to point to an external name server, and I disabled named > at startup, and used the original /etc/rc.d/ntpd. I still got the > same problem - 2 ntpd processes running indefinitely. > > Does anyone know why I'm getting 2 ntpd processes running after bootup > (and ntpd fails to adjust the clock as a result)? Any suggested fix > would be appreciated. Hi Nerius, I don't know why those processes are hung after boot, but in order to troubleshoot the problem, I suggest that you modify the /etc/rc.d/ntpd script to invoke ntpd from truss and log the output to a file, e.g. /tmp/truss.log.$$. Once you've rebooted, kill the processes and post the the log files on a web site somewhere so we can have a look at them. Also, what are the contents of your /etc/ntp.conf file? Best regards, Greg - -- Greg Larkin http://www.FreeBSD.org/ - The Power To Serve http://www.sourcehosting.net/ - Ready. Set. Code. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJNxW60sRouByUApARApi2AKC+p8UxGYtbdnF/SDGxB4yGV8mpOgCfTi8s yeb2mXFtkWw4OoDxrPWtkho= =O9RE -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
On Dec 3, 2008, at 1:01 PM, Nerius Landys wrote: [ ... ] Does anyone know why I'm getting 2 ntpd processes running after bootup (and ntpd fails to adjust the clock as a result)? Any suggested fix would be appreciated. When ntpd first starts up, it forks a child process to perform DNS resolution of the timeservers listed in its config. If that fails, that generally indicates that DNS was not working at the time, or something else was going wrong with the network. [ See ntpd/ntp_config.c, search for fork() or "ntpd_initres". ] The fix is to make sure that you have a working network and resolver available when you try to startup ntpd. Failing that, you can hardcode IP addresses in /etc/ntp.conf, but that's a bad idea for anything outside of timeservers which you control. -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
> When ntpd first starts up, it forks a child process to perform DNS > resolution of the timeservers listed in its config. If that fails, that > generally indicates that DNS was not working at the time, or something else > was going wrong with the network. > > [ See ntpd/ntp_config.c, search for fork() or "ntpd_initres". ] > > The fix is to make sure that you have a working network and resolver > available when you try to startup ntpd. Failing that, you can hardcode IP > addresses in /etc/ntp.conf, but that's a bad idea for anything outside of > timeservers which you control. > Thank you! That explains the problem. I had a hunch that the problem was along these lines. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
> I don't know why those processes are hung after boot, but in order to > troubleshoot the problem, I suggest that you modify the /etc/rc.d/ntpd > script to invoke ntpd from truss and log the output to a file, e.g. > /tmp/truss.log.$$. Once you've rebooted, kill the processes and post > the the log files on a web site somewhere so we can have a look at them. Um, the truss thing is a little over my head. I don't think I have the cranium capacity for this. Sorry. > Also, what are the contents of your /etc/ntp.conf file? Here is my ntp.conf: server 0.us.pool.ntp.org server 1.us.pool.ntp.org server 2.us.pool.ntp.org server 3.us.pool.ntp.org restrict default kod nomodify notrap nopeer noquery ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
>> FreeBSD 7.0. I am having a problem when ntpd starts at bootup. It >> continues to have 2 processes running, the process which does the DNS lookup >> fails to exit, and ntpd fails to adjust the clock even after days of >> running. Immediately after bootup and several hours or days later this is >> what I get: >> >> # ps -U root | grep ntpd >> 87837 ?? Ss 0:00.03 /usr/sbin/ntpd -c /etc/ntp.conf -p >> /var/run/ntpd.pid >> 87838 ?? S 0:00.00 /usr/sbin/ntpd -c /etc/ntp.conf -p >> /var/run/ntpd.pid >> >> If I do a "/etc/rc.d/ntpd restart" on a running system it fixes the problem, >> and only one of the ntpd processes remains, and the clock gets adjusted. >> >> I have named running as a caching name server on my system. The contents of >> my /etc/resolv.conf: >> >> domain nerius.com >> nameserver 127.0.0.1 >> >> My /etc/rc.conf: >> >> ... >> named_enable="YES" >> ntpd_enable="YES" >> ... >> >> I believe that the problem with ntpd is that named is started AFTER ntpd. >> >> Trying to reproduce problem. On a running system. I shut down named. Then >> I restart ntpd, then I start named. I can reproduce the problem that >> happens on bootup - ntpd has 2 processes and does not adjust the clock. >> Restarting ntpd while named is running fixes the problem >> >> I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd >> script, adding "named" to "REQUIRE" section in comments. In your opinion, >> is this a robust fix? For example the line in my /etc/rc.d/ntpd script that >> looks like so: >> >> # REQUIRE: DAEMON ntpdate cleanvar devfs >> >> would be changed to this: >> >> # REQUIRE: DAEMON ntpdate cleanvar devfs named > > Modifying /etc/rc.d/ntpd in this manner did not fix the problem. I > still have 2 ntpd processes running indefinitely after bootup of the > system, until I manually issue a "/etc/rc.d/ntpd restart", after which > the ntpd runs fine. As a separate test, I tried adjusting my > resolv.conf to point to an external name server, and I disabled named > at startup, and used the original /etc/rc.d/ntpd. I still got the > same problem - 2 ntpd processes running indefinitely. > > Does anyone know why I'm getting 2 ntpd processes running after bootup > (and ntpd fails to adjust the clock as a result)? Any suggested fix > would be appreciated. > I figured out a fix for this problem! I add ntpdate_enable="YES" to my /etc/rc.conf. As a result, after bootup ntpd is running only one process and the clock gets adjusted gradually after I set it back 30 seconds. So why does running ntpdate at bootup fix the ntpd 2 process hanging problem? Well I had a look at /etc/rc.d/ntpdate: # REQUIRE: NETWORKING syslogd named And, ntpd requires ntpdate. So maybe NETWORKING is the answer to this problem. Without NETWORKING DNS lookups cannot happen and the ntpd process that does the DNS lookups hangs. So it sounds like if you are gonna run ntpd at startup you'd better run ntpdate as well. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
> FreeBSD 7.0. I am having a problem when ntpd starts at bootup. It > continues to have 2 processes running, the process which does the DNS lookup > fails to exit, and ntpd fails to adjust the clock even after days of > running. Immediately after bootup and several hours or days later this is > what I get: > > # ps -U root | grep ntpd > 87837 ?? Ss 0:00.03 /usr/sbin/ntpd -c /etc/ntp.conf -p > /var/run/ntpd.pid > 87838 ?? S 0:00.00 /usr/sbin/ntpd -c /etc/ntp.conf -p > /var/run/ntpd.pid > > If I do a "/etc/rc.d/ntpd restart" on a running system it fixes the problem, > and only one of the ntpd processes remains, and the clock gets adjusted. > > I have named running as a caching name server on my system. The contents of > my /etc/resolv.conf: > > domain nerius.com > nameserver 127.0.0.1 > > My /etc/rc.conf: > > ... > named_enable="YES" > ntpd_enable="YES" > ... > > I believe that the problem with ntpd is that named is started AFTER ntpd. > > Trying to reproduce problem. On a running system. I shut down named. Then > I restart ntpd, then I start named. I can reproduce the problem that > happens on bootup - ntpd has 2 processes and does not adjust the clock. > Restarting ntpd while named is running fixes the problem > > I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd > script, adding "named" to "REQUIRE" section in comments. In your opinion, > is this a robust fix? For example the line in my /etc/rc.d/ntpd script that > looks like so: > > # REQUIRE: DAEMON ntpdate cleanvar devfs > > would be changed to this: > > # REQUIRE: DAEMON ntpdate cleanvar devfs named Modifying /etc/rc.d/ntpd in this manner did not fix the problem. I still have 2 ntpd processes running indefinitely after bootup of the system, until I manually issue a "/etc/rc.d/ntpd restart", after which the ntpd runs fine. As a separate test, I tried adjusting my resolv.conf to point to an external name server, and I disabled named at startup, and used the original /etc/rc.d/ntpd. I still got the same problem - 2 ntpd processes running indefinitely. Does anyone know why I'm getting 2 ntpd processes running after bootup (and ntpd fails to adjust the clock as a result)? Any suggested fix would be appreciated. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: named and ntpd start order in rc.d
On Saturday 22 November 2008 01:47:50 Nerius Landys wrote: > Trying to reproduce problem. On a running system. I shut down named. Then > I restart ntpd, then I start named. I can reproduce the problem that > happens on bootup - ntpd has 2 processes and does not adjust the clock. > Restarting ntpd while named is running fixes the problem > > I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd > script, adding "named" to "REQUIRE" section in comments. In your opinion, > is this a robust fix? For example the line in my /etc/rc.d/ntpd script > that looks like so: > > # REQUIRE: DAEMON ntpdate cleanvar devfs > > would be changed to this: > > # REQUIRE: DAEMON ntpdate cleanvar devfs named Thanks! It seems that's what been going wrong ever since 6.3 or so on my machine as well. You can report it using send-pr(1), however - you will have to test what happens if you comment out named_enable="YES" in /etc/rc.conf, then update /etc/resolv.conf to use your ISP's DNS servers and reboot. If ntpd does not start at all then ("because you told it it requires named"), then it's not the proper fix. However, I believe REQUIRE is only used for ordering the scripts, not actually disabling one if a service in the REQUIRE line isn't started. -- Mel Problem with today's modular software: they start with the modules and never get to the software part. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
named and ntpd start order in rc.d
FreeBSD 7.0. I am having a problem when ntpd starts at bootup. It continues to have 2 processes running, the process which does the DNS lookup fails to exit, and ntpd fails to adjust the clock even after days of running. Immediately after bootup and several hours or days later this is what I get: # ps -U root | grep ntpd 87837 ?? Ss 0:00.03 /usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid 87838 ?? S 0:00.00 /usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid If I do a "/etc/rc.d/ntpd restart" on a running system it fixes the problem, and only one of the ntpd processes remains, and the clock gets adjusted. I have named running as a caching name server on my system. The contents of my /etc/resolv.conf: domain nerius.com nameserver 127.0.0.1 My /etc/rc.conf: ... named_enable="YES" ntpd_enable="YES" ... I believe that the problem with ntpd is that named is started AFTER ntpd. Trying to reproduce problem. On a running system. I shut down named. Then I restart ntpd, then I start named. I can reproduce the problem that happens on bootup - ntpd has 2 processes and does not adjust the clock. Restarting ntpd while named is running fixes the problem I believe that the fix for this is to add a dependency to /etc/rc.d/ntpd script, adding "named" to "REQUIRE" section in comments. In your opinion, is this a robust fix? For example the line in my /etc/rc.d/ntpd script that looks like so: # REQUIRE: DAEMON ntpdate cleanvar devfs would be changed to this: # REQUIRE: DAEMON ntpdate cleanvar devfs named Also, should I report this as a bug to some sort of bug tracking system? Where? I really like FreeBSD and would like to see all bugs get fixed. Thanks for a great system to all of you. - Nerius ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"