OpenWrt Forum Archive

Topic: Bug in ntpclient init.d script in experimental 2005-04-23

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am testing the 2005-04-23 experimental build (binaries from the OpenWrt site, not self-compiled) and I have just found that the ntpclient init script still has the same bug as in the older experimental versions.

When the WRT is not connected to internet, ntpclient cannot resolve the ntp server's name, and locks the boot process until it times out (or until I connect the WAN cable). Simply adding an "&" in the /etc/init.d/S41ntpclient script allows for the boot process to complete even if the WAN interface is disconnected, still ntpclient starts and when WAN is connected the clock is set correctly.

I don't know how to (and if I can) submit a patch to the CVS repository.

No, it is not. Your file reads:

#!/bin/sh
/usr/sbin/ntpclient -c 1 -s -h pool.ntp.org

My simple modification is as follows:

#!/bin/sh
/usr/sbin/ntpclient -c 1 -s -h pool.ntp.org &

Not sure about the '&' but I added it...  However... the '-c 1' is not needed, redundant, at least according to the readme.

<SNIP> -s           simple clock set (implies -c 1)</SNIP>

Wait... Why do you need the '&'?

Not totally convinced you need it.

Try if you like. If you don't put the "&" at the end of the line, and your dns is unreachable for some reason, your boot will stall for some minutes before the dns request times out and then the boot goes on. I have tried it myself. The boot process actually goes on, but after a very long and annoying delay.

(Last edited by Kurgan on 22 May 2005, 18:17)

Kurgan wrote:

Try if you like. If you don't put the "&" at the end of the line, and your dns is unreachable for some reason, your boot will stall for some minutes before the dns request times out and then the boot goes on. I have tried it myself. The boot process actually goes on, but after a very long and annoying delay.

I have encountered the same problem. So I used background (&) to put ntpclient in background. Also, you can rename S50clientntp to S98ntpclient. The task for updating time is not very important and shoud be call in the last tasks in boot process.

The discussion might have continued from here.