zaterdag 7 maart 2015

Most obvious when you start ya PI is date and time:

It kinda borked on me. Here is why:


PI has no real time clock so when it starts up it needs ntp (network time protocol) to sync it´s time/date. Also I gave my pi a fixed IP address ...

The post below gave me everything I needed to figure it out. It is quite to the point except for the part where he (see post) says to remove it. Keep it safe to get back to it and understand. something like:

¨sudo mv /var/lib/ntp/ntp.conf.dhcp /var/lib/ntp/ntp.conf.bak¨

¨sudo /etc/init/d/ntp restart

It will pick up /etc/ntp.conf and starts doing it´s thing. For me personally ntp used my router as a time sync source which it is not capable of.

The ¨ntpq -p¨ command as explained below shows you the time server(s) used.

For me I cannot tell you what was different. Cause I removed the file like in the post and banging my head against the wall why I did that ;) Above and all is that I did not use a dhcp (next post on networking) and ntp still used the /var/lib/ntp.conf.dhcp file. So I need to figure that one out.

(Another SD card on route to install PI again and figure that one out hihi.)

Source: http://goo.gl/s23gDm (2´nd post)

****

Are you using DHCP or static IP?
If you use DHCP then it will read /var/lib/ntp/ntp.conf.dhcp, not /etc/ntp.conf
If you use a static IP, remove /var/lib/ntp/ntp.conf.dhcp if it exist.
Either way, check if ntp is running after a reboot with ps aux | grep ntp If it is, then run ntpq -pto check if it has started to sync with the timeservers. This can take some time, sometime it needs 2-3 pulls, each taking about 60 seconds. Just rerun ntpq -p to see the status.

And you do not have to restart. Just run: ¨/etc/init.d/ntp restart¨ and wait for a bit. Run ¨ntpd -p¨ again to see it change ...
That´s it for now.
****

Geen opmerkingen:

Een reactie posten