how to set time zone
Hello All:
what is the right way to set timezone?
I have added tzdata into my image, and can find some variables in the etc, e.g. 'TZ'.
on my archlinux, I can set TIMEZONE in the rc.conf, which is used in rc.sysvinit (which will link the /etc/localtime using TIMEZONE).
what is the right place to locate similar setting code (e.g. link the /etc/localtime) in the yocto?
thanks!
Signature · 3 lines
Yi Qingliang [email protected] http://niqingliang2003.wordpress.com
2011/10/28 Ni Qingliang <[email protected]>:
Quoted 24 lines
Hello All:
what is the right way to set timezone?
I have added tzdata into my image, and can find some variables in the etc, e.g. 'TZ'.
on my archlinux, I can set TIMEZONE in the rc.conf, which is used in rc.sysvinit (which will link the
/etc/localtimeusing TIMEZONE).what is the right place to locate similar setting code (e.g. link the
/etc/localtime) in the yocto?thanks!
--
Yi Qingliang
[email protected]
http://niqingliang2003.wordpress.com
Quoted 5 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Hi,
you could try the following:
http://www.rwhitby.net/blog/nslu2-linux/setting-the-openmoko-timezone.html
Well this is the first entry when using google with "openembedded time zone", so please consider using search engines first next time.
Also this is the very same process like it is done on a desktop computer, googling for "set time zone linux command line" gives this result:
http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz-variable/
Which shows more precise steps at the headline "Set timezone using /etc/localtime configuration file [any Linux distro]".
(Sorry for cross posting, but this was carried over to the OE-Core list)
Signature · 2 lines
Regards Samuel
THANKS!
I still want the native support by oe-core/yocto:-). If no, I will try by myself.
Quoted 52 lines · Samuel Stirtzel
2011/10/28 Ni Qingliang <[email protected]>:
Quoted 24 lines
Hello All:
what is the right way to set timezone?
I have added tzdata into my image, and can find some variables in the etc, e.g. 'TZ'.
on my archlinux, I can set TIMEZONE in the rc.conf, which is used in rc.sysvinit (which will link the
/etc/localtimeusing TIMEZONE).what is the right place to locate similar setting code (e.g. link the
/etc/localtime) in the yocto?thanks!
--
Yi Qingliang
[email protected]
http://niqingliang2003.wordpress.comQuoted 5 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-coreHi,
you could try the following:
http://www.rwhitby.net/blog/nslu2-linux/setting-the-openmoko-timezone.htmlWell this is the first entry when using google with "openembedded time zone", so please consider using search engines first next time.
Also this is the very same process like it is done on a desktop computer, googling for "set time zone linux command line" gives this result:
http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz-variable/
Which shows more precise steps at the headline "Set timezone using/etc/localtimeconfiguration file [any Linux distro]".(Sorry for cross posting, but this was carried over to the OE-Core list)
--
Regards
Samuel
Signature · 3 lines
Yi Qingliang [email protected] http://niqingliang2003.wordpress.com
Quoted 6 lines · Ni Qingliang
THANKS!
I still want the native support by oe-core/yocto:-). If no, I will try by myself.
I've asked three or four time the oe-core crow to improve the recipe...last one:
Quoted 10 lines · Joshua Lock
Per mailing requests, here are updates to the tzdata and gst-plugins-good recipes.
Joshua
The following changes since commit
95d0ff5e070c690314ab87665200099a52d37ebf:tzdata: updated
SRC_URIand update to 2011k (2011-10-18 11:16:58 -0700)
Thanks for the tzdata fix.
Now, we have the same recipes in meta-oe with a slightly different do_install and packaging: I'm referring to /etc/localtime and /etc/timezone:
which package do provide those in oe-core?
(We'll remove the tzdata/tzcodes from meta-oe once the recipes are matching)
Regards
Andrea
Setting the default TZ for the image is something that should be done in a post install script for the tzdata package or something similar.
Since the /etc/localtime is usually a copy/hardlink or symlink to the timezone data we don't want to package it up. Instead we want to perform the actions that a program running on the target system itself would use to change the timezone.
So I think the easiest approach is to add a system level configuration variable (set the default).
Then use this variable to populate the configuration file that specifies the system timezone... and then use the post install process to check the contents of a text file.
Alternatively do this via an initscript -- but for folks w/ read-only filesystems I'm not sure that will work.
--Mark
Quoted 42 lines · Andrea Adami
On Fri, Oct 28, 2011 at 9:05 AM, Ni Qingliang <[email protected] <mailto:[email protected]>> wrote:
THANKS!
I still want the native support by oe-core/yocto:-). If no, I will try by myself.
I've asked three or four time the oe-core crow to improve the recipe...last one:
On Wed, Oct 19, 2011 at 12:24 AM, Joshua Lock <[email protected] <mailto:[email protected]>> wrote:
Per mailing requests, here are updates to the tzdata and gst-plugins-good recipes. Joshua The following changes since commit 95d0ff5e070c690314ab87665200099a52d37ebf: tzdata: updated SRC_URI and update to 2011k (2011-10-18 11:16:58 -0700)Thanks for the tzdata fix.
Now, we have the same recipes in meta-oe with a slightly differentdo_installand packaging: I'm referring to/etc/localtimeand/etc/timezone: which package do provide those in oe-core?(We'll remove the tzdata/tzcodes from meta-oe once the recipes are matching)
Regards
Andrea
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
I'd like the 'system level configuration' solution.
the /etc/localtime/ link can be done when packaging rootfs (using the system level configuration).
Quoted 68 lines · Mark Hatle
Setting the default TZ for the image is something that should be done in a post install script for the tzdata package or something similar.
Since the
/etc/localtimeis usually a copy/hardlink or symlink to the timezone data we don't want to package it up. Instead we want to perform the actions that a program running on the target system itself would use to change the timezone.So I think the easiest approach is to add a system level configuration variable (set the default).
Then use this variable to populate the configuration file that specifies the system timezone... and then use the post install process to check the contents of a text file.
Alternatively do this via an initscript -- but for folks w/ read-only filesystems I'm not sure that will work.
--Mark
Quoted 35 lines · Andrea Adami
On Fri, Oct 28, 2011 at 9:05 AM, Ni Qingliang <[email protected] <mailto:[email protected]>> wrote:
THANKS!
I still want the native support by oe-core/yocto:-). If no, I will try by myself.
I've asked three or four time the oe-core crow to improve the recipe...last one:
On Wed, Oct 19, 2011 at 12:24 AM, Joshua Lock <[email protected] <mailto:[email protected]>> wrote:
Per mailing requests, here are updates to the tzdata and gst-plugins-good recipes. Joshua The following changes since commit 95d0ff5e070c690314ab87665200099a52d37ebf: tzdata: updated SRC_URI and update to 2011k (2011-10-18 11:16:58 -0700)Thanks for the tzdata fix.
Now, we have the same recipes in meta-oe with a slightly differentdo_installand packaging: I'm referring to/etc/localtimeand/etc/timezone: which package do provide those in oe-core?(We'll remove the tzdata/tzcodes from meta-oe once the recipes are matching)
Regards
Quoted 7 lines
Andrea
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 3 lines
Yi Qingliang [email protected] http://niqingliang2003.wordpress.com
Quoted 17 lines · Ni Qingliang
I'd like the 'system level configuration' solution.
the
/etc/localtime/link can be done when packaging rootfs (using the system level configuration).Quoted 1 line · Mark Hatle
Setting the default TZ for the image is something that should be done in
a post
Quoted 3 lines
install script for the tzdata package or something similar.
Since the
/etc/localtimeis usually a copy/hardlink or symlink to thetimezone
Quoted 1 line
data we don't want to package it up. Instead we want to perform the
actions
Quoted 1 line
that a program running on the target system itself would use to change
the timezone.
Quoted 1 line
Quoted 15 lines
Quoted 1 line
So I think the easiest approach is to add a system level configuration
variable
Quoted 3 lines
(set the default).
Then use this variable to populate the configuration file that specifies
the
Quoted 1 line
system timezone... and then use the post install process to check the
contents
Quoted 6 lines
of a text file.
Alternatively do this via an initscript -- but for folks w/ read-only filesystems I'm not sure that will work.
--Mark
<cut>
Maybe I misunderstand "system level configuration" but in the meta-oe recipe we have
DEFAULT_TIMEZONE ?= "Europe/London"
Maybe UTC would be better?
Note how the variable is weak thus can be overridden in local.conf.
Secondly, why do it as post-install or at image do_rootfs stage when we have set the variable and are therefore able to provide sane defaults in do_install?
Other points before starting to write a patch:
-why is the recipe in oe-core doing chown -R root:root ${D} ?
-the logic around # libc is removing zoneinfo files from package
Is it only eglibc?
Regards
Andrea
Quoted 31 lines · Andrea Adami
On Mon, Oct 31, 2011 at 1:44 AM, Ni Qingliang <[email protected] <mailto:[email protected]>> wrote:
I'd like the 'system level configuration' solution.
the
/etc/localtime/link can be done when packaging rootfs (using the system level configuration).On Fri, 2011-10-28 at 22:43 +0800, Mark Hatle wrote:
> Setting the default TZ for the image is something that should be done in a post
> install script for the tzdata package or something similar.
>
> Since the/etc/localtimeis usually a copy/hardlink or symlink to the timezone > data we don't want to package it up. Instead we want to perform the actions > that a program running on the target system itself would use to change the timezone.
>
> So I think the easiest approach is to add a system level configuration variable
> (set the default).
>
> Then use this variable to populate the configuration file that specifies the > system timezone... and then use the post install process to check the contents > of a text file.
>
> Alternatively do this via an initscript -- but for folks w/ read-only > filesystems I'm not sure that will work.
>
> --Mark
Quoted 7 lines
<cut>
Maybe I misunderstand "system level configuration" but in the meta-oe recipe we have
DEFAULT_TIMEZONE?= "Europe/London"Maybe UTC would be better?
To me no timezone (which is UTC) is preferable as the system designer can then set the timezone, externally to the package(s).
Quoted 4 lines
Note how the variable is weak thus can be overridden in local.conf.
Secondly, why do it as post-install or at image
do_rootfsstage when we have set the variable and are therefore able to provide sane defaults indo_install?
If it's done within a do_install, then the file (/etc/timezone) itself gets placed into the package. If it's in the package, then if/when someone upgrades the package from a feed the timezone gets reset to the previous value. That's a bug IMHO.
If it's done as a post-install script, then the timezone configuration can be evaluated and if one isn't set -- or there is no timezone file -- then we can set it to UTC or a similar default timezone.. (the value in the DEFAULT_TIMEZONE variable is reasonable in this approach.)
Quoted 2 lines
Other points before starting to write a patch:
-why is the recipe in oe-core doing chown -R root:root ${D} ?
There was an issue with the way the timezone data was extracted/constructed that it was have all of the build system's uid/gid preserved in the copy to the final install directory -- so when packaging incorrect usernames and groups were fed into the process causing issues.
A simple chown -R root:root ${D} ensured that all of the timezone data was owned by the root user (on the target).
Quoted 2 lines
-the logic around # libc is removing zoneinfo files from package
Is it only eglibc?
Timezone info is updated more often then the system libc. So the zoneinfo files are handled externally of the libc. This allows for easier updates over time.. (This is my guess, as I'm not familiar with exactly what this comment refers to.)
Quoted 12 lines
Regards
Andrea
|
|_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
maybe we can do the link in system booting, use the variable "TZ" to create the symlink /etc/localtime, just like archlinux. e.g. providing one script in /etc/rcS.d/ to create the symlink.
Quoted 94 lines · Mark Hatle
Quoted 31 lines · Andrea Adami
On Mon, Oct 31, 2011 at 1:44 AM, Ni Qingliang <[email protected] <mailto:[email protected]>> wrote:
I'd like the 'system level configuration' solution.
the
/etc/localtime/link can be done when packaging rootfs (using the system level configuration).On Fri, 2011-10-28 at 22:43 +0800, Mark Hatle wrote:
> Setting the default TZ for the image is something that should be done in a post
> install script for the tzdata package or something similar.
>
> Since the/etc/localtimeis usually a copy/hardlink or symlink to the timezone > data we don't want to package it up. Instead we want to perform the actions > that a program running on the target system itself would use to change the timezone.
>
> So I think the easiest approach is to add a system level configuration variable
> (set the default).
>
> Then use this variable to populate the configuration file that specifies the > system timezone... and then use the post install process to check the contents > of a text file.
>
> Alternatively do this via an initscript -- but for folks w/ read-only > filesystems I'm not sure that will work.
>
> --MarkQuoted 7 lines
<cut>
Maybe I misunderstand "system level configuration" but in the meta-oe recipe we have
DEFAULT_TIMEZONE?= "Europe/London"Maybe UTC would be better?
To me no timezone (which is UTC) is preferable as the system designer can then set the timezone, externally to the package(s).
Quoted 4 lines
Note how the variable is weak thus can be overridden in local.conf.
Secondly, why do it as post-install or at image
do_rootfsstage when we have set the variable and are therefore able to provide sane defaults indo_install?If it's done within a
do_install, then the file (/etc/timezone) itself gets placed into the package. If it's in the package, then if/when someone upgrades the package from a feed the timezone gets reset to the previous value. That's a bug IMHO.If it's done as a post-install script, then the timezone configuration can be evaluated and if one isn't set -- or there is no timezone file -- then we can set it to UTC or a similar default timezone.. (the value in the
DEFAULT_TIMEZONEvariable is reasonable in this approach.)Quoted 2 lines
Other points before starting to write a patch:
-why is the recipe in oe-core doing chown -R root:root ${D} ?There was an issue with the way the timezone data was extracted/constructed that it was have all of the build system's uid/gid preserved in the copy to the final install directory -- so when packaging incorrect usernames and groups were fed into the process causing issues.
A simple chown -R root:root ${D} ensured that all of the timezone data was owned by the root user (on the target).
Quoted 2 lines
-the logic around # libc is removing zoneinfo files from package
Is it only eglibc?Timezone info is updated more often then the system libc. So the zoneinfo files are handled externally of the libc. This allows for easier updates over time.. (This is my guess, as I'm not familiar with exactly what this comment refers to.)
Quoted 4 lines
Regards
Andrea
Quoted 8 lines
|
|_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Signature · 3 lines
Yi Qingliang [email protected] https://niqingliang2003.wordpress.com
Quoted 3 lines · Ni Qingliang
maybe we can do the link in system booting, use the variable "TZ" to create the symlink
/etc/localtime, just like archlinux. e.g. providing one script in/etc/rcS.d/to create the symlink.
This ought to be done by image IMO; so a kind of post rootfs generation hook might be use allowing it to be set per-image.
I personally have this exactly use-case here at work.
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: [email protected] http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
what is "IMO"?
Quoted 14 lines · Otavio Salvador
Quoted 3 lines · Ni Qingliang
maybe we can do the link in system booting, use the variable "TZ" to create the symlink
/etc/localtime, just like archlinux. e.g. providing one script in/etc/rcS.d/to create the symlink.This ought to be done by image IMO; so a kind of post rootfs generation hook might be use allowing it to be set per-image.
I personally have this exactly use-case here at work.
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Signature · 3 lines
Yi Qingliang [email protected] https://niqingliang2003.wordpress.com
Quoted 1 line · Ni Qingliang
what is "IMO"?
"In my opinion"
See http://www.internetslang.com/
I'm not suggesting reading the entire thing and using the slang in email though :)
Philip
Quoted 17 lines · Otavio Salvador
Quoted 14 lines · Ni Qingliang
Quoted 3 lines
maybe we can do the link in system booting, use the variable "TZ" to create the symlink
/etc/localtime, just like archlinux. e.g. providing one script in/etc/rcS.d/to create the symlink.This ought to be done by image IMO; so a kind of post rootfs generation hook might be use allowing it to be set per-image.
I personally have this exactly use-case here at work.
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
thanks! :)
Quoted 30 lines · Philip Balister
Quoted 1 line · Ni Qingliang
what is "IMO"?
"In my opinion"
See http://www.internetslang.com/
I'm not suggesting reading the entire thing and using the slang in email though :)
Philip
Quoted 17 lines · Otavio Salvador
Quoted 14 lines · Ni Qingliang
Quoted 3 lines
maybe we can do the link in system booting, use the variable "TZ" to create the symlink
/etc/localtime, just like archlinux. e.g. providing one script in/etc/rcS.d/to create the symlink.This ought to be done by image IMO; so a kind of post rootfs generation hook might be use allowing it to be set per-image.
I personally have this exactly use-case here at work.
--
Otavio SalvadorO.S. Systems
E-mail: [email protected] http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
Signature · 3 lines
Yi Qingliang [email protected] https://niqingliang2003.wordpress.com
Quoted 59 lines · Mark Hatle
Quoted 1 line · Andrea Adami
On Mon, Oct 31, 2011 at 1:44 AM, Ni Qingliang <
Quoted 9 lines
<mailto:[email protected]>> wrote:
I'd like the 'system level configuration' solution.
the
/etc/localtime/link can be done when packaging rootfs (using the system level configuration).On Fri, 2011-10-28 at 22:43 +0800, Mark Hatle wrote:
> Setting the default TZ for the image is something that should bedone in a
Quoted 4 lines
post
> install script for the tzdata package or something similar. >
> Since the/etc/localtimeis usually a copy/hardlink or symlink tothe timezone
Quoted 1 line
Quoted 1 line
data we don't want to package it up. Instead we want to perform
the actions
Quoted 1 line
Quoted 1 line
that a program running on the target system itself would use to
change the
Quoted 3 lines
timezone.
>
> So I think the easiest approach is to add a system levelconfiguration
Quoted 4 lines
variable
> (set the default).
>
> Then use this variable to populate the configuration file thatspecifies the
Quoted 1 line
Quoted 1 line
system timezone... and then use the post install process to check
the contents
Quoted 3 lines
Quoted 3 lines
of a text file.
Alternatively do this via an initscript -- but for folks w/
read-only
Quoted 7 lines
Quoted 3 lines
filesystems I'm not sure that will work.
--Mark
<cut>
Maybe I misunderstand "system level configuration" but in the meta-oe
recipe we have
Quoted 4 lines
DEFAULT_TIMEZONE?= "Europe/London"Maybe UTC would be better?
To me no timezone (which is UTC) is preferable as the system designer can then
set the timezone, externally to the package(s).Quoted 3 lines
Note how the variable is weak thus can be overridden in local.conf.
Secondly, why do it as post-install or at image
do_rootfsstage when wehave set
Quoted 1 line
the variable and are therefore able to provide sane defaults in
Quoted 9 lines
do_install?If it's done within a
do_install, then the file (/etc/timezone) itself gets placed into the package. If it's in the package, then if/when someone upgrades
the package from a feed the timezone gets reset to the previous value.
That's a
bug IMHO.
Sure, I overlooked that!
Quoted 9 lines
If it's done as a post-install script, then the timezone configuration can be
evaluated and if one isn't set -- or there is no timezone file -- then we can
set it to UTC or a similar default timezone.. (the value in theDEFAULT_TIMEZONE
variable is reasonable in this approach.)maybe "Factory" then?
See post-install script example:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-libs/timezone-data/timezone-data-2011k.ebuild
Quoted 19 lines
Quoted 2 lines
Other points before starting to write a patch:
-why is the recipe in oe-core doing chown -R root:root ${D} ?There was an issue with the way the timezone data was extracted/constructed that
it was have all of the build system's uid/gid preserved in the copy to the final
install directory -- so when packaging incorrect usernames and groups were fed
into the process causing issues.A simple chown -R root:root ${D} ensured that all of the timezone data was owned
by the root user (on the target).Quoted 2 lines
-the logic around # libc is removing zoneinfo files from package
Is it only eglibc?
Quoted 8 lines
Timezone info is updated more often then the system libc. So the zoneinfo files
are handled externally of the libc. This allows for easier updates over time..
(This is my guess, as I'm not familiar with exactly what this comment refers to.)Comments in meta-oe recipe would suggest that apparently only eglibc is
removing zoneinfo file.
# Only eglibc is removing zoneinfo files from package
if [ "${LIBC}"x = "eglibc"x ] ; then
cp -pP "${S}/zone.tab" ${D}${datadir}/zoneinfo
cp -pP "${S}/iso3166.tab" ${D}${datadir}/zoneinfo
fiBeing that we need the files on first boot, I'm not against providing 'Factory' settings during image do_rootfs or even in base-files. The settings of timezone and locale (and keyboard) are typically done by user on first boot, at least in graphical environments.
Thanks for your comments!
Regards
Andrea
Quoted 27 lines · Andrea Adami
On Fri, Oct 28, 2011 at 9:05 AM, Ni Qingliang <[email protected] <mailto:[email protected]>> wrote:
THANKS!
I still want the native support by oe-core/yocto:-). If no, I will try by myself.
I've asked three or four time the oe-core crow to improve the recipe...last one:
On Wed, Oct 19, 2011 at 12:24 AM, Joshua Lock <[email protected] <mailto:[email protected]>> wrote:
Per mailing requests, here are updates to the tzdata and gst-plugins-good recipes. Joshua The following changes since commit 95d0ff5e070c690314ab87665200099a52d37ebf: tzdata: updated SRC_URI and update to 2011k (2011-10-18 11:16:58 -0700)
Quoted 7 lines
Thanks for the tzdata fix.
Now, we have the same recipes in meta-oe with a slightly differentdo_installand packaging: I'm referring to/etc/localtimeand/etc/timezone: which package do provide those in oe-core?(We'll remove the tzdata/tzcodes from meta-oe once the recipes are matching)
I would welcome such a patch.
Thanks
Sau!
Quoted 11 lines
Regards
Andrea
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core