Forum

Full Version: NTP doesn't work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Dzintars Bergs

Any ideas why NTP isn't working? NTPD service is running. I cant find any ntp related logs in /var/log.
All latest updates are installed, running on Pi2.

/etc/ntp.conf:
Terminal
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

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>
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.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 limited
restrict -6 default kod notrap nomodify nopeer noquery limited

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

# Needed for adding pool entries
restrict source notrap nomodify noquery

# 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
No idea Dodgy

What's the output of

Code:
ntpq -p

Dzintars Bergs

(15th Mar, 2018 12:37 AM)Nachteule Wrote: [ -> ]No idea Dodgy

What's the output of

Code:
ntpq -p

Terminal
root@pi2 ~ # ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
localhost: timed out, nothing received
***Request timed out
Oops, can you ping the servers ({0,1,2,3}.debian.pool.ntp.org) ?

Dzintars Bergs

I can ping all of them
Terminal
root@pi2 ~ # ping 0.debian.pool.ntp.org
PING 0.debian.pool.ntp.org (162.210.110.4) 56(84) bytes of data.
64 bytes from resolver1.skyfiberinternet.com (162.210.110.4): icmp_seq=1 ttl=49 time=182 ms
64 bytes from resolver1.skyfiberinternet.com (162.210.110.4): icmp_seq=2 ttl=49 time=185 ms
64 bytes from resolver1.skyfiberinternet.com (162.210.110.4): icmp_seq=3 ttl=49 time=181 ms

Huh
Ok, so next question(s):

Did NTP ever work?

Maybe you have firewall that blocks ntp (in and/or out) packages

I've already read in a different forum (different OS), that there are providers blocking ntp packages and forcing clients to use their own ntp server

Dzintars Bergs

It worked before. Guess I have to check my firewall. Thaks for help!
(15th Mar, 2018 05:08 AM)Dzintars Bergs Wrote: [ -> ]
Terminal
root@pi2 ~ # ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
localhost: timed out, nothing received
***Request timed out

Is the ntp daemon running ?

Code:
sudo status ntp

If not, you can try start here up with:

Code:
sudo start ntp

And check below ones :

Code:
sudo status ntp

Code:
ntpq -p

Code:
sudo zcat /var/log/upstart/ntp.log.1.gz

Dzintars Bergs

NTP service is running, that's not the problem.

Upstart log contains only records like those:
Terminal
18 Mar 21:13:45 ntpd[4809]: Soliciting pool server 89.111.54.85
18 Mar 21:14:12 ntpd[4809]: Soliciting pool server 103.242.70.4
18 Mar 21:14:25 ntpd[4809]: Soliciting pool server 89.111.15.218
18 Mar 21:14:37 ntpd[4809]: Soliciting pool server 2001:738:0:810:1::162
18 Mar 21:14:52 ntpd[4809]: Soliciting pool server 84.245.235.193
18 Mar 21:15:19 ntpd[4809]: Soliciting pool server 195.122.19.73
18 Mar 21:15:32 ntpd[4809]: Soliciting pool server 178.16.23.50
18 Mar 21:15:41 ntpd[4809]: Soliciting pool server 2a02:e00:ffec:2d9::1
18 Mar 21:15:56 ntpd[4809]: Soliciting pool server 84.245.235.193
18 Mar 21:16:26 ntpd[4809]: Soliciting pool server 85.254.217.235
18 Mar 21:16:39 ntpd[4809]: Soliciting pool server 89.111.15.218
18 Mar 21:16:47 ntpd[4809]: Soliciting pool server 2a00:d880:5:93b::7777
18 Mar 21:17:01 ntpd[4809]: Soliciting pool server 89.111.54.85
18 Mar 21:17:33 ntpd[4809]: Soliciting pool server 195.122.19.73
18 Mar 21:17:43 ntpd[4809]: Soliciting pool server 178.16.23.50
18 Mar 21:17:54 ntpd[4809]: Soliciting pool server 85.254.216.1
18 Mar 21:18:08 ntpd[4809]: Soliciting pool server 51.255.33.56
18 Mar 21:18:40 ntpd[4809]: Soliciting pool server 85.254.217.235
18 Mar 21:18:48 ntpd[4809]: Soliciting pool server 89.111.15.218
18 Mar 21:18:58 ntpd[4809]: Soliciting pool server 84.245.235.193
18 Mar 21:19:12 ntpd[4809]: Soliciting pool server 72.14.183.39
18 Mar 21:19:44 ntpd[4809]: Soliciting pool server 178.16.23.50
18 Mar 21:19:55 ntpd[4809]: Soliciting pool server 195.122.19.73
18 Mar 21:20:04 ntpd[4809]: Soliciting pool server 2a01:4f8:221:43c5::2
18 Mar 21:20:16 ntpd[4809]: Soliciting pool server 31.28.161.68
18 Mar 21:20:51 ntpd[4809]: Soliciting pool server 89.111.54.85
18 Mar 21:21:02 ntpd[4809]: Soliciting pool server 83.241.47.64
And you don't have messages like this in ntp.log?

Code:
18 Mar 21:00:13 ntpd[5066]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 22:00:44 UTC 2018 (1): Starting
18 Mar 21:00:13 ntpd[5066]: Command line: /usr/sbin/ntpd -n -g -L -U 1 -u 102:104
18 Mar 21:00:13 ntpd[5066]: proto: precision = 0.625 usec (-21)
restrict 0.0.0.0: KOD does nothing without LIMITED.
18 Mar 21:00:13 ntpd[5066]: restrict 0.0.0.0: KOD does nothing without LIMITED.
restrict ::: KOD does nothing without LIMITED.
18 Mar 21:00:13 ntpd[5066]: restrict ::: KOD does nothing without LIMITED.
18 Mar 21:00:13 ntpd[5066]: restrict: ignoring line 39, mask '::' unusable.
18 Mar 21:00:13 ntpd[5066]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING

Dzintars Bergs

(19th Mar, 2018 06:03 AM)Nachteule Wrote: [ -> ]And you don't have messages like this in ntp.log?

No, only "Soliciting pool server...".
(21st Mar, 2018 11:04 PM)Dzintars Bergs Wrote: [ -> ]
(19th Mar, 2018 06:03 AM)Nachteule Wrote: [ -> ]And you don't have messages like this in ntp.log?

No, only "Soliciting pool server...".

Sounds for me that ntp never has been started

Could you please run commands as follows:

Code:
sudo stop ntp
sudo rm -f /var/log/upstart/ntp.log
sudo start ntp
sudo cat /var/log/upstart/ntp.log

The output should look like this

Terminal

root@kmxbilr2 /etc/default # stop ntp
ntp stop/waiting
root@kmxbilr2 /etc/default # rm -f /var/log/upstart/ntp.log
root@kmxbilr2 /etc/default # start ntp
ntp start/running, process 7895
root@kmxbilr2 /etc/default # cat /var/log/upstart/ntp.log
21 Mar 20:25:37 ntpd[7895]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 22:00:44 UTC 2018 (1): Starting
21 Mar 20:25:37 ntpd[7895]: Command line: /usr/sbin/ntpd -n -g -L -U 1 -u 102:104
21 Mar 20:25:37 ntpd[7895]: proto: precision = 0.677 usec (-20)
restrict 0.0.0.0: KOD does nothing without LIMITED.
21 Mar 20:25:37 ntpd[7895]: restrict 0.0.0.0: KOD does nothing without LIMITED.
restrict ::: KOD does nothing without LIMITED.
21 Mar 20:25:37 ntpd[7895]: restrict ::: KOD does nothing without LIMITED.
21 Mar 20:25:37 ntpd[7895]: restrict: ignoring line 39, mask '::' unusable.
21 Mar 20:25:37 ntpd[7895]: Listen and drop on 0 v4wildcard 0.0.0.0:123
21 Mar 20:25:37 ntpd[7895]: Listen normally on 1 lo 127.0.0.1:123
21 Mar 20:25:37 ntpd[7895]: Listen normally on 2 eth0 192.168.1.24:123
21 Mar 20:25:37 ntpd[7895]: Listening on routing socket on fd #19 for interface updates
root@kmxbilr2 /etc/default #

Dzintars Bergs

stop dosen't work for me
Terminal
root@pi2 ~ # stop ntp
stop: Unknown instance:

I tried with init.d, bet after that upstart log was empty
Terminal
root@pi2 ~ # /etc/init.d/ntp stop
[ ok ] Stopping NTP server: ntpd.
root@pi2 ~ # rm -f /var/log/upstart/ntp.log
root@pi2 ~ # /etc/init.d/ntp start
[ ok ] Starting NTP server: ntpd.
root@pi2 ~ # cat /var/log/upstart/ntp.log
cat: /var/log/upstart/ntp.log: No such file or directory

After reboot upstart log looked like this
Terminal
root@pi2 ~ # cat /var/log/upstart/ntp.log
22 Mar 15:50:16 ntpd[3311]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 22:00:44 UTC 2018 (1): Starting
22 Mar 15:50:16 ntpd[3311]: Command line: /usr/sbin/ntpd -n -g -L -U 1 -u 109:112 -c /var/lib/ntp/ntp.conf.dhcp
22 Mar 15:50:16 ntpd[3311]: proto: precision = 1.823 usec (-19)
22 Mar 15:50:16 ntpd[3311]: restrict: ignoring line 36, mask '::' unusable.
22 Mar 15:50:16 ntpd[3311]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING
Sorry to jump in here, but those last 2 lines in your upstart log I have seen here too.....It started about 2 months ago and I get an email every night with 2 lines like this.....

Terminal

22 Mar 00:09:02 ntpd[12642]: restrict: ignoring line 37, mask '::' unusable.
22 Mar 00:09:02 ntpd[12642]: unable to bind to wildcard address 0.0.0.0 - another process may be running - EXITING

Happens on all Xbian pi using RTC and updating via the NTP servers nightly.

I noticed that the "....mask '::'" bit is also in Nachteules log, but not the failed binding, so maybe a clue here? Huh
Hmmmm.....This is what I get after running @nachteules' commands...

Terminal

xbian@cinema2film ~ $ sudo stop ntp
ntp stop/waiting
xbian@cinema2film ~ $ sudo rm -f /var/log/upstart/ntp.log
xbian@cinema2film ~ $ sudo start ntp
ntp start/running, process 10128
xbian@cinema2film ~ $ sudo cat /var/log/upstart/ntp.log
28 Apr 16:51:06 ntpd[10128]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 22:00:44 UTC 2018 (1): Starting
28 Apr 16:51:06 ntpd[10128]: Command line: /usr/sbin/ntpd -n -g -L -U 1 -u 109:112
28 Apr 16:51:06 ntpd[10128]: proto: precision = 1.198 usec (-20)
28 Apr 16:51:06 ntpd[10128]: restrict: ignoring line 37, mask '::' unusable.
28 Apr 16:51:06 ntpd[10128]: Listen and drop on 0 v4wildcard 0.0.0.0:123
28 Apr 16:51:06 ntpd[10128]: Listen normally on 1 lo 127.0.0.1:123
28 Apr 16:51:06 ntpd[10128]: Listen normally on 2 eth0 192.168.1.12:123
28 Apr 16:51:06 ntpd[10128]: Listening on routing socket on fd #19 for interface updates
28 Apr 16:51:07 ntpd[10128]: Soliciting pool server 129.70.132.37
28 Apr 16:51:08 ntpd[10128]: Soliciting pool server 144.76.102.204
28 Apr 16:51:09 ntpd[10128]: Soliciting pool server 176.9.42.71
28 Apr 16:51:09 ntpd[10128]: Soliciting pool server 185.233.106.45
28 Apr 16:51:10 ntpd[10128]: Soliciting pool server 131.234.137.63
28 Apr 16:51:10 ntpd[10128]: Soliciting pool server 173.249.29.54
28 Apr 16:51:10 ntpd[10128]: Soliciting pool server 212.83.44.18
28 Apr 16:51:11 ntpd[10128]: Soliciting pool server 145.239.0.195
28 Apr 16:51:11 ntpd[10128]: Soliciting pool server 46.4.88.180
28 Apr 16:51:11 ntpd[10128]: Soliciting pool server 80.153.195.191
28 Apr 16:51:12 ntpd[10128]: Soliciting pool server 129.70.132.32
28 Apr 16:51:12 ntpd[10128]: Soliciting pool server 5.199.135.170
xbian@cinema2film ~ $
Reference URL's