0

According to localtime from Linux manual page:

It should be an absolute or relative symbolic link pointing to /usr/share/zoneinfo/, followed by a timezone identifier such as "Europe/Berlin" or "Etc/UTC".

Here is the output of ls -la /etc/localtime, which is not a symbolic link, in my environment:

-rw-r--r--. 1 root root 724 Apr  3  2012 /etc/localtime

and for cat /etc/localtime

TZif2їԒazpҹӂ­񔘺ԣ౗<¿ֆfpם򁚧񛽦܈̰ݠYݪ񝱳ߵdp󿼅ᖗ񡝸⸋p⿬㮠p䠱咥p悤鴘񪤘
                                                    따
                                                      셀촿񮸼񰗯퉰  ݉ 
ν򒙐S񾿁~pCDTCSTTZif2) 
                  ÿÿÿÿtϰÿÿÿÿїԿÿÿÿѡzpÿÿÿÿҹÿÿÿÿӂ­򁀿ÿԚ:ÿÿÿÿԣ౿ÿÿÿռ¿ÿÿÿÿֆfpÿÿÿÿם򂀿ÿÿڧ򁀿ÿۿ&ÿÿÿÿ܈̰ÿÿÿÿݠYÿÿÿÿݪ򁀿ÿݲsÿÿÿÿߵdpÿÿÿÿ󿼅ÿÿÿÿᖗ򁀿ÿ᝸ÿÿÿÿ⸋pÿÿÿÿ⿬ÿÿÿÿ㮠pÿÿÿÿ䠱ÿÿÿÿ咥pÿÿÿÿ悤ÿÿÿÿ鴘򁀿ÿꤘÿÿÿÿ
    따ÿÿÿÿ
          셀ÿÿÿÿ촿򁀿ÿÿÿÿÿ򁀿ÿ𐗯ÿÿÿÿ퉰 ݉ 
ν򒙐S񿿂q羐LMTCDTCST
CST-8

My environment is Fedora 17 running on VirtualBox.

I copied the entire Fedora 17 image from someone else. In other words, I didn't build the environment from scratch.

I'm afraid of that it's a truly mistake, or it's made for some reason.

1 Answer 1

3

Likely what has happened is a copy of a zone file was made instead of a symbolic link or hard link.

You may be able to determine the source by comparing hashes of zone files installed on the system.

$ sha256sum /etc/localtime
821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6  /etc/localtime

$ find /usr/share/zoneinfo/ -type f -exec sha256sum "{}" + |grep 821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6
821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6  /usr/share/zoneinfo/posix/America/Kentucky/Louisville
821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6  /usr/share/zoneinfo/posix/America/Louisville
821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6  /usr/share/zoneinfo/America/Kentucky/Louisville
821d6d97e3d34a3de2315279260e139adf484e581b4d187f8e6b532403b0f1c6  /usr/share/zoneinfo/America/Louisville

The "1" in your output of ls in the second field means there is 1 hard link to the file, so it's not a link to the same file as the original in the zoneinfo path.

On modern Fedora you can use timedatectl to either

timedatectl list-timezones

or

timedatectl set-timezone time_zone

Otherwise, simply ln -sf the appropriate zonefile from /usr/share/zoneinfo/ overwriting /etc/localtime (make a backup just in case!)

I doubt this situation is necessarily problematic, the reason that it's preferable to have a link instead of a copy is because software package updates might change the time rules. But this is Fedora 17, which is 10 years old...so it's not getting any updates ;)

2
  • it's worth reading some of the related questions on the side here too, i just learned about /etc/sysconfig/clock Commented Aug 1, 2021 at 14:57
  • 2
    on my Ubuntu (systemd 245), the localtime(5) man page says that "Because the timezone identifier is extracted from the symlink target name of /etc/localtime, this file may not be a normal file or hardlink." so I suppose it's possible that having it as a regular file could be at least sub-optimal.
    – ilkkachu
    Commented Aug 1, 2021 at 15:12

You must log in to answer this question.

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