[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: getting correct time on a laptop (IBM ThinkPad T23)



Am Mittwoch 21 Juni 2006 17:02 schrieb Paul Kimoto:

> > 2) Chrony apparantly cannot set the hardware clock. I get a
> > input/output error on modprobe rtc, and it seems that the module
> > genrtc doesn't do the trick. I reverted on not letting chrony do that
> > but the usually debian hwclock scripts which seems to work.
>
> Do you invoke the (chronyc) "trimrtc" command?  (If this works, you
> probably want to "writertc" as well.)
>
> Does your computer have a way to get IP addresses of external NTP
> servers when chronyd starts (even if the network is down)?  I believe
> that otherwise chronyd forgets about those servers and never tries to
> contact them.

Hello Paul,

I think I found a setup that should do. 

1) realtime clock support should be working. at least trimrtc does work. 
rtcfile is enabled in the config file. so maybe I was seeing a different 
problem which I interpreted as chrony could not set the hardware clock.

2) according to chrony faq hwclock should not update the hardwareclock on 
suspend or shutdown cause chrony wouldnt know that and cannot adjust the 
hardware clock accordingly on the next boot or resume... on bootup 
hwclock --hctosys may be used before starting chrony... so I edited 
out /etc/init.d/hwclock.sh stop with a "return 0".

/etc/hibernate/common.conf seems to be configured correctly already:

### clock
SaveClock restore-only

3) I use this hibernate script:

#!/bin/sh

/etc/init.d/ifplugd stop
ifdown eth0
/etc/init.d/chrony stop

sync
hibernate

/etc/init.d/chrony start
/etc/init.d/ifplugd start

This way chrony should notice that the network goes down, before it is 
stopped, and when the network goes up (as soon as a link is detected)  
after it was started... I had the wrong order before and thus chrony may 
have missed that the network went up.

Let's see how that goes.

If that doesn't work I probably try replacing pool.ntp.org with some IP 
addresses... I wonder whether chrony retries the DNS lookups when an 
online command is issued, but the FAQ suggests that it does not... ;(.

"Q: I have problems if I put the names of my NTP servers in the 
chrony.conf file. If you have no connection to the Internet at boot time, 
chrony won't be able to turn the names into IP addresses when it starts.  
There seem to be 2 solutions:

1. Put the numeric IP addresses in the chrony.conf file or
2. Put the server->IP address mappings in your /etc/hosts file and ensure 
that /etc/host.conf reads 'order hosts,bind'.

The problem is that chronyd (currently) isn't designed in a way that 
allows hostname->IP address lookups during normal operation.  I hope to 
work on this problem very soon."

Hmmm, seems that I need IP addresses. Chrony should be more robust there 
IMHO and at least retry DNS lookups when an online command is issued and 
not only on /etc/chrony restart. Workaround could be to restart chrony 
whenever the network is brought up and put it online directly after that. 
instead of only putting it online. Maybe thats the best solution. I will 
try that.

I am not completely sure whether it makes really sense to use 
hwclock --hctosys on boot or resume - since from what I understand chrony 
should be able handle the RTC clock in such cases too. But it probably 
won't harm either.

I found a hint why chrony sometimes shows system clock is 0.0 seconds 
ahead of NTP time even when they differ. It does not seem to have done 
any measurement in that case. When I manually start one via burst, it 
shows the correct inaccuracy.

Regards,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7



Reply to: