April 12, 2007

Updating Time Zone Files

Posted in Linux/Zaurus Tips and Tricks, Zaurus Trials and Tribulations at 8:55 pm by sdjf

With all the hullaballoo in the Zaurus community about changing our Z’s to the correct daylight or standard timezone information, I tried finding out how to correct the timezone information on my sl5500.

After reading that menaie had posted an ipk with the updates for all Zaurus models and ROMs, and seeing that the ipk might have all the data, but might not install properly without a lot of work, I decided to try just fetching the one timezone file I needed off of a friend’s Linux box, and installing that.

I’ve been having serious space issues, and while I could have extracted just the one file I needed from menaie’s ipk, I thought that would be more work, and I decided to do what I thought would be easiest for me. Well, I turned out to be wrong.

Although the plan did not work for me, and I still do not know exactly why, I see that a lot of people have checked my blog, looking for information on how to fix their timezone files. So, because I believe there still is some good basic information about relevant commands in it, I have decided to post what I have written so far. But, be forewarned, it did not work for me, so if you decide to try this stuff, be sure to make complete backups first!

My goal is to share enough information here that others not very familiar with working on the command line will still have a better idea of the commands involved. If you don’t have a console, go here to see about getting one.

The first thing to do is find out what the official filename is to run the “echo” command with the timezone variable “TZ” and ask it to tell you what the filename for your particular timezone setting is. For me, what happened was:

bash-2.05# echo $TZ
America/Los_Angeles
bash-2.05#

The next step is to find out the exact locations of all symlinks and timezone files that applications on your Zaurus might access. We do that with the “find” command and immediately funnel or pipe the results to a command that gives detailed information about the results, the “ls -l” command.

So, in my case, I want to look at information about the standard file called “localtime” as well as information about my particular TZ file, so I will run the “find” command twice, once for “localtime”, and once for my TZ file (Los_Angeles):

bash-2.05# find / -name localtime | xargs ls -l
find: /proc/12/fd: No such file or directory
lrwxrwxrwx 1 root root 31 Jun 25 2006 /home/etc/localtime -> /usr/share.rom/zoneinfo/PST8PDT
lrwxrwxrwx 1 root root 14 Dec 31 1969 /usr/share.rom/zoneinfo/localtime -> /etc/localtime
bash-2.05#

And then I run it a second time for Los_Angeles:

bash-2.05# find / -name Los_Angeles | xargs ls -l
find: /proc/12/fd: No such file or directory
-rw-rw-r– 1 root root 1017 Dec 31 1969 /usr/share.rom/zoneinfo/America/Los_Angeles
bash-2.05#

When I look at the results, I see that several listings are actually “symlinks” (symbolic links) which point to data files in different locations. I know this because they have arrows pointing to the location of the actual files they point to, and because all those funny codes at the beginnings of the lines they are on start with “l” for link.

Next I want to make sure that the symlinks are really data files, so I run an “ls -l” on every file that was pointed to in the above results. In my case, the files I want to examine are:

/usr/share.rom/zoneinfo/PST8PDT
 
/etc/localtime

So I put the two files to be examined together in one “ls -l” command:

bash-2.05# ls -l /usr/share.rom/zoneinfo/PST8PDT /etc/localtime
lrwxrwxrwx 1 root root 31 Jun 25 2006 /etc/localtime -> /usr/share.rom/zoneinfo/PST8PDT
-rw-rw-r– 1 root root 1017 Jan 3 14:50 /usr/share.rom/zoneinfo/PST8PDT
bash-2.05#

Now, we see that the actual three data files are all in ROM, and the only way to change those is to flash a new ROM. But, I’m in luck. What I can do instead of flashing a new ROM is to simply put the corrected timezone file somewhere, and then change all my symlinks so that they point to the corrected data file, instead of the other ones.

In my case, that means I have two symlinks that need correcting, the ones I listed above. What I am going to do is remove them and then create new ones, that will point to the corrected data file.

I’m going to fix one at a time, to keep from getting confused. The first one is:

bash-2.05# ls -l /home/etc/localtime
lrwxrwxrwx 1 root root 31 Jun 25 2006 /home/etc/localtime -> /usr/share.rom/zoneinfo/PST8PDT
bash-2.05#

First I’ll remove the old symlink:

bash-2.05# rm /home/etc/localtime
bash-2.05#

Then I’ll create a new symlink with the same name, but point it to the corrected timezone file:

bash-2.05# ln -s /home/etc/PST8PDT /home/etc/localtime

bash-2.05#

Then I’ll do the same thing for the second symlink:

bash-2.05# rm /usr/share.rom/zoneinfo/localtime
bash-2.05# ln -s /home/etc/PST8PDT /usr/share.rom/zoneinfo/localtime

bash-2.05#

That might be a great idea except I am concerned that it won’t reset the configuration files for Qtopia applications, if someone needs to use them. On 2.38, they are based on specific locale, not on timezones per se. On a 2.38 ROM, and probably 3.xx, those would have to be taken care of as well, unless one never uses apps that access those settings files.

My conf files are Settings/locale.conf and Settings/CityTime.conf and the timezone settings refer to locations, not time zones:

bash-2.05# rgrep Angeles Settings
Settings/locale.conf:Timezone = America/Los_Angeles
Settings/CityTime.conf:Zone0 = America/Los_Angeles
Settings/CityTime.conf:ZoneName0 = Los Angeles
bash-2.05#

And, as it turned out, my above plan did not work out and, since I have been very busy, I didn’t have time to thoroughly document what I ended up doing and what went wrong. My hunch is that I left out a step, typed something wrong, or put something in a wrong directory, that I needed to do something else which I didn’t do, or that the files I grabbed and tried to install were of a wrong format.

I thought about it, for the five minutes a year it will take for me to reset the City Time application to make up for Congress’ decision to change Daylight Savings Time, it just isn’t worth all the additional time it would take for me to get it to happen automatically. There are a lot of other things I’d rather be doing.

sdjf

Advertisements
%d bloggers like this: