date and time on jetson are reset at every boot

Every boot my date and time are reset to zero, seems my ntp is not working at all. Similar problem to :
https://devtalk.nvidia.com/default/topic/831628/clock-and-date-problem-on-l4t-on-jetson-tk1/?offset=1

Once booted I can ping and host nvidia.com or for example:
$ host time.nist.gov
time.nist.gov is an alias for ntp1.glb.nist.gov.
ntp1.glb.nist.gov has address 128.138.141.172
ntp1.glb.nist.gov has IPv6 address 2610:20:6f15:15::27

but doing:
sudo service ntp stop
sudo ntpdate -s time.nist.gov
sudo service ntp start
does not correctly set up the time. So doing the manual ntpdate does not work.

Doing
sudo ntpdate -q time.nist.gov

I get:

server 128.138.141.172, stratum 0, offset 0.000000, delay 0.00000
25 Feb 16:40:11 ntpdate[3869]: no server suitable for synchronization found

From this: http://askubuntu.com/questions/429306/ntpdate-no-server-suitable-for-synchronization-found
it seems that it could be due to the ntp port being closed, if I do:
sudo nmap -p123 -sU -P0 localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2016-02-25 16:45 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000068s latency).
PORT STATE SERVICE
123/udp closed ntp

but I have all ports open:

sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT

and my laptop with ubuntu installed in the same network works fine.

Stupid question :
Have you installed ntpd ?

ntpdate is different to ntp deamon.

The command you show to test with is ntpdate.

I forget now but you should be able to get the deamon to test the connection as well.

I find that network setup may take a moment longer than expected. I added this to the end of my /etc/rc.local:

( /usr/sbin/service ntp stop ; ntpd -gq ; /usr/sbin/service ntp start )&
sleep 1
( /usr/sbin/service ntp stop ; ntpd -gq ; /usr/sbin/service ntp start )&

I don’t know if this “always” works, but it has been ok for me. Note that ntp could still require setup in /etc/ntp.conf.

yes, ntpd is installed
@linuxdev the problem is that ntpd -gq does not work even manually from the console, it just hangs silently, this is the syslog :
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: ntpd 4.2.6p5@1.2349-o Wed Oct 9 18:59:40 UTC 2013 (1)
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: proto: precision = 0.500 usec
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen and drop on 1 v6wildcard :: UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen normally on 2 lo 127.0.0.1 UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen normally on 3 eth0 172.21.0.83 UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen normally on 4 lo ::1 UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listen normally on 5 eth0 fe80::204:4bff:fe3a:db6d UDP 123
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: peers refreshed
Feb 20 09:33:48 tegra-ubuntu ntpd[3002]: Listening on routing socket on fd #22 for interface updates
Feb 20 09:33:56 tegra-ubuntu kernel: [ 4528.014825] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)
Feb 20 09:33:58 tegra-ubuntu kernel: [ 4529.983538] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)
Feb 20 09:33:59 tegra-ubuntu kernel: [ 4531.108547] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)
Feb 20 09:33:59 tegra-ubuntu kernel: [ 4531.249190] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)
Feb 20 09:34:11 tegra-ubuntu kernel: [ 4542.885520] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)
Feb 20 09:34:12 tegra-ubuntu kernel: [ 4544.151141] Timed out waiting for pll_m lock bit ([0x90] = 0x44004d01)

Hi

Re-reading your original post, it sounds like your Jetson is not finding the external NTP server “time.nist.gov

You say it is at IP address 128.138.141.172
Can you ping it successfully ?

You say your laptop updates the time correctly - but this could be due to a battery backed RTC.
You could try changing the time on your laptop and see if the time corrects itself after waiting many minutes (try 15min).

You can check the RTC time with
sudo hwclock --show

(FYI the Jetson RTC does not have a battery attached).

I think your issue is likely to be finding an external NTP server and configuring the Jetson to use it. Does the default “ubuntu.pool.ntp.org” work?
Failing that, install ntpd on another machine and configure the Jetson to use it for ntp, the ntpd can also act as a ntp local server.

Also you can check the ntpd status with
ntpq -pn

In addition to what @GE_Chen said, note that DHCP can set up an IP address correctly, yet DNS can still fail setup…which would cause ntpd to fail when trying to reach a named address (versus the dotted-decimal address mentioned by @GE_Chen). There are other things of course, but I’m now also very curious about ping to the address he gave. The original script I noted with the “sleep” is actually to give DNS an extra second to be added to routing setup (which was not trying to deal with route failure so much as it was dealing with the simple mechanics of how route can be a laggy remote network response when first set up).

Thanks
yes, I can ping it ok.
ping 128.138.141.172
PING 128.138.141.172 (128.138.141.172) 56(84) bytes of data.
64 bytes from 128.138.141.172: icmp_seq=1 ttl=46 time=166 ms
64 bytes from 128.138.141.172: icmp_seq=2 ttl=46 time=166 ms
64 bytes from 128.138.141.172: icmp_seq=3 ttl=46 time=167 ms

but I can’t ping or host ubuntu.pool.ntp.org:

ping ubuntu.pool.ntp.org
ping: unknown host ubuntu.pool.ntp.org

but the ones listed in my ntp.conf seem to be ok:

host 0.ubuntu.pool.ntp.org
0.ubuntu.pool.ntp.org has address 81.19.96.148
0.ubuntu.pool.ntp.org has address 193.145.15.15
0.ubuntu.pool.ntp.org has address 84.88.69.32
0.ubuntu.pool.ntp.org has address 158.227.98.15

ping 0.ubuntu.pool.ntp.org
PING 0.ubuntu.pool.ntp.org (193.145.15.15) 56(84) bytes of data.
64 bytes from ntp.redimadrid.es (193.145.15.15): icmp_seq=1 ttl=57 time=9.94 ms
64 bytes from ntp.redimadrid.es (193.145.15.15): icmp_seq=2 ttl=57 time=9.73 ms

strangely port 123 seems to be open/closed intermittently, in two subsequent nmaps I get:
sudo nmap -p123 -sU -P0 localhost
[sudo] password for ubuntu:

Starting Nmap 6.40 ( http://nmap.org ) at 2016-02-29 09:32 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00011s latency).
PORT STATE SERVICE
123/udp open ntp

sudo nmap -p123 -sU -P0 localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2016-02-29 09:37 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000063s latency).
PORT STATE SERVICE
123/udp closed ntp

Nmap done: 1 IP address (1 host up) scanned in 1.16 seconds

I might check today from the home network to see if it works there.

I’m having issues with the forum software, so the short answer is that you have your dotted-decimal address correctly assigned by DHCP, but named addresses fail lookup…this is the DNS which needs further setup.