1

Should /etc/localtime (under RHEL 5.3, not that I think it matters) be:

  1. a symlink to /usr/share/zoneinfo/whatever
  2. a hard link to /usr/share/zoneinfo/whatever
  3. a copy of /usr/share/zoneinfo/whatever

I'd prefer 1) because it's explicit and easy to manage via Puppet but will it break anything? RedHat's default looks to be 3). Edit: I'm aware of the usual problems of symlinking across filesystems, tzdata updates, etc, but wasn't aware of the historical no-/usr-during-rc.sysinit gotcha. Thanks, all!

markdrayton
  • 2,429
  • 1
  • 20
  • 24

5 Answers5

6

3 is the prefered method. This is due to an old bug that cause systems with a seperate /usr partition to set the system time to UTC since /usr/share/zoneinfo was not available during rc.sysinit. You can look it up at the following bugzilla

katriel
  • 4,407
  • 22
  • 20
  • Thanks for the link. I *think* I can use file { "/etc/localtime": ensure => "file:///usr/share/zoneinfo/GMT" } to get Puppet to make a copy if needed. Job done! – markdrayton Jun 23 '09 at 16:02
1

There is a reason for making a copy instead of symlink, for example if you have /usr on separate partition than / or /etc so there could be problems in some rare circumstances.

ipozgaj
  • 1,061
  • 10
  • 10
  • Hardlinks can be used only when both files are on the same partition. Symlink would fail if /usr is separate partition and it's not mounted. – mateusza Jun 23 '09 at 15:57
1

As was previously stated by others, it is just a safer standard to make it a copy of the file rather than a symlink (hard or soft). So much depends on the localtime file that having it broken can cause issues.

Also there are convenient utilities to handle this for you and should probably be your best course of time zone management for the system. Most linux systems will have tzselect available which will allow you to select the timezone you want the system to use and manage the localtime file for you without having to do so yourself. I would recommend using this tool unless you have reason not to.

Jeremy Bouse
  • 11,241
  • 2
  • 27
  • 40
0

Different distributions handle this in different ways. I also prefer using symlinks, and that should make no difference at all.

The only possible problem you could encounter is that the original file changes path with an update and so the symlink breaks, but that's unlikely.

0

What I find annoying is that every time "tzdata" updates, it changes my timezone so I use 3) in conjunction with "chattr +i /etc/localtime"

Cristian
  • 51
  • 1
  • 1
  • 3