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

  1. Add the updates repository to /etc/apt/sources.list. For Debian etch:
    deb http://ftp.debian.org/debian etch-proposed-updates main
    For Ubuntu feisty:
    deb http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
  2. Update:
     apt-get update
  3. Install:
    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.

Here's how

  1. Add the source repository for updates to your sources.list:
    deb-src http://ftp.debian.org/debian etch-proposed-updates main 
  2. Update:
    apt-get update
  3. Fetch the tzdata source, and it's build dependencies:
    apt-get source tzdata && apt-get build-dep tzdata
  4. Change to the tzdata source directory and build the package, leaving the resulting source tree intact:
    dpkg-buildpackage -rfakeroot -us -uc -nc
  5. 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 \

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.)



Posted by elivs (202.78.xx.xx) on Thu 27 Sep 2007 at 09:08
[ Send Message ]
Surely having your timezone our is a major bug that can affect all sorts of stuff. Why wasn't it pushed out as a security update? After their should be minimal testing required for a time zone update.


[ Parent | Reply to this comment ]

Posted by mario (201.242.xx.xx) on Sun 7 Oct 2007 at 16:53
[ Send Message | View Weblogs ]
AFAIK it's not a security problem so they won't put it there but in volatile:

[ Parent | Reply to this comment ]

Posted by Anonymous (202.135.xx.xx) on Sun 30 Sep 2007 at 22:16
If you're in NZ and you've upgraded to Etch, /etc/localtime might not be correct: this will result in zdump reporting the right information but the time still being wrong. If you see this symptom and /usr/share/zoneinfo/NZ is different to /etc/localtime (use sum or cmp to find out), then you'll need to copy the former over the latter.

[ Parent | Reply to this comment ]

Posted by Anonymous (203.97.xx.xx) on Mon 1 Oct 2007 at 10:51
Good call. You can check that with zdump by suppling the file name rather than a timezone.

I believe running tzselect as root will update /etc/localtime correctly, which should be done for sarge, too.

[ Parent | Reply to this comment ]

Posted by ald (210.48.xx.xx) on Wed 3 Oct 2007 at 03:20
[ Send Message ]
Anyone sucessfully updated the Woody release, for NZ?

We have a machine that just behaves, and we would rather leave it alone.

I'm guessing it's going to be wrong for 3/52 weeks forever now.

[ Parent | Reply to this comment ]

Posted by Anonymous (203.96.xx.xx) on Wed 3 Oct 2007 at 04:49
I don't know of any reason why you shouldn't be able to use the instructions for sarge to update woody, though you should treat this particular problem as a sign that you'll need to upgrade that machine sometime soon.

[ Parent | Reply to this comment ]

Posted by mario (201.242.xx.xx) on Sun 7 Oct 2007 at 17:08
[ Send Message | View Weblogs ]
Talking about changes, Venezuela's government wants to change the
local time from GMT -04:00 to -04:30 sometime this year.

[ Parent | Reply to this comment ]

Posted by Anonymous (200.206.xx.xx) on Mon 22 Oct 2007 at 19:37
Brazilian users can install the "tz-brasil" package.

[ Parent | Reply to this comment ]

Sign In







Current Poll

Which init system are you using in Debian?

( 1028 votes ~ 6 comments )