Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Plus, my /etc/sysconfig/clock file seems to be set correctly:
ZONE="America/Denver"
UTC=true
ARC=false
I run a script in /etc/cron.daily to first set the system time from a
timeserver, then set the hardware clock to local time:
#!/bin/sh
#Script to set time
/usr/bin/rdate -s clock.psu.edu
/sbin/hwclock --systohc --utc
The boot file /etc/rc.d/rc.sysinit runs
/sbin/hwclock --hctosys --utc
So, any suggestions as to what I'm doing wrong or any other script that might be setting time on boot?
Thx.
I'm a tad confused myself, since you don't want to use UTC correct? Yet you seem to be using --utc option with hwclock & your sysconfig/clock file says utc=true. Could these be the problems? You may want to specify --localtime instead?
RE: Setting System Time: kernel in wrong time zone
warrenweiss,
You can do one of two things:
1. If your Linux server can run ntp - turn it on and point it to you time server. To do this:
NTP is off until something turns it on. The ntp daemon xntpd is one thing that turns it on. You can turn it off by running any-thing, including hwclock --hctosys, that sets the System Time the old fashioned way.
To see if it is on or off, use the command adjtimex --print and look at the value of "status". If the "64" bit of this number (expressed in binary) equal to 0, 11 minute mode is on. Otherwise, it is off.
If your system runs with NTP mode on, don't use hwclock --adjust or hwclock --hctosys. You'll just make a mess. It is acceptable to use a hwclock --hctosys at startup time to get a reasonable System Time until your system is able to set the System Time from the external source and start NTP mode.
Take out the call to your shell script in the crontab.
2. Remove /etc/adjtime if it exists. Then set the hardware clock manually by doing /sbin/hwclock --set --date="M/D/Y H:M:S" ( M=current month, D=current day, Y=current year, H=current hour, M=current minute, S=current seconds).
Edit /etc/rc.d/rc.sysinit and add /sbin/hwclock --adjust before the /sbin/hwclock --hctosys --utc.
Edit the crontab shell script to receive the time sync from your time server in a variable. Then set the hardware clock to the variable. For Example; /sbin/hwclock --set --date="${newdatetime}"
Re: Re: Setting System Time: kernel in wrong time zone
Quote:
Originally posted by taz.devil
I'm a tad confused myself, since you don't want to use UTC correct? Yet you seem to be using --utc option with hwclock & your sysconfig/clock file says utc=true. Could these be the problems? You may want to specify --localtime instead?
I do want to set the hardware clock to UTC, but then set the system time with the correct offset.
I originally had the hardware clock in local time and thought perhaps that that was where my problem was.
As it turns out, the problem was with 'ls' and a few other key utilities linked to libc version 5 which, apparently, couldn't determine the correct timezone.
The correct thing to do would be to fix the libc dependencies. The more correct thing to do would be to alias 'ls' to 'dir' (which works) and forget about it 'til the next OS upgrade.
I had the same problem, what fixed it for me was editing /etc/rc.d/rc.6 and changing the line that sets the hardwareclock
I changed it from
hwclock --localtime -syshtolc
*to*
hwclock --utc syshtolc
Worked great after that, Hope this helps someone.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.