Java and timezone issues!

Derek Broughton derek at
Mon Apr 20 17:56:19 UTC 2009

David M. Karr wrote:

> Derek Broughton wrote:
>> David M. Karr wrote:
>>> The two packages that got installed this morning were "tzdata" and
>>> "tzdata-java", one of which (or the installation process itself) changed
>>> /etc/localtime from a link to a hard file.  What's odd is that the
>>> "installed files list" for either package does not list
>>> "/etc/localtime".
>> It's not odd - I explained it in my first post to this thread, and I
>> thought you'd read it, since you responded.
> I don't know what specific post you're referring to.

Sorry, my mistake - I hadn't realized we were on a new, identical, thread.
>>> However, I suppose if something tried to replace the
>>> file that "/etc/localtime" was symlinked to, the process of doing that
>>> might leave "/etc/localtime" as a plain copy of the original
>>> symlinked-to file.
>> No.
> I don't know how it's doing it, I just know from a very simple
> experiment that it is.  Just before I installed the tzdata update a
> couple of days ago, I looked at the file.  It was a symlink.  I
> installed the tzdata update.  It was now a plain file.

I told you - tzdata AUTOMATICALLY does it:
$ grep -A1 "rm -f /etc/local" /var/lib/dpkg/info/tzdata.postinst
        rm -f /etc/localtime && \
            cp -f /usr/share/zoneinfo/$AREA/$ZONE /etc/localtime

(see how it removes localtime first, because of the hazard of updating it if
somebody has made it a symlink).  I'll leave it as an exercise for the user
to see how you can prevent that happening...
>>> The "tzdata" package had
>>> "/usr/share/zoneinfo/US/Pacific" in its installed files list, which is
>>> the file /etc/localtime is supposed to be symlinked to.
>> It's _not_ supposed to be symlinked.
> I'm sure you're right.  The symlink is a workaround for the broken
> timezone detection process in Java.  It's apparently been used so much
> some people assumed it was supposed to be that way.

No, it _used_ to be that way.  For reasons obscure to me, Linux has not been
using the symlink for a long time.

More information about the ubuntu-users mailing list