Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

5 Answers

up vote 6 down vote accepted

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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"

share|improve this answer
    
Just use the tzselect command instead of doing it manually. This will solve your update problem. –  Martijn Heemels Jun 23 '09 at 18:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.