ntpd_enable="YES" is in /etc/rc.conf, but clock is still wrong

I've set up FreeBSD in the past on PCs successfully. I have a Raspberry Pi sitting around and thought I'd try to run FreeBSD on it. The Pi boots up fine, X works OK, however the system clock is always wrong. Firefox complains when I access certain URLS, so it needs the correct time to work right.

As I write this it's June 26, 14:36, however the Pi shows it's April 10, 10:55. The clock is running because the hours and minutes increment normally, but the Pi initially picks up the wrong time.

If it was a PC I'd suspect the CMOS battery might be dead. But there is no CMOS battery on the Raspberry Pi.

Does anyone know how to set the clock to the correct time every boot up time? Adding ntpd_enable="YES" into /etc/rc.conf made no difference.

Thanks!
 
ntp is meant to continuously compensate clock drift without any jumps in time, so when drift gets too large, it simply won't work. When your machine doesn't have a battery-powered RTC, you will need a jump at least once on startup, and ntp has an option for that, -g. It is automatically enabled when adding ntpd_sync_on_start="YES" to /etc/rc.conf.
 
If it was a PC I'd suspect the CMOS battery might be dead. But there is no CMOS battery on the Raspberry Pi.
Which also means that the Pi doesn't keep track of time when it's powered off. The primary function of the "cmos" battery in a regular PC is to keep the clock chip powered even when the machine is switched off. Those clock chips also have a bit of RAM inside them, that's where the BIOS conveniently stores some of its settings.
 
ntpd will exit if the time is too far out. Set the date to something close first.
When ntpd is running you can use ntpq -pn to check it is syncing. The actively used server will have a * next to it.
 
Note that ntpdate(8) will eventually get removed. Not sure when that's going to happen but it's going to happen some time in a future version.

Code:
     Note: The functionality of	this program is	now available in the ntpd(8)
     program.  See the -q command line option in the ntpd(8) page.  After a
     suitable period of	mourning, the ntpdate utility is to be retired from
     this distribution.
 
The date in the manual page is May 17, 2006. And I don't remember installing ntpdate specifically. And I use ntpdate because I had some problems with other daemons.

Code:
root@router:~ # service ntpdate onerestart
/etc/rc.d/ntpdate: DEBUG: checkyesno: ntpdate_enable is set to YES.
/etc/rc.d/ntpdate: DEBUG: checkyesno: ntpdate_enable is set to YES.
/etc/rc.d/ntpdate: DEBUG: run_rc_command: doit: :
/etc/rc.d/ntpdate: DEBUG: checkyesno: ntpdate_enable is set to YES.
/etc/rc.d/ntpdate: DEBUG: run_rc_command: doit: ntpdate_start
Setting date via ntp.
27 Jun 15:55:46 ntpdate[86444]: step time server XXX.XXX.XXX.XXX offset -0.000164 sec
root@router:~ #
 
Back
Top