From owner-freebsd-bugs@freebsd.org Tue Dec 5 20:16:25 2017 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87078E76F34 for ; Tue, 5 Dec 2017 20:16:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 751166D08C for ; Tue, 5 Dec 2017 20:16:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id vB5KGPbB056007 for ; Tue, 5 Dec 2017 20:16:25 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 224126] rc.d/ntpd outputs fetch usage syntax (stable/11) Date: Tue, 05 Dec 2017 20:16:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jdc@koitsu.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 20:16:25 -0000 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: 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.=