View previous topic :: View next topic |
Author |
Message |
padoor Advocate


Joined: 30 Dec 2005 Posts: 4185 Location: india
|
Posted: Tue Jul 24, 2012 3:28 am Post subject: how exactly to set timezone in /etc/localtime ?[solved] |
|
|
Code: | tux ramaswamy # cat /etc/localtime
TZif21Local time zone must be set--see zic manual pageTZif21Local time zone must be set--see zic manual page
<Local time zone must be set--see zic manual page>0
Asia/Kolkata
tux ramaswamy # man zic
|
although i get correct time in the hwclock i get the zic message always.
/etc/localtime is as above minus the message
man zic does not say how to set the localtime file.
is there anything to be in front of Asia/kolkata which is my timezone
help needed _________________ reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Last edited by padoor on Wed Jul 25, 2012 4:43 am; edited 1 time in total |
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Jul 24, 2012 5:02 am Post subject: |
|
|
padoor ...
You probably omitted to copy the timezone data file to /etc during the install ...
Code: | cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime |
best ... khay |
|
Back to top |
|
 |
padoor Advocate


Joined: 30 Dec 2005 Posts: 4185 Location: india
|
Posted: Wed Jul 25, 2012 4:42 am Post subject: |
|
|
copying timezone makes difference in the file than manually entering the time zone.
now the file reads as below.
Code: | TZif2^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^D^@^@^@^D^@^@^@^@^@^@^@^D^@^@^@^D^@^@$
��^���^Eq^X�^�2��t^R^�^A^B^C^B^@^@R�^@^@^@^@[h^@^D^@^@MX^@ ^@^@[h^A $
^@^@[h^A
LMT^@HMT^@BURT^@IST^@^@^@^@^@^@^@^@^@^@^@
IST-5:30
|
and the message to set timezone has gone after cp timezone to localtime.
thanks for reply.  _________________ reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name) |
|
Back to top |
|
 |
Massimo B. Veteran


Joined: 09 Feb 2005 Posts: 1899 Location: PB, Germany
|
Posted: Tue Nov 05, 2013 7:13 am Post subject: |
|
|
khayyam wrote: | Code: | cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime |
|
btw. why does documentation recommend to copy? Is a symlink also fine? That would better show to me what timezone is actually set without looking into the binary file. _________________ HP ZBook Power G9 i7-12700H|HP ProDesk 600 G5 i7-9700|HP EliteDesk 800 G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
 |
666threesixes666 Veteran


Joined: 31 May 2011 Posts: 1248 Location: 42.68n 85.41w
|
Posted: Tue Nov 05, 2013 7:25 am Post subject: |
|
|
symlink makes more sense. pro tip, if you're dual booting xp, make xp load utc instead of setting bios to local clock. (see arch wiki) i run a symlink, works good. ive been going over this qutie a bit today.
Code: |
mkultra [ ~ ]$ date
Tue Nov 5 02:24:40 EST 2013
mkultra [ ~ ]$ ls -al /etc/localtime
lrwxrwxrwx 1 root root 27 Nov 4 10:43 /etc/localtime -> /usr/share/zoneinfo/EST5EDT
|
|
|
Back to top |
|
 |
Fitzcarraldo Advocate


Joined: 30 Aug 2008 Posts: 2057 Location: United Kingdom
|
Posted: Wed Nov 06, 2013 2:09 am Post subject: |
|
|
Apparently it is not always a good idea to make a symlink:
Quote: | Re: time issue
On Mon, 30 May 2011 10:57:51 +0200, Florian Philipp wrote:
> The localization guide seems to be in a poor state. Copying the zoneinfo
> file from /usr/share... to /etc/localtime is not the best way to do it
> because then you miss updates. It is better to create a symlink between
> the two.
Which will break if /usr is on a separate filesystem.
> Also, instead of setting the timezone in /etc/conf.d/clock, you
> do it in /etc/timezone nowadays (change introduced in baselayout-2 if
> I'm not mistaken).
Setting it in /etc/timezone also takes care of the updates situation,
because the timezone-data ebuild automatically copies the correct file
to /etc/.
--
Neil Bothwick |
http://www.gossamer-threads.com/lists/gentoo/user/231423#231423 _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
 |
Massimo B. Veteran


Joined: 09 Feb 2005 Posts: 1899 Location: PB, Germany
|
Posted: Wed Nov 06, 2013 12:35 pm Post subject: |
|
|
Thank you for that information.
Does that mean, setting /etc/timezone makes the ebuild maintain the binary /etc/localtime ? So having /etc/localtime -> /usr/share/zoneinfo/Europe/Berlin will be overwritten by the ebuild anyway?
Ok, breaking with /usr on separate filesystem is a point. I don't have that. So with local /usr having that symlink should be fine with updated /usr/share/zoneinfo/Europe/Berlin as well. _________________ HP ZBook Power G9 i7-12700H|HP ProDesk 600 G5 i7-9700|HP EliteDesk 800 G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
 |
Fitzcarraldo Advocate


Joined: 30 Aug 2008 Posts: 2057 Location: United Kingdom
|
Posted: Wed Nov 06, 2013 2:06 pm Post subject: |
|
|
As Neil Bothwick wrote, the sys-libs/timezone-data ebuild takes care of updating /etc/localtime whenever necessary, so symlinking is just not necessary, and copying once only is fine. Have a look at the relevant part of the ebuild and you can see this:
Code: | 80 pkg_config() {
81 # make sure the /etc/localtime file does not get stale #127899
82 local tz src etc_lt="${EROOT}etc/localtime"
83
84 if has_version '<sys-apps/baselayout-2' ; then
85 src="${EROOT}etc/conf.d/clock"
86 tz=$(unset TIMEZONE ; source "${src}" ; echo ${TIMEZONE-FOOKABLOIE})
87 else
88 src="${EROOT}etc/timezone"
89 if [[ -e ${src} ]] ; then
90 tz=$(sed -e 's:#.*::' -e 's:[[:space:]]*::g' -e '/^$/d' "${src}")
91 else
92 tz="FOOKABLOIE"
93 fi
94 fi
95 [[ -z ${tz} ]] && return 0
96
97 if [[ ${tz} == "FOOKABLOIE" ]] ; then
98 elog "You do not have TIMEZONE set in ${src}."
99
100 if [[ ! -e ${etc_lt} ]] ; then
101 # if /etc/localtime is a symlink somewhere, assume they
102 # know what they're doing and they're managing it themselves
103 if [[ ! -L ${etc_lt} ]] ; then
104 cp -f "${EROOT}"/usr/share/zoneinfo/Factory "${etc_lt}"
105 elog "Setting ${etc_lt} to Factory."
106 else
107 elog "Assuming your ${etc_lt} symlink is what you want; skipping update."
108 fi
109 else
110 elog "Skipping auto-update of ${etc_lt}."
111 fi
112 return 0
113 fi
114
115 if [[ ! -e ${EROOT}/usr/share/zoneinfo/${tz} ]] ; then
116 elog "You have an invalid TIMEZONE setting in ${src}"
117 elog "Your ${etc_lt} has been reset to Factory; enjoy!"
118 tz="Factory"
119 fi
120 einfo "Updating ${etc_lt} with ${EROOT}usr/share/zoneinfo/${tz}"
121 [[ -L ${etc_lt} ]] && rm -f "${etc_lt}"
122 cp -f "${EROOT}"/usr/share/zoneinfo/"${tz}" "${etc_lt}"
123 } |
However, the ebuild is clever enough to skip the automatic update of /etc/localtime if you had already symlinked it.
So, the bottom line is: symlinking brings no additional benefit and won't work anyway for people who have /usr on a separate filesystem. However, for those people who have /usr on the same partition/filesystem, symlinking won't do any harm but is no better than the once-only copying procedure. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
 |
|