Unix Technical Forum

cannot set system time

This is a discussion on cannot set system time within the Linux Operating System forums, part of the Unix Operating Systems category; --> I have 1 server which will not set the system time at all. Here is an example. I set ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2008, 06:35 PM
ppc@cheapbooks.com
 
Posts: n/a
Default cannot set system time

I have 1 server which will not set the system time at all. Here is an
example. I set the time to 10 minutes earlier, but when I run the date
command again, the date hasn't changed.

[root@S141-141 ~]# date
Sun Sep 3 03:30:51 EDT 2006
[root@S141-141 ~]# date -s "Sun Sep 3 03:20:51 EDT 2006"
Sun Sep 3 03:20:51 EDT 2006
[root@S141-141 ~]# date
Sun Sep 3 03:31:04 EDT 2006


Trying to set it to a future time also does nothing:

[root@S141-141 ~]# date -s "Sun Sep 3 03:50:51 EDT 2006"
Sun Sep 3 03:50:51 EDT 2006
[root@S141-141 ~]# date
Sun Sep 3 03:33:40 EDT 2006
[root@S141-141 ~]#


If I run the ntpdate on this machine twice in a row, it makes no change
to the system clock.

[root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
3 Sep 03:32:37 ntpdate[17446]: step time server 192.5.41.209 offset
-43786.809017 sec
[root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
3 Sep 03:32:39 ntpdate[17447]: step time server 192.5.41.209 offset
-43786.809177 sec
[root@S141-141 ~]#

I uploaded a different binary for 'date' and that too does not work.

Any idea what is wrong?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 06:35 PM
Matt Giwer
 
Posts: n/a
Default Re: cannot set system time

ppc@cheapbooks.com wrote:
> I have 1 server which will not set the system time at all. Here is an
> example. I set the time to 10 minutes earlier, but when I run the date
> command again, the date hasn't changed.
>
> [root@S141-141 ~]# date
> Sun Sep 3 03:30:51 EDT 2006
> [root@S141-141 ~]# date -s "Sun Sep 3 03:20:51 EDT 2006"
> Sun Sep 3 03:20:51 EDT 2006
> [root@S141-141 ~]# date
> Sun Sep 3 03:31:04 EDT 2006


> Trying to set it to a future time also does nothing:


> [root@S141-141 ~]# date -s "Sun Sep 3 03:50:51 EDT 2006"
> Sun Sep 3 03:50:51 EDT 2006
> [root@S141-141 ~]# date
> Sun Sep 3 03:33:40 EDT 2006
> [root@S141-141 ~]#


> If I run the ntpdate on this machine twice in a row, it makes no change
> to the system clock.


> [root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
> 3 Sep 03:32:37 ntpdate[17446]: step time server 192.5.41.209 offset
> -43786.809017 sec
> [root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
> 3 Sep 03:32:39 ntpdate[17447]: step time server 192.5.41.209 offset
> -43786.809177 sec
> [root@S141-141 ~]#


> I uploaded a different binary for 'date' and that too does not work.


> Any idea what is wrong?


In /etc/cron.hourly/ I run
rdate -s 128.118.25.3
and it works. The ip is a public ntp server. I remember years ago the UNSO
stoppped working for me and haven't retried it since them.

As to the manual entry I presume it ignores an incorrect string format. Other
than that is the internal clock working? Getting the same date/time twice in a
row suggests it is not. Defective? Old and battery dead?

--
Israel: A land filled with panic-stricked cockroaches in fear for their
existence.
-- The Iron Webmaster, 3685

nizkor http://www.giwersworld.org/nizkook/nizkook.phtml
Zionism http://www.giwersworld.org/disinfo/disinfo.phtml a4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 06:35 PM
The Natural Philosopher
 
Posts: n/a
Default Re: cannot set system time

Matt Giwer wrote:
> ppc@cheapbooks.com wrote:
>> I have 1 server which will not set the system time at all. Here is an
>> example. I set the time to 10 minutes earlier, but when I run the date
>> command again, the date hasn't changed.
>>
>> [root@S141-141 ~]# date
>> Sun Sep 3 03:30:51 EDT 2006
>> [root@S141-141 ~]# date -s "Sun Sep 3 03:20:51 EDT 2006"
>> Sun Sep 3 03:20:51 EDT 2006
>> [root@S141-141 ~]# date
>> Sun Sep 3 03:31:04 EDT 2006

>
>> Trying to set it to a future time also does nothing:

>
>> [root@S141-141 ~]# date -s "Sun Sep 3 03:50:51 EDT 2006"
>> Sun Sep 3 03:50:51 EDT 2006
>> [root@S141-141 ~]# date
>> Sun Sep 3 03:33:40 EDT 2006
>> [root@S141-141 ~]#

>
>> If I run the ntpdate on this machine twice in a row, it makes no change
>> to the system clock.

>
>> [root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
>> 3 Sep 03:32:37 ntpdate[17446]: step time server 192.5.41.209 offset
>> -43786.809017 sec
>> [root@S141-141 ~]# /usr/sbin/ntpdate ntp2.usno.navy.mil
>> 3 Sep 03:32:39 ntpdate[17447]: step time server 192.5.41.209 offset
>> -43786.809177 sec
>> [root@S141-141 ~]#

>
>> I uploaded a different binary for 'date' and that too does not work.

>
>> Any idea what is wrong?

>
> In /etc/cron.hourly/ I run
> rdate -s 128.118.25.3
> and it works. The ip is a public ntp server. I remember years ago the
> UNSO stoppped working for me and haven't retried it since them.
>
> As to the manual entry I presume it ignores an incorrect string
> format. Other than that is the internal clock working? Getting the same
> date/time twice in a row suggests it is not. Defective? Old and battery
> dead?
>

I am fairly sure that date doesn't read the hardware clock - it never
used to anyway. It just used to pick it up at boot time and then run its
own clock from thereon in.

I think setclock is the command to adjust the hardware clock. If this
particular installation is using it.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-18-2008, 06:35 PM
Michael Heiming
 
Posts: n/a
Default Re: cannot set system time

In comp.os.linux.setup The Natural Philosopher <a@b.c>:
> Matt Giwer wrote:
>> ppc@cheapbooks.com wrote:


[ problems setting system time ]

>> In /etc/cron.hourly/ I run
>> rdate -s 128.118.25.3
>> and it works. The ip is a public ntp server. I remember years ago the
>> UNSO stoppped working for me and haven't retried it since them.


I'd use ntpd to keep clock in sync. Use 'ntpq' to check if ntp is
working as expected after configuring and starting. Though it
takes some time to sync probably and ntp will not set the clock
if it's off to much. There are tons of public ntp server. It is
best practice to sync only one/two systems from public servers
and let all other in your network use those one/two as ntp
server.

Alternatively you can setup your own stratum server(s) if you have
the device to obtain correct time information. In Europe you can
use rather cheapo DCF77 receiver. GPS might work, albeit it
doesn't iirc use leap seconds since it is not important to GPS
functionality, though it might be for your local time.

>> As to the manual entry I presume it ignores an incorrect string
>> format. Other than that is the internal clock working? Getting the same
>> date/time twice in a row suggests it is not. Defective? Old and battery
>> dead?


> I am fairly sure that date doesn't read the hardware clock - it never
> used to anyway. It just used to pick it up at boot time and then run its
> own clock from thereon in.


> I think setclock is the command to adjust the hardware clock. If this
> particular installation is using it.


Never heard about this command.

Hint:
man hwclock

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 271: The kernel license has expired
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-18-2008, 06:35 PM
Matt Giwer
 
Posts: n/a
Default Re: cannot set system time

The Natural Philosopher wrote:
> Matt Giwer wrote:

....
>> In /etc/cron.hourly/ I run
>> rdate -s 128.118.25.3
>> and it works. The ip is a public ntp server. I remember years ago the
>> UNSO stoppped working for me and haven't retried it since them.


>> As to the manual entry I presume it ignores an incorrect string
>> format. Other than that is the internal clock working? Getting the
>> same date/time twice in a row suggests it is not. Defective? Old and
>> battery dead?


> I am fairly sure that date doesn't read the hardware clock - it never
> used to anyway. It just used to pick it up at boot time and then run its
> own clock from thereon in.


Way back when the system clock had to be set manually. I don't remember when I
stopped seeing a need to do that it has been so long, on the order of 15 years.
You can boot a computer today without a network connection and get the correct
time. That is from the system wristwatch type clock.

> I think setclock is the command to adjust the hardware clock. If this
> particular installation is using it.


I do not have a program called setclock, never heard of it. There is ntpdate
and rdate that I know of. I checked the ntpdate man and "too hard" to guess so I
included what works for me.

Also instead of an ip number set often ntp.yourisp.com works.

--
All news coming from Israel is under strict military censorship. Why would
anyone believe a word? This includes all foreign news services.
-- The Iron Webmaster, 3682
nizkor http://www.giwersworld.org/nizkook/nizkook.phtml
antisemitism http://www.giwersworld.org/antisem/ a1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-18-2008, 06:35 PM
spike1@freenet.co.uk
 
Posts: n/a
Default Re: cannot set system time

The Natural Philosopher <a@b.c> did eloquently scribble:
> I think setclock is the command to adjust the hardware clock. If this
> particular installation is using it.


hwclock I think you're thinking of.
hwclock --set --date="<date/time string here>"
hwclock --hctosys
to update system clock to hardware clock

--
__________________________________________________ ____________________________
| spike1@freenet.co.uk | |
|Andrew Halliwell BSc(hons)| "The day Microsoft makes something that doesn't |
| in | suck is probably the day they start making |
| Computer science | vacuum cleaners" - Ernst Jan Plugge |
------------------------------------------------------------------------------
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-18-2008, 06:35 PM
The Natural Philosopher
 
Posts: n/a
Default Re: cannot set system time

Michael Heiming wrote:
> In comp.os.linux.setup The Natural Philosopher <a@b.c>:
>> Matt Giwer wrote:
>>> ppc@cheapbooks.com wrote:

>
> [ problems setting system time ]
>
>>> In /etc/cron.hourly/ I run
>>> rdate -s 128.118.25.3
>>> and it works. The ip is a public ntp server. I remember years ago the
>>> UNSO stoppped working for me and haven't retried it since them.

>
> I'd use ntpd to keep clock in sync. Use 'ntpq' to check if ntp is
> working as expected after configuring and starting. Though it
> takes some time to sync probably and ntp will not set the clock
> if it's off to much. There are tons of public ntp server. It is
> best practice to sync only one/two systems from public servers
> and let all other in your network use those one/two as ntp
> server.
>
> Alternatively you can setup your own stratum server(s) if you have
> the device to obtain correct time information. In Europe you can
> use rather cheapo DCF77 receiver. GPS might work, albeit it
> doesn't iirc use leap seconds since it is not important to GPS
> functionality, though it might be for your local time.
>
>>> As to the manual entry I presume it ignores an incorrect string
>>> format. Other than that is the internal clock working? Getting the same
>>> date/time twice in a row suggests it is not. Defective? Old and battery
>>> dead?

>
>> I am fairly sure that date doesn't read the hardware clock - it never
>> used to anyway. It just used to pick it up at boot time and then run its
>> own clock from thereon in.

>
>> I think setclock is the command to adjust the hardware clock. If this
>> particular installation is using it.

>
> Never heard about this command.
>
> Hint:
> man hwclock
>

Ah. Setclock might be an old SCO unix one.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:37 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com