Thursday, December 10, 2009

Hardware clock failure in ISA system

In ISA systems /sbin/hwclock will fail to fetch the Hardware clock and will throw an error similar to below.
# hwclock
select() to /dev/rtc to wait for clock tick timed out

# hwclock --show
select() to /dev/rtc to wait for clock tick timed out

But the --directisa option of hwclock will work here.
# /sbin/hwclock --directisa

So as a permanent solution we can rename the existing binary /sbin/hwclock and create a new Wrapper as below

1. Find the version of hwclock
# hwclock --version
2. Rename the binary by suffixing the version number
# cd /sbin
# mv hwclock hwclock-x.y
3. Create a wrapper for the hwclock-x.y named hwclock
# cat > hwclock << HERE
#!/bin/bash
/sbin/hwclock-x.y --directisa \$@
HERE

4. Give necessary execute permission and reboot the server
# chmod +x hwclock
5. Check the hardware clock, System Time, NTP, etc.
To synchronize system time with Hardware clock we can use hwclock --hctosys

And an optional reboot
# reboot

If your system is not ISA the we can try the RTC driver as well. The first thing we have to ensure is the RTC driver is loaded using the below steps.
# lsmod|grep rtc
This will show something like below
rtc 15329 0

If you are not getting any, then the rtc driver has not loaded. You need to load it

# modprobe rtc

No comments: