Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Dec 2017 20:16:25 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 224126] rc.d/ntpd outputs fetch usage syntax (stable/11)
Message-ID:  <bug-224126-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224126

            Bug ID: 224126
           Summary: rc.d/ntpd outputs fetch usage syntax (stable/11)
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: jdc@koitsu.org

Note: this DOES NOT appear to be related to Bug 213448.

This morning I found the following in my daily run output (periodic daily) =
on
my stable/11 box:

=3D=3D=3D
...

Security check:
    (output mailed separately)
usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] URL ...
       fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] -h host -f file [-c dir]

Checking userland and kernel versions:
Userland and kernel are in sync.
...
=3D=3D=3D

Digging through old cron mails, this problem began November 28th (November =
27th
had no problem).  The system has not been rebuilt (world, mergemaster, etc.=
 --
system is running stable/11 r325712) or rebooted since November 24th.

I modified rc.conf to contain ntp_leapfile_fetch_verbose=3D"yes" and then r=
an
service ntpd onefetch to achieve the following output:

=3D=3D=3D
root@mambo:~ # service ntpd onefetch
ntp_src_leapfile version is 3676924800
ntp_db_leapfile version is 3676924800
not replacing /var/db/ntpd.leap-seconds.list with /etc/ntp/leap-seconds
Within ntp leapfile expiry limit, initiating fetch
fetching https://www.ietf.org/timezones/data/leap-seconds.list
usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] URL ...
       fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] -h host -f file [-c dir]

{very VERY long stall here}
=3D=3D=3D

pstree output showed the following:

=3D=3D=3D
 | \-+=3D 71172 root sshd: jdc [priv] (sshd)
 |   \-+- 71174 jdc sshd: jdc@pts/1 (sshd)
 |     \-+=3D 71175 jdc -bash (bash)
 |       \-+=3D 71176 root sudo su -
 |         \-+- 71177 root su -
 |           \-+=3D 71178 root -su (csh)
 |             \-+=3D 71181 root /bin/sh /etc/rc.d/ntpd onefetch
 |               \-+- 71200 root /bin/sh /etc/rc.d/ntpd onefetch
 |                 \--- 71201 root awk $1 =3D=3D "#$" { print $2 }
=3D=3D=3D

I then ^C'd the service ntpd onefetch and re-ran it under truss -af and fou=
nd
the following:

=3D=3D=3D
root@mambo:~ # truss -af service ntpd onefetch
...
71342: wait4(-1,{ EXITED,val=3D0 },0x0,0x0)        =3D 71358 (0x116be)
Within ntp leapfile expiry limit, initiating fetch
71342: write(1,"Within ntp leapfile expiry limit"...,51) =3D 51 (0x33)
fetching https://www.ietf.org/timezones/data/leap-seconds.list
71342: write(1,"fetching https://www.ietf.org/ti"...,63) =3D 63 (0x3f)
71342: stat("/sbin/fetch",0x7fffffffdbe8)        ERR#2 'No such file or
directory'
71342: stat("/bin/fetch",0x7fffffffdbe8)         ERR#2 'No such file or
directory'
71342: stat("/usr/sbin/fetch",0x7fffffffdbe8)    ERR#2 'No such file or
directory'
71342: stat("/usr/bin/fetch",{ mode=3D-r-xr-xr-x
,inode=3D81231,size=3D36400,blksize=3D32768 }) =3D 0 (0x0)
71360: <new process>
71342: vfork()                                   =3D 71360 (0x116c0)
71360: execve("/usr/bin/fetch",[ "fetch", "-mq", "-o",
"https://www.ietf.org/timezones/data/leap-seconds.list" ],0x801418790) =3D 0
(0x0)
71360: mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =3D
34366189568 (0x800627000)
...
usage: fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] URL ...
       fetch [-146AadFlMmnPpqRrsUv] [-B bytes] [--bind-address=3Dhost]
       [--ca-cert=3Dfile] [--ca-path=3Ddir] [--cert=3Dfile] [--crl=3Dfile]
       [-i file] [--key=3Dfile] [-N file] [--no-passive] [--no-proxy=3Dlist]
       [--no-sslv3] [--no-tlsv1] [--no-verify-hostname] [--no-verify-peer]
       [-o file] [--referer=3DURL] [-S bytes] [-T seconds]
       [--user-agent=3Dagent-string] [-w seconds] -h host -f file [-c dir]
71360: write(2,"usage: fetch [-146AadFlMmnPpqRrs"...,811) =3D 811 (0x32b)
...
=3D=3D=3D

Look closely at the execve() call arguments: there output file argument is
missing, which is why fetch is spewing usage syntax:

71360: execve("/usr/bin/fetch",[ "fetch", "-mq", "-o",
"https://www.ietf.org/timezones/data/leap-seconds.list" ],0x801418790) =3D 0
(0x0)

This call essentially correlates with ntpd_fetch_leapfile() in /etc/rc.d/nt=
pd:

=3D=3D=3D
...
        if ntpd_needfetch_leapfile ; then
                for url in $ntp_leapfile_sources ; do
                        $verbose fetching $url
                        fetch $ntp_leapfile_fetch_opts -o $ntp_tmp_leapfile
$url && break
                done
...
=3D=3D=3D

This means that $ntp_tmp_leapfile is somehow empty/undefined when the fetch=
 is
being attempted -- and that's the bug.

The long delay is an after-effect of get_ntp_leapfile_ver()'s use of awk.=20
AFAICT it's sitting around waiting for data it never gets because of the fa=
iled
fetch.

ntp-related stuff in my rc.conf and periodic.conf:

rc.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D
ntpd_enable=3D"yes"
ntpd_config=3D"/conf/ME/ntp.conf"
ntpd_sync_on_start=3D"yes"
ntpd_flags=3D"-4 -p /var/run/ntpd.pid -f /var/db/ntpd.drift"
ntp_leapfile_fetch_verbose=3D"yes"

periodic.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
daily_ntpd_avoid_congestion=3D"no"

ntp-related files and both file and leap second timestamps:

root@mambo:~ # ls -lT /etc/ntp/leap-seconds /var/db/ntpd.leap-seconds.list
-rw-r--r--  1 root  wheel  10408 Nov  9 08:37:13 2017 /etc/ntp/leap-seconds
-rw-r--r--  1 root  wheel  10408 Nov  9 08:37:13 2017
/var/db/ntpd.leap-seconds.list

root@mambo:~ # grep '^#\$' /etc/ntp/leap-seconds /var/db/ntpd.leap-seconds.=
list
/etc/ntp/leap-seconds:#$         3676924800
/var/db/ntpd.leap-seconds.list:#$        3676924800

/etc/rc.d/ntpd is:

# $FreeBSD: stable/11/etc/rc.d/ntpd 325256 2017-11-01 01:03:44Z cy $

/etc/periodic/daily/480.leapfile-ntpd is:

# $FreeBSD: stable/11/etc/periodic/daily/480.leapfile-ntpd 325256 2017-11-01
01:03:44Z cy $

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224126-8>