SliTaz SliTaz Forum

You are not logged in.

#1 2017-07-06 01:07:33

raj
Member
Registered: 2016-12-05
Posts: 20

ntpd won't start at boot need advice

Hello, I'm running Slitaz 5.0 (December 2016 release). My ntpd is not starting at boot. The boot message is "ntpd bad address pool.ntp.org" and it doesn't start.  If I run "ntpd -p pool.ntp.org" as root it starts and in about 10 seconds it sets my system time.

I've tried installing the ntp package and then removing it after many configuration changes. Right now my files in /etc are back to default.

/etc/daemons.conf:

NTPD_OPTIONS="-p pool.ntp.org"

/etc/rcS.conf

RUN_DAEMONS="firewall httpd ntpd"

There is a link in /etc/init.d/ntpd -> daemon

The boot message says its starting /etc/init.d/network.sh

and other network messages about wpa etc and then says Connecting to MYROUTER

several lines before it attempts to start the ntpd. After boot my network is fine, and I can start the ntpd manually.

Is there a fix? Why does it fail at boot? Is there a way to start it automatically after boot?

Thanks

Offline

#2 2017-07-06 05:40:29

kultex
Administrator
Registered: 2011-03-28
Posts: 1,175

Re: ntpd won't start at boot need advice

you can put

ntpd -p pool.ntp.org

to your /etc/init.d/locale.sh

if it does not work just put

sleep 10

before your ntpd command

Offline

#3 2017-07-06 07:35:43

raj
Member
Registered: 2016-12-05
Posts: 20

Re: ntpd won't start at boot need advice

Fixed.

It seems that the busybox ntpd takes a little while to engage and set the entry in /proc/???/status when contacting a pooled address like pool.ntp.org. 

I found that if I added a "sleep 3" after the command to load ntpd it has time to do its thing properly and everything works.

I added one line to /etc/init.d/daemon, the relevant part shown below.

case "$1" in

  start)

    grep -qs $DAEMON /etc/inetd.conf && active_inetd

    if active_pidfile $PIDFILE $NAME ; then

      _ '%s is already running.' $NAME

      exit 1

    fi

    action 'Starting %s: %s...' "$DESC" $NAME

    $DAEMON $OPTIONS

    sleep 3                                                     #<<< THIS IS THE NEW LINE >>>#

    [ -f $PIDFILE ] || pidof $NAME | awk '{print $1}' > $PIDFILE

    active_pidfile $PIDFILE $NAME

    status

    ;;

Offline

#4 2017-07-08 20:43:08

raj
Member
Registered: 2016-12-05
Posts: 20

Re: ntpd won't start at boot need advice

I just thought I should follow up. It appears that a 3 second delay was not sufficient. In the boot sequence the inetd get started right before the ntpd so I felt it was a good idea to give it extra time to complete before running the ntpd.

I have modified two lines in the /etc/init.d/daemon file, In the same chunk mentioned before I now have:

sleep 5

$DAEMON $OPTIONS

sleep 10

"sleep 10" replaces the "sleep 3" in the code of the previous post and the "sleep 5" is just above it.

Finally everything works as expected and the ntpd starts.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.019 seconds, 7 queries executed - Memory usage: 1.53 MiB (Peak: 1.77 MiB) ]