LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 05-06-2012, 09:49 AM   #1
hoyortsetseg
LQ Newbie
 
Registered: Nov 2011
Distribution: slackware
Posts: 5

Rep: Reputation: Disabled
Cannot change timezone on Slackware 13.37


Hi,

This is not a question. Just some problem I solved and thought I could share it here if someone has the same problem. I considered posting this on General > success stories but on second thought it did not seem like that much of a success and the problem might be Slackware specific. Feel free to move this if it doesn't fit here. But there's still a mystery to be solved. See the bottom of the post.

I am running Slackware 13.37. Since I installed Slackware on this computer in 2007 I have never formatted or reinstalled the OS. I just upgraded as described (might be related).

I recently moved several timezones away from my hometown so I wanted to change the timezone setting.

Changing the timezone looked fairly easy according to a simple web search.

Delete /etc/localtime
Code:
sudo rm -f /etc/localtime
Make a symlink to your new timezone
Code:
sudo ln -s /usr/share/zoneinfo/<your_continent>/<your_zone> /etc/localtime
(some sources used ln -sf)

Check if you were able to change the timezone with "date".
Code:
date
Set the time with "date"
(Omitting this because I cannot look up the string format again)

If your hardware clock is set to local time write this new local time to hardware clock
Code:
sudo /sbin/hwclock --systohc
My problem: the symlinking step did not appear to work. After creating the symlink and checking the timezone with "date", I saw that the timezone remained the same as that of my hometown. Instead of sudoing I tried again as root to no avail.

My solution: Out of desperation I looked at the content of timezone files in /usr/share/zoneinfo. They are mostly gibberish, but in the last line you can make out the timezone abbreviations. I checked several files and saw that the timezone abbreviations were the same as that of my hometown timezone. Weird.

So I decided to reinstall glibc-zoneinfo which has the timezone lists and information.

Code:
sudo /usr/sbin/slackpkg reinstall glibc-zoneinfo
When slackpkg prompted I chose the "overwrite" option.

After this, the steps I described above worked smoothly. My timezone is correct, time is correct.

Mystery: Out of curiosity I looked at the contents of the new timezone files in /usr/share/zoneinfo. They all had the correct timezone abbreviations in their last lines. What struck me was that these files were much shorter than my original timezone files. I don't know how I messed them up, how they ended up much longer then they were supposed to be.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-06-2012, 10:15 AM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,435

Rep: Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867
to change the timezone you can also run
Code:
timeconfig
if you want to sync once with a timeserver
Code:
ntpdate pool.ntp.org
to write the date to the system clock
Code:
hwclock -w

Last edited by ponce; 05-06-2012 at 10:17 AM.
 
3 members found this post helpful.
Old 05-06-2012, 10:41 AM   #3
hoyortsetseg
LQ Newbie
 
Registered: Nov 2011
Distribution: slackware
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thank you ponce.

I did try timeconfig as well. That did not work either. It must be using the files in /usr/share/zoneinfo.

What I don't get is how I managed to mess those zoneinfo files up in the first place. If they had been OK, symlinking would have worked, timeconfig would have worked.

Maybe the morale of this thread is, if you can't change the timezone no matter what you do, it might serve to check the content of the zoneinfo files. In my case, this is what solved my problem.
 
Old 05-07-2012, 02:24 AM   #4
kabamaru
Member
 
Registered: Dec 2011
Location: Greece
Distribution: Slackware
Posts: 276

Rep: Reputation: 133Reputation: 133
Maybe this wouldn't work in your case, due to the symlinking problem, but FWIW Slackware provides a super easy way to select your timezone:

pkgtool > Setup > Select Your Timezone

Last edited by kabamaru; 05-07-2012 at 02:25 AM. Reason: typo
 
2 members found this post helpful.
Old 05-07-2012, 03:22 AM   #5
hoyortsetseg
LQ Newbie
 
Registered: Nov 2011
Distribution: slackware
Posts: 5

Original Poster
Rep: Reputation: Disabled
I am marking this "solved" but the mystery remains. Any idea on how the zoninfo files were messed up would be appreciated.
 
Old 05-07-2012, 04:04 AM   #6
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,776

Rep: Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603Reputation: 603
Quote:
Originally Posted by hoyortsetseg View Post
I am marking this "solved" but the mystery remains. Any idea on how the zoninfo files were messed up would be appreciated.
Just a guess - I have not researched this...

Sometime in the last few years when the rules for daylight-saving time changed in the US (other places as well?), it was necessary to update those files. I also have a vague memory that the format of some time related files changed at or around that time.

I had some fits sorting it out at the time on different machines and distinctly remember noticing that the new files were signifigantly smaller than the old ones, which was a concern at the time.

Maybe your version updates failed to pick those up for some reason...

Hope this is more helpful than confusing.
 
1 members found this post helpful.
Old 05-07-2012, 05:07 AM   #7
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,037

Rep: Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756Reputation: 756
Have you applied all the patches? There have been more than a couple that affect the zoneinfo files (see http://ftp.osuosl.org/pub/slackware/.../ChangeLog.txt); the link is to Slackware-64 but the same changes apply to 32-bit.

Slackware.com appears to be down; you can download patches from (64-bit) http://ftp.osuosl.org/pub/slackware/...ches/packages/ or (32-bit) http://ftp.osuosl.org/pub/slackware/...ches/packages/. Just use
Code:
upgradepkg *.t?z
once you've got all the current patch levels (I use wget to get 'em all into a directory then run upgradepkg, YMMV).

Hope this helps some.
 
1 members found this post helpful.
Old 06-07-2012, 06:47 PM   #8
chandan_raka
Member
 
Registered: Apr 2005
Location: BC
Distribution: Centos
Posts: 34

Rep: Reputation: 16
[SOLVED] Cannot change timezone on Slackware 13.37

this technique works for I guess most destro.

In centos I did yum reinstall tzdata then copied the zonefile as localtime @/etc and it worked
 
Old 06-07-2012, 08:03 PM   #9
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 862

Rep: Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685Reputation: 1685
Another thing to consider is that if /usr is on its own partition, it's not going to be there when the clock is set in /etc/rc.d/rc.S. That's why timeconfig makes a copy of the zoneinfo file as /etc/localtime (and leaves an otherwise unused /etc/localtime-copied-from symlink in /etc to document what the current timezone is).

That's probably not the issue here, but is something to be aware of regarding the instructions that were found online.
 
Old 10-28-2012, 10:29 AM   #10
slowpaxi
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by ponce View Post
to change the timezone you can also run
Code:
timeconfig
if you want to sync once with a timeserver
Code:
ntpdate pool.ntp.org
to write the date to the system clock
Code:
hwclock -w
Ponce you are always concise and helpful. Thank you.
Altro che "Ponce"!!!
 
Old 10-29-2012, 03:44 PM   #11
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware 14.1
Posts: 467

Rep: Reputation: 87
ntpdate is being retired.

On the Gentoo wiki http://en.gentoo-wiki.com/wiki/NTP , they recommend something like:

# sntp -s pool.ntp.org

and it works on Slackware too.
 
  


Reply

Tags
glibc, timezone, zoneinfo


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change timezone DST r_etemaadi Linux - Newbie 5 05-01-2008 12:27 AM
how to change timezone through system call shivakumar.a Linux - Newbie 1 02-15-2008 06:15 AM
How to change the timezone from EDT to PDT using Ntpd AjiNIMC Linux - Server 1 05-28-2007 01:55 PM
Change timezone using date davholla Linux - General 16 11-09-2005 02:53 AM
How to configure TimeZone to change automatic .. piraxter Slackware 1 04-09-2003 11:14 PM


All times are GMT -5. The time now is 09:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration