Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 110038 - Do not symlink /etc/localtime, copy the file instead
Summary: Do not symlink /etc/localtime, copy the file instead
Status: VERIFIED FIXED
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Gentoo Linux x86 Installation Guide (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Jan Kundrát (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-21 07:58 UTC by Henrik Brix Andersen
Modified: 2014-01-20 19:26 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Brix Andersen 2005-10-21 07:58:27 UTC
Chapter "7.a. Timezone" of the Gentoo Handbook instructs the user to symlink
/etc/localtime to e.g. /usr/share/zoneinfo/GMT for setting up the timezone.

The user should not symlink that file, it should be copied instead - since /usr/
might not be mounted at boot time.
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2005-10-21 13:23:11 UTC
Does this really matter? From the moment /usr is mounted the localtime instantly
resolves again...
Comment 2 Henrik Brix Andersen 2005-10-21 13:25:00 UTC
True, but why allow it to be unresolved in the first place?
Comment 3 SpanKY gentoo-dev 2005-10-21 16:59:56 UTC
for daemons that start before localtime though may get skewed times
Comment 4 Henrik Brix Andersen 2005-10-21 17:03:44 UTC
(In reply to comment #3)
> for daemons that start before localtime though may get skewed times

I didn't quite understand that comment...?
Comment 5 Jan Kundrát (RETIRED) gentoo-dev 2005-10-22 00:08:41 UTC
(In reply to comment #4) 
> (In reply to comment #3) 
> > for daemons that start before localtime though may get skewed times 
>  
> I didn't quite understand that comment...? 
 
IMHO he meant that daemons that start before /usr is mounted could report wrong 
times to the logs etc... 
 
 
Comment 6 Jan Kundrát (RETIRED) gentoo-dev 2005-10-22 00:10:58 UTC
FYI, Red Hat (well, Scientific Linux) uses a copy of that file while Debian 
makes a symlink - at least that's the case on a few machines I've checked. 
Comment 7 SpanKY gentoo-dev 2005-10-22 00:14:15 UTC
(In reply to comment #3)
> for daemons that start before localtime though may get skewed times

i meant 'localmount' not 'localtime' since localmount will setup /usr ...
Comment 8 Henrik Brix Andersen 2005-10-22 02:48:30 UTC
(In reply to comment #7)
> i meant 'localmount' not 'localtime' since localmount will setup /usr ...

Ah, yes - I agree.

By the way, Linux From Scratch recommends copying as well due to the same reason
as stated above. They also mention a problem with /etc/localtime being a symlink
to /usr/... if booted up in single-user mode.
Comment 9 Henrik Brix Andersen 2005-11-15 10:56:59 UTC
Anything preventing this change from being made?
Comment 10 Xavier Neys (RETIRED) gentoo-dev 2005-11-21 07:38:46 UTC
Done
Comment 11 Henrik Brix Andersen 2005-11-21 09:34:21 UTC
Thanks.
Comment 12 SpanKY gentoo-dev 2005-11-23 19:45:02 UTC
*** Bug 89046 has been marked as a duplicate of this bug. ***
Comment 13 Jan Kundrát (RETIRED) gentoo-dev 2005-11-25 12:32:31 UTC
Same should be done for guide-localization.xml... 
Comment 14 Jan Kundrát (RETIRED) gentoo-dev 2005-11-25 12:36:18 UTC
Fixed again :-). 
Comment 15 Jan Kundrát (RETIRED) gentoo-dev 2005-12-21 06:46:59 UTC
*sigh*, fixed yet again, now in gentoo-{sparc,x86}-quickinstall.xml files. Docs should be 100% fixed now :-).
Comment 16 Paul B. Henson 2006-03-22 18:05:35 UTC
I was recently reinstalling Gentoo, and noticed that the documentation now
recommends copying your time zone file rather than linking to it. I tracked
this change down to this bug.

While I understand the concern that the time zone will be wrong when /usr
is not mounted in the case of a symlink, the benefit of the symlink is your
time zone is still correct when the underlying time zone package is
updated.  If it is a copy, if the underlying time zone package is updated,
the copy will need to be updated to take effect.

I did a little searching, and didn't find any mention of this. Are there
any warnings generated by emerge when updating the time zone package
indicating you must manually recopy your time zone? Can you think of a
clean automated way to handle this? There is a US DST timezone change
coming up in the next year that will impact a lot of people.
Comment 17 Mikolaj Klimek 2006-03-24 06:49:56 UTC
(In reply to comment #16)

Confirmed. Eg - after timezone-data upgrade (when /etc/localtime is a binary file) kicker crash (tzfile problems). IMO einfo (in timezone-data ebuild) should warn about it.

Cheers.
Comment 18 Henrik Brix Andersen 2006-03-24 06:57:55 UTC
Reopening.
Comment 19 SpanKY gentoo-dev 2006-03-24 07:34:50 UTC
there is already a bug tracking that assigned to toolchain
Comment 20 Paul B. Henson 2006-03-24 10:29:16 UTC
(In reply to comment #19)

Do you know the bugid off hand? I did not see it when I was searching for time zone related bugs.

Ideally, if possible, it would be nice for the ebuild to automatically copy the new time zone file instead of just generating a warning. Or at least have it show up as a configuration change when etc-update or equivalent are run (I'm not sure how they would handle binary files though).
Comment 21 Jan Kundrát (RETIRED) gentoo-dev 2006-03-26 11:24:31 UTC
(In reply to comment #20)
> Do you know the bugid off hand? I did not see it when I was searching for time
> zone related bugs.

Search for bugs assigned to toolchain@g.o having "localtime" in the description field returned bug 124100.
Comment 22 Paul B. Henson 2006-03-28 12:23:36 UTC
(In reply to comment #21)
> Search for bugs assigned to toolchain@g.o having "localtime" in the description
> field returned bug 124100.

I'm not sure that bug is completely relevant. It seems to mostly involve KDE applications crashing, including cases where localtime *was* a symbolic link and cases where it was a copy of a new time zone file from the updated package.

The bug I would like consider is the case where you update the time zone package, things continue to work fine, but you don't realize you have a stale copy of the time zone in /etc and end up with the wrong time.

Taking a quick look at sys-libs/timezone-data, I don't see anything that would automatically copy over the updated time zone file or warn the user to do so manually. I think I will open a new bag on that package and see what the consensus is.
Comment 23 Henrik Brix Andersen 2006-03-28 12:43:16 UTC
(In reply to comment #22)
> Taking a quick look at sys-libs/timezone-data, I don't see anything that would
> automatically copy over the updated time zone file or warn the user to do so
> manually. I think I will open a new bag on that package and see what the
> consensus is.

Please CC: brix@gentoo.org if you do so.

Comment 24 Paul B. Henson 2006-03-28 14:37:12 UTC
(In reply to comment #23)
> Please CC: brix@gentoo.org if you do so.

I had already created it, I went back and added you. For any other interested parties, it is bug 127899.
Comment 25 Alex Jones 2006-05-16 10:23:15 UTC
How about a make.conf setting for TIMEZONE or something?

When the timezone-data ebuild postinsts, it makes the copy automatically.
Comment 26 Jan Kundrát (RETIRED) gentoo-dev 2006-05-16 12:55:00 UTC
(In reply to comment #25)
> How about a make.conf setting for TIMEZONE or something?
> 
> When the timezone-data ebuild postinsts, it makes the copy automatically.

This bugreport was about a documentation issue. Please consider using bug 127899 for your suggestions.

Comment 27 Vitaliy Gladkevitch 2014-01-20 17:24:02 UTC
With the growing popularity of systemd I feel that this bug has newfound relevance. It's a legacy thing to have /usr on a separate partition and not having the symlink breaks modern software.

Here are some useful links to support the cause:
http://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
and
https://fedoraproject.org/wiki/Features/UsrMove

CentOS:
[root@centos ~]# ls -l /etc/localtime 
lrwxrwxrwx. 1 root root 30 Jan 18 04:21 /etc/localtime -> /usr/share/zoneinfo/US/Eastern

Ubuntu:
vitaliy@ubuntu:~$ sudo ls -l /etc/localtime 
lrwxrwxrwx 1 root root 30 Jan 18 11:49 /etc/localtime -> /usr/share/zoneinfo/US/Eastern

I am not saying that we should follow everything CentOS or Ubuntu does but the current state of things breaks modern software.
gentoo ~ # /usr/lib/systemd/systemd-timedated 
/etc/localtime should be a symbolic link to a timezone data file in /usr/share/zoneinfo/.
Comment 28 Jan Kundrát (RETIRED) gentoo-dev 2014-01-20 18:44:43 UTC
(In reply to Vitaliy Gladkevitch from comment #27)
> but the current state of things breaks modern software.

Looks like the systemd ebuild shall convert the configuration for the user, or at least point them in a right direction.

Please file a bugreport against the systemd package so that its maintainers are aware of the problem. We do support multiple init systems, and as systemd is not the default one, the Handbook therefore won't be changed.
Comment 29 Sven Vermeulen (RETIRED) gentoo-dev 2014-01-20 19:26:03 UTC
A separate /usr is not "legacy" and still supported (you're just likely to require an initramfs). Unless there are bugs related to /etc/localtime being a copy (which should be a different bugreport, not reopening an 8-year old bug), there are no changes needed.