Updating your timezone data for daylight savings changes.
Posted by jwm on Wed 26 Sep 2007 at 17:07
Daylight savings time in New Zealand has changed to start one week earlier than last year, but in order for your Debian or Ubuntu system to automatically do the right thing on September 30th, it will need to be updated. Fortunately this is easy for etch, Ubuntu feisty and later releases, as updated tzdata packages are available in their respective proposed updates repositories. However, the situation is more complicated for sarge, so this guide looks at a solution. This may be of future value to others who find their system's timezone data lags behind real world changes.
Do I have a problem?
You can check what daylight savings rules are in effect using the zdump command:
zdump -v Pacific/Auckland | grep 2007
This should produce this output if the up-to-date data is available:
Pacific/Auckland Sat Mar 17 13:59:59 2007 UTC = Sun Mar 18 02:59:59 2007 NZDT isdst=1 gmtoff=46800 Pacific/Auckland Sat Mar 17 14:00:00 2007 UTC = Sun Mar 18 02:00:00 2007 NZST isdst=0 gmtoff=43200 Pacific/Auckland Sat Sep 29 13:59:59 2007 UTC = Sun Sep 30 01:59:59 2007 NZST isdst=0 gmtoff=43200 Pacific/Auckland Sat Sep 29 14:00:00 2007 UTC = Sun Sep 30 03:00:00 2007 NZDT isdst=1 gmtoff=46800
If the second pair of lines are mapping a date in October, rather than September, your timezone data is out of date.
(Obviously, if you're not using the Pacific/Auckland or Pacific/Chatham timezones, then this particular problem doesn't apply to you.)
The quick solution for etch and feisty users
- Add the updates repository to /etc/apt/sources.list.
For Debian etch:
deb http://ftp.debian.org/debian etch-proposed-updates mainFor Ubuntu feisty:
deb http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
apt-get install tzdata
That's it. You can drop the lines from sources.list, assuming you needed to add them at all, if you'd rather wait for dot version upgrades, or keep them and do a complete upgrade to fetch other updated packages.
The more complicated sarge solution
The timezone data was split into a separately maintained package called tzdata during the etch development cycle—previously it was part of the libc6 package, and, as of writing, Debian sarge doesn't have update for the libc6 package that includes the new timezone data.
One solution would be to fetch the source of the libc6 package for sarge, update the timezone data, then build a new binary package, but that is a considerable nuisance, particularly if you'd prefer not to have to set up a sarge build environment.
A simpler solution is to build the tzdata package from source, which doesn't need to be done on a sarge box, then copy the relevant compiled timezone file by hand into it's home under the /usr/share/zoneinfo/ tree.
- Add the source repository for updates to your sources.list:
deb-src http://ftp.debian.org/debian etch-proposed-updates main
- Fetch the tzdata source, and it's build dependencies:
apt-get source tzdata && apt-get build-dep tzdata
- Change to the tzdata source directory and build the package,
leaving the resulting source tree intact:
dpkg-buildpackage -rfakeroot -us -uc -nc
- The source is built and 'installed' under the debian directory. As
root, copy the new timezone file over the old; for example:
cp debian/tzdata/usr/share/zoneinfo/Pacific/Auckland \ /usr/share/zoneinfo/Pacific/Auckland
That's it. Bare in mind that you should be cautious about upgrading the libc6 package in the week between the new and old daylight saving start times, as a libc6 security update that doesn't include timezone updates will clobber your hand installed files. However, after October 6th, the technically incorrect data doesn't matter so much until the end of March, where the additional week at the end of the daylight savings period kicks in.
One presumes that libc6 will be corrected before then, or you will have upgraded those machines.
(Mac users may wish to apply Glenn Anderson's patches.)