I am using a local timezone (non-UTC) on my server. Whenever I update the tzdata via yum, the system resets /etc/localtime to the default file and I am back on UTC.

While #date still shows the proper timezone, CRON and other services switch to UTC.

How can I prevent that?

  • that's very unlikely because the tzdata rpm package does not own the /etc/localtime file and contains no post-install script fiddling with it. (git.centos.org/blob/!!rpms!tzdata.git/…)
    – guido
    Apr 23, 2015 at 5:37
  • 4
    @guido But, try $ rpm -q --triggeredby tzdata, and you'll see the glibc-common package has a script triggered by tzdata update. Specifically, it runs /usr/sbin/tzdata-update. (This is on CentOS 6 and earlier; things are different with systemd.)
    – mattdm
    Apr 23, 2015 at 19:20
  • What is the output of ls -l /etc/localtime and cat /etc/sysconfic/clock? Apr 24, 2015 at 5:08

2 Answers 2


My CentOS knowledge is a bit out of date, but you may need to also specify the timezone in /etc/sysconfig/clock.

As a last-ditch effort, of course, you could:

chattr +i /etc/localtime  # immutable

It is surprising that tzdata munges /etc/localtime though. Have you made it a symlink to /usr/share/zoneinfo/...? Are you perhaps updating glibc at the same time as tzdata? (since the glibc package owns /etc/localtime)

  • I use sudo ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime to update the time. After a tzdata update, the time is reset to UTC. After changing the clock to Europe/Amsterdam, this doesn't happen anymore. Maybe this is not the correct way to set localtime, but your answer seems to fix my problem.
    – SPRBRN
    Sep 3, 2015 at 8:50

All RH based system before version 7 the correct way was to set in /etc/sysconfig/clock and then run tzdata-update. The tzdata rpm runs this so that's why it resets it.

In version 7 we have timedatectl...

  • There is no time limit, you can post new answers any time. But they should be good quality and significantly different as the already existing ones.
    – peterh
    Sep 27, 2017 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .