how to deal with broken time zones during a CentOS 5.3 kickstart

Hello again fair readers !  Today's quick tip concerns the problem with missing time zones when deploying CentOS 5.3 (and some of the more recent Fedoras) in a kickstart environment.  It's a known problem, and unfortunately, since the source of the problem (an incomplete time zone data file) lies deep in the heart of the kickstart environment, fixing it directly is a distinct pain in the buttock region. There is, however, a workaround - and it's not even that messy !  The first step is to use a region that does exist, such as « Europe/Paris », which will satisfy the installer - then set the time zone to what you actually want after the fact in the « %post » section.  So, in the top section of the kickstart file, we'll put :

# set temporarily to avoid time zone bug during install
timezone --utc Europe/Paris

The « --utc » switch simply states that the system clock is in UTC, which is pretty standard these days, but ultimately optional.  Next, in the %post section towards the end, we'll shoe horn our little hack fix into place :

# fix faulty time zone setting
mv /etc/sysconfig/clock /etc/sysconfig/clock.BAD
sed 's@^ZONE="Europe/Paris"@ZONE="Etc/UTC"@' /etc/sysconfig/clock.BAD > /etc/sysconfig/clock
/usr/sbin/tzdata-update

So, what's going on there ?  Let's break it down :

And that, as they say, is that.  Happy kickstarting, friends, and i'll see you next time !