Re: ntpdate not working

Connor McLaughlan <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc64
Message-ID <CABo1Du6RmkDCUX8gmOQLGc=DuzVnOS3cTLBYY-RzTY2r0v_Rdg@mail.gmail.com>
On Fri, Dec 25, 2020 at 1:44 PM Martin Husemann <[email protected]> wrote:
>
> On Fri, Dec 25, 2020 at 01:33:17PM +0100, Connor McLaughlan wrote:
> > ntpdate=YES is set in /etc/rc.conf, however on boot i don't see any
> > message regarding setting the time and the system time stays on a
> > wrong value.
>
> Probably it could not reach a suitable server.
> What happens if you manually run
>
>         /etc/rc.d/ntpdate start
>
> later?
>
> > >From my understanding if no option is given, it should read
> > /etc/ntp.conf, fetch probably 2.netbsd.pool.ntp.org and set the time.
>
> I don't think that is correct.
>
> > It works if i execute it directly:
> > bash-5.0# ntpdate 2.netbsd.pool.ntp.org
> > 25 Dec 13:09:37 ntpdate[1000]: adjust time server 79.133.44.136 offset
> > 0.072278 sec
>
> All my sparc64 machines have prettty good clocks even when the machine
> is turned off, so I don't take special care for initial time sync on
> them (but just turn on ntpd=YES in rc.conf). On other machines I avoid
> ntpdate and instaead run ntpd with ntpd_flags=-g (basically allowing ntpd
> something similar to ntpdate at first sync).
>
> Martin

Hi Martin,

i found the cause; there seems to be a problem within NetBSD 9.1

On a NetBSD 9.0 machine it works correctly and /etc/ntp.conf contains
at the end:
server          0.netbsd.pool.ntp.org
server          1.netbsd.pool.ntp.org
server          2.netbsd.pool.ntp.org
server          3.netbsd.pool.ntp.org

On NetBSD 9.1 /etc/ntp.conf contains:
pool 2.netbsd.pool.ntp.org iburst

But the script /etc/rc.d/ntpdate does not lookt for "pool" it still
looks for "server":

ntpdate_start()
{
        if [ -z "$ntpdate_hosts" ]; then
                ntpdate_hosts=$(awk '
                        /^#/                            { next }
                        /^(server|peer)[ \t]*127.127/   { next }
                        /^(server|peer)/                { if ($2 ~ /^-[46]/)
                                                            print $3
                                                          else
                                                            print $2 }
                ' </etc/ntp.conf)


So others should have the problem too?

Regards,
Connor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.