While equipping my fresh Gentoo server with NTP capabilities I was wondering why after a couple of minutes after starting ntpd, ntpq -p (or ntpq -c peers) was shouting “ntpq: read: Connection refused” at me… What is going on?
After some reading I found out that this error usually means that ntpd is not running. But why?
tail /var/log/messages
…did not leave me with any information on possible errors.
Yet after some more searching I discovered that ntpd quits if it discovers that the time offset is too large. As my server time was about 1 hour off, that kind of made sense. Another logfile revealed that this was indeed the issue:
tail /var/log/syslog
time correction of -3635 seconds exceeds sanity limit (1000); set clock manually to the correct UTC time.
So how do we do that? Easy:
date MMDDhhmmYYYY #(Month, Day, hour, minute and Year)
And presto, problem solved! Do note that some programs may not appreciate sudden jumps in system time which you do cause by manually setting system time.
Tags: date, Gentoo Linux, NTP, ntpd, ntpq, syslog

