LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-01-2014, 09:22 AM   #1
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Rep: Reputation: 0
Unhappy Raspbian ntpq failing (nothing received)


Hi folks,
I'm having a problem with ntpq on one of my raspberry pi's - both are running raspbian and are up to date.
It seems as if ntp is working fine on both of them as they are keeping good time.

On the (older) raspberry pi, the ntpq -c rv command returns:-

pi@raspberrypi ~ $ ntpq -c rv
associd=0 status=c618 leap_alarm, sync_ntp, 1 event, no_sys_peer,
version="ntpd 4.2.6p5@1.2349-o Fri May 18 20:30:57 UTC 2012 (1)",
processor="armv6l", system="Linux/3.12.26-rpi-aufs", leap=11, stratum=3,
precision=-19, rootdelay=82.608, rootdisp=260.707, refid=46.235.147.2,
reftime=d827003a.d33867df Mon, Dec 1 2014 16:56:58.825,
clock=d8270040.f214ec33 Mon, Dec 1 2014 16:57:04.945, peer=50676, tc=6,
mintc=3, offset=0.000, frequency=-54.407, sys_jitter=0.173,
clk_jitter=1.295, clk_wander=0.000

whereas on the later, model B plus, pi the same query returns:-

pi@PiBplus:~$ ntpq -c rv
localhost: timed out, nothing received
***Request timed out

They both have identical /etc/ntp.conf and /etc/hosts files (apart from differing names in the /etc/hosts file).

I want this ntpq query to work on both as I am using its output to plot their timekeeping performance with MRTG.

Is there some other file I should be checking to see where the difference/problem is?
Any help/advice would be very welcome - I've spent quite a long time googling this problem without any luck !
Thanks
nigelh

Their /etc/ntp.conf files contain :-

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
# on pibplus
driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable


# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example

# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <http://www.pool.ntp.org/join.html>
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst


# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
 
Old 12-01-2014, 12:00 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
You can probably get the one that works to serve time to the other.
Have you pinged the ntp servers from the non-functional R-pi?
What about resolv.conf?
 
Old 12-01-2014, 01:04 PM   #3
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Hi business kid,
thanks for your reply.
/etc/resolv.conf on both pi's is the same :-
nameserver 8.8.8.8

I can ping the ntp servers fine from both of them - this is from the one that ntpq is NOT working on:-
pi@PiBplus:~$ ping pool.ntp.org
PING pool.ntp.org (178.79.155.116) 56(84) bytes of data.
64 bytes from nice.stuff.is (178.79.155.116): icmp_req=1 ttl=55 time=74.9 ms
64 bytes from nice.stuff.is (178.79.155.116): icmp_req=2 ttl=55 time=72.4 ms
64 bytes from nice.stuff.is (178.79.155.116): icmp_req=3 ttl=55 time=81.5 ms
64 bytes from nice.stuff.is (178.79.155.116): icmp_req=4 ttl=55 time=98.4 ms

I'm getting virtually the same result from the original one that ntpq IS working on

I am pretty sure that ntp is working OK on both - they are both showing exactly the same time when I use the date command

The problem is that "ntpq -c rv" is failing on the newer, model B+ raspberry pi.
Most odd!
Thanks anyway
Nigel
 
Old 12-02-2014, 04:37 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
What does 'ldd /usr/sbin/ntpq' show? BTW, that doesn't go here either. . .
Code:
bash-4.3$ sudo /usr/sbin/ntpq -c -rv
***Command `-rv' unknown
I'm on the same version - ntp-4.26p5

Last edited by business_kid; 12-02-2014 at 04:43 AM.
 
Old 12-02-2014, 09:42 AM   #5
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Hi again business_kid,
just tried that :-

pi@PiBplus:~$ ldd /usr/sbin/ntpq
ldd: /usr/sbin/ntpq: No such file or directory

and I got exactly the same on the raspberry pi that DOES respond to ntpq -c rv (not ntpq -c -rv by the way - no "dash" before rv)

pi@raspberrypi ~ $ ldd /usr/sbin/ntpq
ldd: /usr/sbin/ntpq: No such file or directory

Incidentally I've tried a complete removal and re install of ntp but still getting the same result.

I'm very confused by this and thanks for your help!!

nigelh
 
Old 12-02-2014, 10:14 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
well, /sbin & /usr/sbin are for services, so I would expect it there. Lazy way:

Code:
which ntpq
presuming it is in the path, it will be found - perhaps only as root. Slackware excludes /sbin & /usr/sbin from users path statements.
 
Old 12-02-2014, 11:07 AM   #7
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Hum - thanks - tried that on both and they report the same !

the one where ntpq -c rv works gives :-
pi@raspberrypi ~ $ which ntpq
/usr/bin/ntpq

and the new one, where ntpq -c rv fails, also gives :-
pi@PiBplus:~$ which ntpq
/usr/bin/ntpq

Thanks anyway !
nigelh
 
Old 12-03-2014, 03:10 AM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
did you try
ldd /usr/bin/ntpq or simply to check for problems

ldd /usr/bin/ntpq |grep found
 
Old 12-04-2014, 08:07 AM   #9
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks again, business_kid.
On the older raspberry pi, where the ntpq -c rv command works, ldd /usr/bin/ntpq returns:-

pi@raspberrypi ~ $ ldd /usr/bin/ntpq
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f18000)
libopts.so.25 => /usr/lib/libopts.so.25 (0xb6eeb000)
libedit.so.2 => /usr/lib/arm-linux-gnueabihf/libedit.so.2 (0xb6ec5000)
libcrypto.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0xb6d62000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6d53000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6d2b000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6bfb000)
/lib/arm-linux-gnueabihf/ld-linux.so.3 => /lib/ld-linux-armhf.so.3 (0xb6f26000)
libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0xb6be7000)
libtinfo.so.5 => /lib/arm-linux-gnueabihf/libtinfo.so.5 (0xb6bc3000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6bb8000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6b99000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6b7a000)


and on the newer, B+ pi, where ntpq -c nv fails, it returns :-

pi@PiBplus:~$ ldd /usr/bin/ntpq
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6ef7000)
libopts.so.25 => /usr/lib/libopts.so.25 (0xb6ec6000)
libedit.so.2 => /usr/lib/arm-linux-gnueabihf/libedit.so.2 (0xb6ea0000)
libcrypto.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0xb6d3d000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6d2e000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6d06000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6bd6000)
/lib/arm-linux-gnueabihf/ld-linux.so.3 => /lib/ld-linux-armhf.so.3 (0xb6f05000)
libbsd.so.0 => /lib/arm-linux-gnueabihf/libbsd.so.0 (0xb6bc2000)
libtinfo.so.5 => /lib/arm-linux-gnueabihf/libtinfo.so.5 (0xb6b9e000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6b93000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0xb6b74000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6b55000)

They look the same to me!

" ldd /usr/bin/ntpq |grep found " returns nothing on both of them.

Thanks for the thoughts.
Nigel
 
Old 12-04-2014, 12:01 PM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
It looks good.I have been caught out with ld-linux.so aka ld-2.xx.so, aka ld-lsb.so because the ldd finds it but the program (ge in particular) does not. But it looks good

Any ideas here for you? http://www.eecis.udel.edu/~mills/ntp/html/debug.html
 
Old 12-04-2014, 12:46 PM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Code:
localhost: timed out, nothing received
***Request timed out
This suggests a network problem, not an ntp problem.

You do not say if you are running any firewalls, I assume not.

This may help:

http://serverfault.com/questions/558...ways-times-out

It looks like an IP4 / IP6 problem.

[OFF-TOPIC]

I have both a PiB and a PiB+. They both work fine with ntp

I just did a ntpq -c rl and precision was reported as "-20" [0.000000954 s]. Good enough for me.

The PiB+ is my LAN ntp server ( at one time it was getting the time from a USB GPS dongle, but then I re-purposed the GPS dongle, as it didn't seem to be that accurate without the 1PPS signal it could not provide )

[/OFF-TOPIC]
 
Old 12-05-2014, 03:56 AM   #12
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Hi tredegar,
thanks for your reply.
No, I'm not running any firewalls.

On the PiB+ I can ping the time servers OK as well as localhost ((after adding "auto lo" to /etc/network/interfaces !) but still can't get ntpq -c rv to work.
I'll have a good read of the link you've sent - thanks for that.
A network problem does seem a possibility.

Good to hear that it is working, for you, on a PiB+ - at one stage I was wondering if it was B+ problem!

If I crack it, I'll report back.
regards
Nigel
 
Old 12-06-2014, 03:49 AM   #13
andre@home
Member
 
Registered: Oct 2003
Distribution: 2x Debian 8.1 webdav servers
Posts: 93

Rep: Reputation: 44
Check along these working ones for the differences:
http://www.debianadmin.com/ntp-serve...in-debian.html
http://www.debianadmin.com/ntp-serve...in-debian.html
 
Old 12-09-2014, 10:09 AM   #14
nigelh
LQ Newbie
 
Registered: Dec 2007
Location: North Cyprus
Distribution: Gentoo
Posts: 9

Original Poster
Rep: Reputation: 0
Hi folks,
quite by chance, I've solved the problem !
Because of a power cut, the raspberry pi B plus with the ntpq problem was powered off and back on about 15 minutes later and, bingo, the ntpq -c rv command worked and I can ping localhost!
Up to then I had been doing a soft reboot - seems like it needed a complete reset !
Thanks for all your help
Nigel
 
Old 12-09-2014, 01:24 PM   #15
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks for the follow-up.

My Raspberries only get rebooted after a kernel update, or when I have tripped over the power cable.

Your problem is solved, perhaps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ntpq -p: Connection refused stf92 Slackware 29 11-14-2014 09:16 AM
Cronjob in Raspbian failing monkeyslut Linux - Newbie 14 09-25-2014 11:52 AM
nagios check_ntp_time offset different from ntpq -p thllgo Linux - Software 5 05-04-2011 08:59 AM
ntpq bsk66 Linux - Newbie 4 04-02-2009 09:10 AM
Not sure about ntpq -pn output.... r_jensen11 Linux - General 5 07-01-2004 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration