0

Raspberry Pi GPS Stratum 1 NTP Server
Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Please be positive and constructive with your questions and comments.

Re: Raspberry Pi GPS Stratum 1 NTP Server

by tom_w on Mon May 09, 2016 8:31 pm

samr wrote:can you post the output from the command "grep ntp /var/log/syslog" and "sudo service ntp status" ?


Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi:~ $ grep ntp /var/log/syslog
Mar 18 08:58:35 raspberrypi kernel: [    0.002049] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mar 18 08:58:35 raspberrypi ntpd[491]: ntpd 4.2.6p5@1.2349-o Mon Nov  2 04:29:47 UTC 2015 (1)
Mar 18 08:58:35 raspberrypi ntp[461]: Starting NTP server: ntpd.
Mar 18 08:58:36 raspberrypi ntpd[521]: proto: precision = 0.781 usec
Mar 18 08:58:36 raspberrypi ntpd[521]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Mar 18 08:58:36 raspberrypi ntpd[521]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 18 08:58:36 raspberrypi ntpd[521]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 18 08:58:36 raspberrypi ntpd[521]: Listen normally on 3 lo ::1 UDP 123
Mar 18 08:58:36 raspberrypi ntpd[521]: peers refreshed
Mar 18 08:58:36 raspberrypi ntpd[521]: Listening on routing socket on fd #20 for interface updates
Mar 18 08:58:40 raspberrypi ntpd[521]: Deferring DNS for 0.debian.pool.ntp.org 1
Mar 18 08:58:41 raspberrypi ntpd[521]: Deferring DNS for 1.debian.pool.ntp.org 1
Mar 18 08:58:41 raspberrypi ntpd[521]: Deferring DNS for 2.debian.pool.ntp.org 1
Mar 18 08:58:41 raspberrypi ntpd[521]: Deferring DNS for 3.debian.pool.ntp.org 1
Mar 18 08:58:41 raspberrypi ntpd[524]: signal_no_reset: signal 17 had flags 4000000
Mar 18 08:58:43 raspberrypi ntpd_intres[524]: host name not found: 0.debian.pool.ntp.org
Mar 18 08:58:43 raspberrypi ntpd_intres[524]: host name not found: 1.debian.pool.ntp.org
Mar 18 08:58:43 raspberrypi ntpd_intres[524]: host name not found: 2.debian.pool.ntp.org
Mar 18 08:58:43 raspberrypi ntpd_intres[524]: host name not found: 3.debian.pool.ntp.org
Mar 18 08:59:45 raspberrypi ntpd_intres[524]: host name not found: 0.debian.pool.ntp.org
Mar 18 08:59:45 raspberrypi ntpd_intres[524]: host name not found: 1.debian.pool.ntp.org
Mar 18 08:59:45 raspberrypi ntpd_intres[524]: host name not found: 2.debian.pool.ntp.org
Mar 18 08:59:45 raspberrypi ntpd_intres[524]: host name not found: 3.debian.pool.ntp.org
Mar 18 09:01:47 raspberrypi ntpd_intres[524]: host name not found: 0.debian.pool.ntp.org
Mar 18 09:01:47 raspberrypi ntpd_intres[524]: host name not found: 1.debian.pool.ntp.org
Mar 18 09:01:47 raspberrypi ntpd_intres[524]: host name not found: 2.debian.pool.ntp.org
Mar 18 09:01:47 raspberrypi ntpd_intres[524]: host name not found: 3.debian.pool.ntp.org
Mar 18 09:05:49 raspberrypi ntpd_intres[524]: host name not found: 0.debian.pool.ntp.org
Mar 18 09:05:49 raspberrypi ntpd_intres[524]: host name not found: 1.debian.pool.ntp.org
Mar 18 09:05:49 raspberrypi ntpd_intres[524]: host name not found: 2.debian.pool.ntp.org
Mar 18 09:05:49 raspberrypi ntpd_intres[524]: host name not found: 3.debian.pool.ntp.org
Mar 18 09:11:54 raspberrypi ntpd[521]: Listen normally on 4 eth0 2601:140:8300:a626:371e:629a:31e4:e76e UDP 123
Mar 18 09:11:54 raspberrypi ntpd[521]: Listen normally on 5 eth0 fe80::7c8c:4da6:ca38:111b UDP 123
Mar 18 09:11:54 raspberrypi ntpd[521]: peers refreshed
Mar 18 09:11:56 raspberrypi ntpd_intres[524]: DNS 0.debian.pool.ntp.org -> 108.59.2.24
Mar 18 09:11:56 raspberrypi ntpd_intres[524]: DNS 1.debian.pool.ntp.org -> 171.66.97.126
Mar 18 09:11:56 raspberrypi ntpd_intres[524]: DNS 2.debian.pool.ntp.org -> 2001:470:1f0e:9b0:fed::1
Mar 18 09:11:56 raspberrypi ntpd_intres[524]: DNS 3.debian.pool.ntp.org -> 108.61.73.243
Mar 18 09:11:58 raspberrypi ntpd[521]: Listen normally on 6 eth0 10.0.1.38 UDP 123
Mar 18 09:11:58 raspberrypi ntpd[521]: peers refreshed
May  8 23:26:43 raspberrypi kernel: [    0.002046] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  8 23:26:43 raspberrypi ntpd[505]: ntpd 4.2.6p5@1.2349-o Mon Nov  2 04:29:47 UTC 2015 (1)
May  8 23:26:43 raspberrypi ntpd[514]: proto: precision = 0.781 usec
May  8 23:26:43 raspberrypi ntpd[514]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
May  8 23:26:43 raspberrypi ntp[485]: Starting NTP server: ntpd.
May  8 23:26:43 raspberrypi ntpd[514]: Listen and drop on 1 v6wildcard :: UDP 123
May  8 23:26:43 raspberrypi ntpd[514]: Listen normally on 2 lo 127.0.0.1 UDP 123
May  8 23:26:43 raspberrypi ntpd[514]: Listen normally on 3 lo ::1 UDP 123
May  8 23:26:43 raspberrypi ntpd[514]: peers refreshed
May  8 23:26:43 raspberrypi ntpd[514]: Listening on routing socket on fd #20 for interface updates
May  8 23:26:43 raspberrypi ntpd[514]: Deferring DNS for 0.debian.pool.ntp.org 1
May  8 23:26:43 raspberrypi ntpd[514]: Deferring DNS for 1.debian.pool.ntp.org 1
May  8 23:26:43 raspberrypi ntpd[514]: Deferring DNS for 2.debian.pool.ntp.org 1
May  8 23:26:43 raspberrypi ntpd[514]: Deferring DNS for 3.debian.pool.ntp.org 1
May  8 23:26:44 raspberrypi ntpd[515]: signal_no_reset: signal 17 had flags 4000000
May  8 23:26:46 raspberrypi ntpd_intres[515]: host name not found: 0.debian.pool.ntp.org
May  8 23:26:46 raspberrypi ntpd_intres[515]: host name not found: 1.debian.pool.ntp.org
May  8 23:26:46 raspberrypi ntpd_intres[515]: host name not found: 2.debian.pool.ntp.org
May  8 23:26:46 raspberrypi ntpd_intres[515]: host name not found: 3.debian.pool.ntp.org
May  8 23:26:50 raspberrypi ntpd[514]: Listen normally on 4 eth0 2601:140:8300:a626:371e:629a:31e4:e76e UDP 123
May  8 23:26:50 raspberrypi ntpd[514]: Listen normally on 5 eth0 fe80::7c8c:4da6:ca38:111b UDP 123
May  8 23:26:50 raspberrypi ntpd[514]: peers refreshed
May  8 23:26:52 raspberrypi ntpd[514]: Listen normally on 6 eth0 10.0.1.38 UDP 123
May  8 23:26:52 raspberrypi ntpd[514]: peers refreshed
May  8 23:26:52 raspberrypi ntpd_intres[515]: DNS 0.debian.pool.ntp.org -> 138.236.128.36
May  8 23:26:52 raspberrypi ntpd_intres[515]: DNS 1.debian.pool.ntp.org -> 96.126.105.86
May  8 23:26:53 raspberrypi ntpd_intres[515]: DNS 2.debian.pool.ntp.org -> 2600:3c00::f03c:91ff:fe91:5dd8
May  8 23:26:53 raspberrypi ntpd_intres[515]: DNS 3.debian.pool.ntp.org -> 54.83.7.186
May  8 23:44:11 raspberrypi kernel: [    0.002112] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  8 23:44:11 raspberrypi ntpd[533]: ntpd 4.2.6p5@1.2349-o Mon Nov  2 04:29:47 UTC 2015 (1)
May  8 23:44:11 raspberrypi ntpd[540]: proto: precision = 0.729 usec
May  8 23:44:11 raspberrypi ntpd[540]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
May  8 23:44:11 raspberrypi ntp[522]: Starting NTP server: ntpd.
May  8 23:44:11 raspberrypi ntpd[540]: Listen and drop on 1 v6wildcard :: UDP 123
May  8 23:44:11 raspberrypi ntpd[540]: Listen normally on 2 lo 127.0.0.1 UDP 123
May  8 23:44:11 raspberrypi ntpd[540]: Listen normally on 3 lo ::1 UDP 123
May  8 23:44:11 raspberrypi ntpd[540]: peers refreshed
May  8 23:44:11 raspberrypi ntpd[540]: Listening on routing socket on fd #20 for interface updates
May  8 23:44:11 raspberrypi ntpd[540]: Deferring DNS for 0.debian.pool.ntp.org 1
May  8 23:44:11 raspberrypi ntpd[540]: Deferring DNS for 1.debian.pool.ntp.org 1
May  8 23:44:11 raspberrypi ntpd[540]: Deferring DNS for 2.debian.pool.ntp.org 1
May  8 23:44:11 raspberrypi ntpd[540]: Deferring DNS for 3.debian.pool.ntp.org 1
May  8 23:44:11 raspberrypi ntpd[545]: signal_no_reset: signal 17 had flags 4000000
May  8 23:44:13 raspberrypi ntpd_intres[545]: host name not found: 0.debian.pool.ntp.org
May  8 23:44:13 raspberrypi ntpd_intres[545]: host name not found: 1.debian.pool.ntp.org
May  8 23:44:13 raspberrypi ntpd_intres[545]: host name not found: 2.debian.pool.ntp.org
May  8 23:44:13 raspberrypi ntpd_intres[545]: host name not found: 3.debian.pool.ntp.org
May  8 23:44:17 raspberrypi ntpd[540]: Listen normally on 4 eth0 2601:140:8300:a626:371e:629a:31e4:e76e UDP 123
May  8 23:44:17 raspberrypi ntpd[540]: Listen normally on 5 eth0 fe80::7c8c:4da6:ca38:111b UDP 123
May  8 23:44:17 raspberrypi ntpd[540]: peers refreshed
May  8 23:44:19 raspberrypi ntpd_intres[545]: DNS 0.debian.pool.ntp.org -> 198.58.105.63
May  8 23:44:20 raspberrypi ntpd_intres[545]: DNS 1.debian.pool.ntp.org -> 108.61.73.243
May  8 23:44:20 raspberrypi ntpd_intres[545]: DNS 2.debian.pool.ntp.org -> 2600:3c00::2:b401
May  8 23:44:20 raspberrypi ntpd_intres[545]: DNS 3.debian.pool.ntp.org -> 108.59.2.24
May  8 23:44:20 raspberrypi ntpd[540]: Listen normally on 6 eth0 10.0.1.38 UDP 123
May  8 23:44:20 raspberrypi ntpd[540]: peers refreshed
May  8 23:59:55 raspberrypi ntpd[540]: ntpd exiting on signal 15
May  8 23:59:55 raspberrypi ntp[26775]: Stopping NTP server: ntpd.
May  9 00:53:10 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 00:53:10 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:01:18 raspberrypi kernel: [    0.002114] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:01:18 raspberrypi ntpdate[358]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:01:18 raspberrypi ntpdate[358]: no servers can be used, exiting
May  9 01:01:18 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:01:18 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:04:19 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:04:19 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:09:43 raspberrypi kernel: [    0.002102] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:09:43 raspberrypi ntpdate[381]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:09:43 raspberrypi ntpdate[381]: no servers can be used, exiting
May  9 01:09:43 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:09:43 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:10:05 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:10:05 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:13:25 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:13:25 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:14:45 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:14:45 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:17:03 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:17:03 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:18:04 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:18:04 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:36:01 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:36:01 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:57:11 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:57:11 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:57:14 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:57:14 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:57:15 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:57:15 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:17:05 raspberrypi ntpdate[348]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:17:05 raspberrypi ntpdate[348]: no servers can be used, exiting
May  9 01:17:05 raspberrypi kernel: [    0.002118] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:17:05 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:17:05 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:17:05 raspberrypi kernel: [    0.002114] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:17:05 raspberrypi ntpdate[348]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:17:05 raspberrypi ntpdate[348]: no servers can be used, exiting
May  9 01:17:05 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:17:05 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:18:09 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:18:09 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:18:14 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:18:14 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:18:39 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:18:39 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:17:05 raspberrypi kernel: [    0.002104] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:17:05 raspberrypi ntpdate[348]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:17:05 raspberrypi ntpdate[348]: no servers can be used, exiting
May  9 01:17:05 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:17:05 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:30:00 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:30:00 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May  9 01:17:03 raspberrypi kernel: [    0.002106] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
May  9 01:17:03 raspberrypi ntpdate[340]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:17:03 raspberrypi ntpdate[340]: no servers can be used, exiting
May  9 01:17:04 raspberrypi systemd[1]: ntp.service: control process exited, code=exited status=5
May  9 01:17:04 raspberrypi systemd[1]: Unit ntp.service entered failed state.


Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi:~ $ sudo service ntp status
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp)
   Active: failed (Result: exit-code) since Mon 2016-05-09 01:17:04 UTC; 4min 5s ago
  Process: 502 ExecStart=/etc/init.d/ntp start (code=exited, status=5)

May 09 01:17:04 raspberrypi systemd[1]: ntp.service: control process exited,...5
May 09 01:17:04 raspberrypi systemd[1]: Failed to start LSB: Start NTP daemon.
May 09 01:17:04 raspberrypi systemd[1]: Unit ntp.service entered failed state.
May 09 01:17:05 raspberrypi systemd[1]: Stopped LSB: Start NTP daemon.
Hint: Some lines were ellipsized, use -l to show in full.

tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Tue May 10, 2016 7:22 am

Looks like a DNS issue. If there is no network connection you need to either remove the named NTP servers from your ntp.conf or add the necessary entries in your /etc/hosts file.

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by tom_w on Tue May 10, 2016 7:50 am

I'm not sure how to diagnose a DNS issue.
I followed the prescribed tutorial. I have the pi directly connected to a router, which is how I downloaded the files for the tutorial.

Ideally for my purpose, however, this will not be network connected. So if that is part of the issue, then I'm not sure how to circumvent the DNS error.

jforhan wrote:Looks like a DNS issue. If there is no network connection you need to either remove the named NTP servers from your ntp.conf or add the necessary entries in your /etc/hosts file.

Later,
Jeff

tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Tue May 10, 2016 8:13 am

Tom_W wrote:I'm not sure how to diagnose a DNS issue.
I followed the prescribed tutorial. I have the pi directly connected to a router, which is how I downloaded the files for the tutorial.

Ideally for my purpose, however, this will not be network connected. So if that is part of the issue, then I'm not sure how to circumvent the DNS error.


From the terminal prompt type "nslookup 0.debian.pool.ntp.org" (you have to have dnsutils installed (sudo apt-get install dnsutils)). If it gives you a result then DNS is working. Why DNS is not working for NTP is odd if it works from the CLI. If the nslookup doesn't work, what does your "/etc/resolv.conf" file look like? It must be good if you are able to install packages to the pi.

But NTP is complaining about DNS on and off then exits when it fails.
Code: Select all | TOGGLE FULL SIZE
May  9 01:01:18 raspberrypi ntpdate[358]: Can't find host 0.debian.pool.ntp.org: Name or service not known (-2)
May  9 01:01:18 raspberrypi ntpdate[358]: no servers can be used, exiting

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by samr on Tue May 10, 2016 10:42 am

can you post a copy of your /etc/ntp.conf ?
Also a copy of /etc/resolv.conf ?

Also, did you delete /etc/dhcp/dhclient-exit-hooks.d/ntp per that step of the tutorial?

samr
 
Posts: 30
Joined: Tue May 14, 2013 3:03 pm

Re: Raspberry Pi GPS Stratum 1 NTP Server

by tom_w on Fri May 13, 2016 12:31 pm

jforhan wrote:From the terminal prompt type "nslookup 0.debian.pool.ntp.org" (you have to have dnsutils installed (sudo apt-get install dnsutils)).


Here:
Code: Select all | TOGGLE FULL SIZE
pi@raspberrypi:~ $ nslookup 0.debian.pool.ntp.org
Server:      192.168.1.1
Address:   192.168.1.1#53

Non-authoritative answer:
Name:   0.debian.pool.ntp.org
Address: 142.54.181.202
Name:   0.debian.pool.ntp.org
Address: 216.152.240.220
Name:   0.debian.pool.ntp.org
Address: 108.61.73.244
Name:   0.debian.pool.ntp.org
Address: 64.71.128.26


jforhan wrote:If the nslookup doesn't work, what does your "/etc/resolv.conf" file look like? It must be good if you are able to install packages to the pi.
But NTP is complaining about DNS on and off then exits when it fails.


Code: Select all | TOGGLE FULL SIZE
  GNU nano 2.2.6                        File: /etc/resolv.conf                                                       

# Generated by resolvconf
nameserver 192.168.1.1

tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by tom_w on Fri May 13, 2016 12:36 pm

samr wrote:can you post a copy of your /etc/ntp.conf ?


Code: Select all | TOGGLE FULL SIZE
GNU nano 2.2.6                         File: /etc/ntp.conf                                                         
# /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>
server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst

server 127.127.20.0 mode 84 minpoll 3 iburst prefer
fudge 127.127.20.0 stratum 1 flag1 1 flag2 0 flag3 0 flag4 0 time1 0.0 time2 0.280 refid GPS0

# 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



samr wrote:Also a copy of /etc/resolv.conf ?

Code: Select all | TOGGLE FULL SIZE
# Generated by resolvconf
nameserver 192.168.1.1


samr wrote:Also, did you delete /etc/dhcp/dhclient-exit-hooks.d/ntp per that step of the tutorial?


Yes.

tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Fri May 13, 2016 2:56 pm

Tom_W,

You ntp.conf file looks ok. The only difference between yours and mine is I have different servers, I use IP addresses (not host names) and I do not have "iburst" after the server entry.

resolv.conf looks fine. Not sure why your are having DNS issues unless it is the router or your ISP.

If all your configs look OK, and you are having issues still with the speeds not syncing then it is probably that NTP is still running. This will cause the speeds not to sync. Make sure you issue "sudo service ntp stop" before issuing any gpsinit commands. After you stop NTP, you can try the GPS testing commands from earlier:

    Test GPS

    Run sudo ppstest /dev/pps0. You should see timestamp every second. CTRL-C to exit.
    Run gpsinit -s 115200 -f /etc/gpsinit_nav.conf /dev/ttyAMA0 to initialize the GPS unit for testing
    Run gpsstatus /dev/ttyAMA0. Do you get a GPS or DGPS fix within 10 minutes? If not,
    Read the README at https://github.com/f5eng/mt3339-utils for instructions on how to initialize
    the GPS unit and why it's important.

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Fri May 13, 2016 3:03 pm

Just wanted to point out something for everyone w.r.t. NTP. In newer versions, NTP is run as user "ntp" where older versions (up to 4.2.6.p5-3) were run as root. When removing the old NTP package the "/var/lib/ntp" directory is still owned/grouped by root. If you issue "sudo service status ntp" or look at the Syslog you will see many messages saying:

    frequency file /var/lib/ntp/ntp.drift.TEMP: Permission denied

You can remedy this by issuing "sudo chown -R ntp:ntp /var/lib/ntp". This should make the errors stop.

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by tom_w on Fri May 13, 2016 5:54 pm

jforhan wrote:If all your configs look OK, and you are having issues still with the speeds not syncing then it is probably that NTP is still running. This will cause the speeds not to sync. Make sure you issue "sudo service ntp stop" before issuing any gpsinit commands. After you stop NTP, you can try the GPS testing commands from earlier:


Thanks for your help, Jeff. I believe SamR and I worked through stopping ntp before running gpsinit.

Meanwhile, I have gotten the tutorial at http://www.satsignal.eu/ntp/Raspberry-Pi-quickstart.html, with some help from http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html to work flawlessly.

My end goal is a Rpi with the adafruit gps hat that I can power up and connect via direct ethernet to a switch or router. That way all other devices on that router/switch (mostly windows machines) can be pointed to the IP address of the Rpi and get stratum 1 time source. No outside ethernet connection to a network will exist. No access to outside servers. This will be a standalone system, and documentation seems to be lacking for this type of standalone configuration. Any help with this would be greatly appreciated, as has been the help from users thus far.

tom_w
 
Posts: 32
Joined: Mon Mar 03, 2014 11:32 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Fri May 13, 2016 8:46 pm

Tom_W wrote:My end goal is a Rpi with the adafruit gps hat that I can power up and connect via direct ethernet to a switch or router. That way all other devices on that router/switch (mostly windows machines) can be pointed to the IP address of the Rpi and get stratum 1 time source. No outside ethernet connection to a network will exist. No access to outside servers. This will be a standalone system, and documentation seems to be lacking for this type of standalone configuration. Any help with this would be greatly appreciated, as has been the help from users thus far.


Tom,

Since there will be no access to the Internet then you cannot have servers listed that reside there. So you can start by commenting out your server statements (put a # before the entry) for the debain pool. If you have a hostname or IP in your ntp.conf file that lives beyond your LAN, and your LAN has no outside access, then it will fail. You need to make sure that you have the CR1220 battery in the GPS Hat. That way the EPO and other settings are kept if there is a power outage. Beyond that, there is nothing external to NTP.

EDIT: I almost forgot to mention that if you have just a switch to connect the other machines, do you have a DHCP server? If not you must configure the RPi with a static IP address.

I have a script in init.d that sleeps for a few seconds, stops NTP, inits the GPS, waits, sets the system clock from the GPS, then starts NTP. This is similar to gtj's steps at the end of his guide on page 5 of this thread. I found that even when NTP was stopped, sometimes the GPS would not take the init commands the first time after a reboot (even with a battery installed). So I wrote a script (based off of scruss's page 13 script for stand-alone) that pauses and actually does the init twice (once to stty and the other to gpsinit). I added the sleeps to give time for the RPi to catch up with itself. I also have an RTC module so I add in a set to the hardware clock at the end too.

Code: Select all | TOGGLE FULL SIZE
#!/bin/bash
### BEGIN INIT INFO
# Provides:          clock_setup
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: clock_setup
### END INIT INFO
sleep 10
service ntp stop
sleep 3
stty -F /dev/ttyAMA0 raw 115200 cs8 clocal -cstopb
sleep 2
/usr/local/bin/gpsinit -s 115200 -f /etc/gpsinit_time.conf /dev/ttyAMA0
sleep 5
/usr/local/bin/gpsinit -s 115200 -i set_system_clock /dev/ttyAMA0
sleep 3
service ntp start
hwclock -w


Based of this thread and other sources, I changed the "/etc/gpsinit_time.conf" file. Here are the relevant parts:
Code: Select all | TOGGLE FULL SIZE
# Set NMEA Sentence Output
#Old value for 88
#PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
#Set value for 84 in ntp.conf
PMTK314,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0

# Set output rate to 4/second
#PMTK220,500
PMTK220,1000


Hope this helps...

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Sun May 15, 2016 9:54 am

Tom_W wrote:Meanwhile, I have gotten the tutorial at http://www.satsignal.eu/ntp/Raspberry-Pi-quickstart.html, with some help from http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html to work flawlessly.


By the way,

I picked up an RPi3 and another Ultimate GPS HAT. Used some of the above and some other stuff I have seen and got it working. I can do ppstest, gpsinit and gpsstatus and see the satellites, etc. I am going to compile NTP next and get that going. I will post exactly what I did to get it working on RPi3.

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by bigdog1951 on Wed Jun 01, 2016 12:44 pm

Thanks for posting this tutorial. I was able to get through everything successfully until the very end. The GPS is working according to the tests specified in the instructions, but unfortunately I am unable to start the NTP service. It is sort of a bummer when you are very careful and so everything step by step, then get all the way to the last little detail and you get shot down :(

When I try to start the NTP service, I get this:

Job for ntp.service failed. See 'systemctl status ntp.service' and 'journalctl -xn' for details.

systemctl status ntp.service output is as follows:

Code: Select all | TOGGLE FULL SIZE
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp)
   Active: failed (Result: exit-code) since Wed 2016-06-01 09:30:42 PDT; 1min 4s ago
  Process: 2303 ExecStart=/etc/init.d/ntp start (code=exited, status=5)


and journalctl -xn output is here:

Code: Select all | TOGGLE FULL SIZE
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Starting LSB: Start NTP daemon...
-- Subject: Unit ntp.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ntp.service has begun starting up.
Jun 01 09:24:21 k6bpm-ntp systemd[1]: ntp.service: control process exited, code=exited status=5
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Failed to start LSB: Start NTP daemon.
-- Subject: Unit ntp.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ntp.service has failed.
--
-- The result is failed.
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Unit ntp.service entered failed state.
Jun 01 09:24:21 k6bpm-ntp sudo[1959]: pam_unix(sudo:session): session closed for user root
Jun 01 09:24:23 k6bpm-ntp login[1956]: FAILED LOGIN (1) on '/dev/ttyAMA0' FOR 'UNKNOWN', Authentication failure
Jun 01 09:24:23 k6bpm-ntp login[1956]: pam_unix(login:auth): check pass; user unknown
Jun 01 09:24:23 k6bpm-ntp login[1956]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/ttyAMA0 ruser= rhost=
Jun 01 09:24:24 k6bpm-ntp sudo[1990]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn
Jun 01 09:24:24 k6bpm-ntp sudo[1990]: pam_unix(sudo:session): session opened for user root by pi(uid=0)


I don't know if any of this is helpful.

I am using a RPi2 with the Adafruit GPS Hat and the latest version of Rasbian Jessie as of May 31, 2016. It is all brand new and set up just for this purpose. I am working on a large wireless mesh network project that is entirely disconnected from the Internet, and a reliable NTP server is needed to keep all the node synchronized. The RPi is currently on a normal network with Internet access for building and testing, but if I can get it to work it will be moved to the off-line mesh network and will become the primary time server for a couple of dozen nodes.

I am a relative RPi/Linux newbie, but have been a DOS/Windows programmer for 30+ years, so I am not a complete beginner with this stuff ;) Any help would be very much appreciated!

Brian

bigdog1951
 
Posts: 4
Joined: Thu Apr 30, 2015 12:44 pm

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Mon Jun 06, 2016 9:02 pm

bigdog1951 wrote:Thanks for posting this tutorial. I was able to get through everything successfully until the very end. The GPS is working according to the tests specified in the instructions, but unfortunately I am unable to start the NTP service. It is sort of a bummer when you are very careful and so everything step by step, then get all the way to the last little detail and you get shot down :(

When I try to start the NTP service, I get this:

Job for ntp.service failed. See 'systemctl status ntp.service' and 'journalctl -xn' for details.

systemctl status ntp.service output is as follows:

Code: Select all | TOGGLE FULL SIZE
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp)
   Active: failed (Result: exit-code) since Wed 2016-06-01 09:30:42 PDT; 1min 4s ago
  Process: 2303 ExecStart=/etc/init.d/ntp start (code=exited, status=5)


and journalctl -xn output is here:

Code: Select all | TOGGLE FULL SIZE
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Starting LSB: Start NTP daemon...
-- Subject: Unit ntp.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ntp.service has begun starting up.
Jun 01 09:24:21 k6bpm-ntp systemd[1]: ntp.service: control process exited, code=exited status=5
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Failed to start LSB: Start NTP daemon.
-- Subject: Unit ntp.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit ntp.service has failed.
--
-- The result is failed.
Jun 01 09:24:21 k6bpm-ntp systemd[1]: Unit ntp.service entered failed state.
Jun 01 09:24:21 k6bpm-ntp sudo[1959]: pam_unix(sudo:session): session closed for user root
Jun 01 09:24:23 k6bpm-ntp login[1956]: FAILED LOGIN (1) on '/dev/ttyAMA0' FOR 'UNKNOWN', Authentication failure
Jun 01 09:24:23 k6bpm-ntp login[1956]: pam_unix(login:auth): check pass; user unknown
Jun 01 09:24:23 k6bpm-ntp login[1956]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/ttyAMA0 ruser= rhost=
Jun 01 09:24:24 k6bpm-ntp sudo[1990]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn
Jun 01 09:24:24 k6bpm-ntp sudo[1990]: pam_unix(sudo:session): session opened for user root by pi(uid=0)


I don't know if any of this is helpful.

I am using a RPi2 with the Adafruit GPS Hat and the latest version of Rasbian Jessie as of May 31, 2016. It is all brand new and set up just for this purpose. I am working on a large wireless mesh network project that is entirely disconnected from the Internet, and a reliable NTP server is needed to keep all the node synchronized. The RPi is currently on a normal network with Internet access for building and testing, but if I can get it to work it will be moved to the off-line mesh network and will become the primary time server for a couple of dozen nodes.

I am a relative RPi/Linux newbie, but have been a DOS/Windows programmer for 30+ years, so I am not a complete beginner with this stuff ;) Any help would be very much appreciated!

Brian


I assume you are using "sudo systemctl start ntp"...

Have you tried "sudo service ntp start"?

Can you post the output of "ls -l /etc/init.d/ntp"

Also post the entire output of "cat /etc/init.d/ntp"

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Re: Raspberry Pi GPS Stratum 1 NTP Server

by jforhan on Fri Jun 10, 2016 10:17 am

I have gotten two different RPi3's to work with the Ultimate GPS HAT.
However, I have found that even on the RPi2 B the GPS module UART is resetting to 9600 baud after a week or so. I have verified this as when NTP cannot reach it, I stop NTP and try 'gpsstatus' which give no output. I use 'stty' to change ttyAMA0 to 9600 baud then try 'gpsstatus' again and it works. I have tried setting it to 38400 as a test on a RPi2 and RPi3 to see if I still get the same failure. I use mode 50 (I am using GPGGA messages).

Start off with the normal instructions from page 5 of this thread.

Since the RPi3 has built-in BT & WiFi and uses the UART for this, we need to use a special overlay [pi3-miniuart-bt]to get our GPIO pins back for Rx & Tx.


Here is my config.txt file. I put a comment above the needed overlay.
Code: Select all | TOGGLE FULL SIZE
dtparam=audio=on
dtparam=i2c_arm=on
#enable_uart=0
# Allow normal UART pins (GPIO14 & GPIO15) to work
dtoverlay=pi3-miniuart-bt
dtoverlay=pps-gpio,gpiopin=4
dtoverlay=i2c-rtc,ds3231
init_uart_baud=38400


Here is the cmdline.txt:
Code: Select all | TOGGLE FULL SIZE
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait


I have been able to test mode 84, 82 and now 50 for those interested.
Code: Select all | TOGGLE FULL SIZE
#Mode 84 = 115200 baud (DEC 80 HEX 0x50) & process $GPGLL (DEC 4 HEX 0x4) data from GPS
#server 127.127.20.0 mode 84 minpoll 3 iburst prefer

#Mode 82 = 115200 baud (DEC 80 HEX 0x50) & process $GPGGA (DEC 2 HEX 0x2) data from GPS
#server 127.127.20.0 mode 82 minpoll 3 iburst prefer

#Mode 50 = 38400 baud (DEC 48 HEX 0x30) & process $GPGGA (DEC 2 HEX 0x2) data from GPS
server 127.127.20.0 mode 50 minpoll 3 iburst prefer

#Fudge same of all modes
fudge 127.127.20.0 stratum 0 flag1 1 flag2 0 flag3 0 flag4 0 time1 0.0 time2 0.240


Other than the overlay, there is nothing special to do for RPi3 when you follow the guide.

Later,
Jeff

jforhan
 
Posts: 12
Joined: Fri Apr 29, 2016 8:18 am

Please be positive and constructive with your questions and comments.