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

Re: debian requires genrtc module



Hi Brian

On Fri, Apr 22, 2005 at 11:07:01AM -0400, Brian Sammon wrote:
> I'm running Debian Sarge/powerpc with a kernel I compiled myself.  I keep the 
> hardware clock in UTC.
> For the first few weeks of using this setup, every time I started up the 
> computer, Linux would have the wrong time, and I would have to manually 
> correct the clock.
> It took me about an hour of investigation to figure out what the problem was.
> 
> As far as I can tell, the standard clock management system in Debian  is for 
> /etc/init.d/hwclockfirst.sh and /etc/init.d/hwclock.sh to run on startup and 
> shutdown to sync the system clock and the hardware clock.  Both of these 
> scripts use the hwclock application, which doesn't work on my system unless I 
> install the genrtc module.

AFAIK the whole time setting routine on Debian is, to put it friendly,
a mess.

Some hwclock theory, that hopefully helped me understand the problem:

<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=263116>
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=171281>
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=97349>

Following are some notes on the solution I found: (I just paste it
away from my notes to here, slightly changed: Please don't take the
following literally, instead check it carefully; the following seems
to work here, but I can't guarantee it will on your system: And if you
found a mistake please let me know):


################################################
Calibrating time:

First time:

Run this script:

-----------------------------
#!/bin/sh -x
#
# This is time-recover.sh
#
#

ls -l /etc/adjtime && \
cp -iv /etc/adjtime /etc/adjtime-`date +%y-%m-%d-%H%M` && \
rm -rf /etc/adjtime && \
ntpdate -s -u -v [here some time server address*] && \
hwclock --utc --systohc && \
hwclock --show && \
depmod --quick  
-----------------------------

Second time, a few days later:
Run this script:

-------------------------
#!/bin/sh -x
#
# This is tuneclock.sh
# 
# Setting the time:
# First the system time, diverting output to /var/log/messages.
# Then setting the HWclock to the new system time.

ls -l /etc/adjtime && \ 
cp -iv /etc/adjtime /etc/adjtime.`date +%y-%m-%d-%H%M` && \
ntpdate -s -u -v [here some time server address*] && \
hwclock --debug --systohc --utc && \
depmod --quick
-------------------------

and *after* that make sure you have this line

		 hwclock --adjust $GMT $BADYEAR

uncommented in /etc/init.d/hwclock.sh, i.e with no '#' at the
beginning of the line.

This makes sure next time you boot, your time gets set according
to the drift rate calculated by hwclock when running the tuneclock.sh 
script.


[*= please see <http://ntp.isc.org/bin/view/Servers/WebHome> for more on
that ..] 

Note: I'm not sure a "depmod --quick" is really needed in the scripts
above ... Please correct that appropriately if necessary ...

Note 1: Please note 'rm -rf' above ... :)

##############################################################


> I'm considering submitting a bug report/feature request for util-linux saying 
> that there should be documentation in /usr/share/doc/util-linux/ saying that 
> Debian requires the RTC driver on powerpc in order for the clock to work as 
> expected.

I definitely do not know whether /dev/rtc is needed or not for a
proper functioning of hwclock on Debian. Please see 'man hwclock' for
more (and search for /dev/rtc on that page). 
But I have it enabled on 2.6.10:

$ grep -i rtc /boot/config-2.6.10-powerpc 
CONFIG_GEN_RTC=y
CONFIG_GEN_RTC_X=y
CONFIG_SENSORS_RTC8564=m

And I have this line in /etc/default/rcS
UTC=yes

see:
<http://www.debian.org/doc/manuals/reference/ch-tips.en.html#s8.6.3>


HTH

Best Regards
Wolfgang

-- 
Wolfgang Pfeiffer
http://profiles.yahoo.com/wolfgangpfeiffer



Reply to: