Updating for Daylight Savings Time on Ubuntu
My system clock has been all wiggy since Daylight Savings Time ended (or started?) (it's ended) on Sunday. Believe it or not, it was actually flipping back and forth between correct and one hour ahead for no apparent reason. I did two things which together seem to have fixed things.
First, via Fast Track Sites, I found that my system timezone information was out of date. The test for this is:
% sudo zdump -v /etc/localtime | grep 2007
/etc/localtime Sun Mar 11 07:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 CST isdst=0 gmtoff=-21600
/etc/localtime Sun Mar 11 08:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime Sun Nov 4 06:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 CDT isdst=1 gmtoff=-18000
/etc/localtime Sun Nov 4 07:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 CST isdst=0 gmtoff=-21600
If the output doesn't exactly match the above, you have a problem. Download the latest
tzdata2007X.tgz
file (where X
is a lowercase letter) from the National Cancer Institute (seriously). For gorey details, see the Fast Track Sites post cited above. (I don't think you really have to do the ln
step, which sets your timezone to EST5EDT instead of, e.g., America/New_York. I skipped it.)Now your system ought to know the right start/end dates for Daylight Savings Time. But your clock is probably still out of whack.
Now, via Ubuntu Forums and Stephen Sykes, use
ntpdate
to reset the clock. The trick(s) here are: (a) you have to shut down ntpd
first, (b) setting the clock back an hour will convince sudo
that you're trying to do something nefarious ("timestamp too far in the future"), and (c) I had to give ntpdate
the -u
option to get past some unseen firewall.
% sudo /etc/init.d/ntp-server stop
* Stopping NTP server ntpd [ OK ]
% sudo ntpdate-debian -u
6 Nov 17:00:00 ntpdate[13693]: step time server 66.36.239.104 offset -3598.042737 sec
% sudo /etc/init.d/hwclock.sh restart
sudo: timestamp too far in the future: Nov 6 17:59:56 2007
Oops. Using the "Adjust Date & Time" applet, manually set the clock one hour forward. Now, run
sudo -k
. Now, set the clock back to the correct time (again using "Adjust Date & Time"). Starting over:
% sudo ntpdate-debian -u
6 Nov 17:00:00 ntpdate[13693]: step time server 66.36.239.104 offset -3598.042737 sec
% sudo /etc/init.d/hwclock.sh restart
* Saving the system clock
% sudo /etc/init.d/ntp start
* Starting NTP server ntpd [ OK ]
All done. Enjoy.
[UPDATE 3/12/2008] It looks like this might be a semi-annual ritual: my system pulled the same schizo act when DST started this week. On Gutsy,
ntp-server
has become ntp
. It's easier springing forward than falling back, because sudo
just times out when you set the clock forward.
2 comments:
I had the same problem on my Gutsy install; strangely it worked until I restarted the computer, and then it was off by an hour. Your solution worked with out a hitch.
Glad I could help, cbrodt. I'm crossing my fingers this won't be an issue next Fall.
Post a Comment