Difference between revisions of "Problems with hwclock"

From ThinkWiki
Jump to: navigation, search
(Possible solutions: Additional RTC options.)
Line 35: Line 35:
 
=== Compiling RTC-support into the kernel instead of as a module ===
 
=== Compiling RTC-support into the kernel instead of as a module ===
  
Compiling RTC-support (CONFIG_RTC) into the kernel instead of compiling it as a module seems to work also. Tested on: 2.6.20.6 at Thinkpad {{Z61m}} 9450-3HG
+
Compiling RTC-support {{kernelconf|CONFIG_RTC||||||}} into the kernel instead of compiling it as a module seems to work also. Tested on: 2.6.20.6 at Thinkpad {{Z61m}} 9450-3HG
 +
 
 +
=== Using Alternate RTC Drivers ===
 +
 
 +
Use of an alternate RTC driver may yield better results.  RTC drivers available in recent kernels include:
 +
* '''genrtc''' {{kernelconf|CONFIG_GEN_RTC||||||}}: A generic RTC emulation driver.
 +
* '''rtc class''' {{kernelconf|CONFIG_RTC_CLASS||||||}}: A new RTC driver class which separates the userspace interface from the hardware-level drivers.  Several user-level interfaces may be exposed, including the venerable /dev/rtc node, independently of the actual underlying hardware.  These drivers are marked experimental as of kernel 2.6.21.
 +
 
 +
Strictly speaking, for the new RTC class drivers, you need to load a user-level interface driver as well as a hardware driver, making these drivers more complex to use.  However, in many cases, loading just the user-level interface driver rtc_dev is sufficient to get hwclock working.
 +
 
 +
All RTC drivers may be compiled as loadable modules.  To test which driver works best for you, load each driver in turn and use hwclock to test results.  Example:
 +
 
 +
<pre># modprobe rtc
 +
# hwclock --show
 +
# rmmod rtc
 +
# modprobe genrtc
 +
# hwclock --show
 +
# rmmod genrtc
 +
# modprobe rtc_dev
 +
# hwclock --show
 +
# rmmod rtc_dev</pre>
  
 
== Affected Models ==
 
== Affected Models ==

Revision as of 03:18, 31 May 2007

This page discusses the problem with /dev/rtc on certain models.

Problem description

On bootup,a message like this shows up:

select() to /dev/rtc to wait for clock tick timed out


The RTC kernel driver can't handle the system clock.

Possible solutions

Using the --directisa switch of hwclock(8)

The hwclock command knows the parameter --directisa to access the system clock "directly" instead of accessing it by using /dev/rtc. There are several ways of doing this automatically.

Generic instructions

Move /sbin/hwclock (or wherever it is located on your system) to /sbin/hwclock.dist and create the following shell script, which you place at /sbin/hwclock

#!/bin/sh
/sbin/hwclock.dist --directisa "$@"

Make the script executable (apply the same permissions you had for hwclock before) and keep your packaging system from overwriting it on updates.

Debian 4.0 (etch)

Add the following to /etc/default/rcS:

HWCLOCKPARS="--directisa"

Debian 3.1 (sarge) and previous

Edit /etc/init.d/hwclock.sh and change all instances of "/sbin/hwclock" to "/sbin/hwclock --directisa".

Gentoo

Edit /etc/init.d/clock and set CLOCK_OPTS to

CLOCK_OPTS="--directisa"

Compiling RTC-support into the kernel instead of as a module

Compiling RTC-support (CONFIG_RTC) into the kernel instead of compiling it as a module seems to work also. Tested on: 2.6.20.6 at Thinkpad Z61m 9450-3HG

Using Alternate RTC Drivers

Use of an alternate RTC driver may yield better results. RTC drivers available in recent kernels include:

  • genrtc (CONFIG_GEN_RTC): A generic RTC emulation driver.
  • rtc class (CONFIG_RTC_CLASS): A new RTC driver class which separates the userspace interface from the hardware-level drivers. Several user-level interfaces may be exposed, including the venerable /dev/rtc node, independently of the actual underlying hardware. These drivers are marked experimental as of kernel 2.6.21.

Strictly speaking, for the new RTC class drivers, you need to load a user-level interface driver as well as a hardware driver, making these drivers more complex to use. However, in many cases, loading just the user-level interface driver rtc_dev is sufficient to get hwclock working.

All RTC drivers may be compiled as loadable modules. To test which driver works best for you, load each driver in turn and use hwclock to test results. Example:

# modprobe rtc
# hwclock --show
# rmmod rtc
# modprobe genrtc
# hwclock --show
# rmmod genrtc
# modprobe rtc_dev
# hwclock --show
# rmmod rtc_dev

Affected Models

  • Thinkpad T60 (not all models)
  • Thinkpad T61 (type 7662, maybe others)
  • Thinkpad T60p
  • Thinkpad X60s
  • Thinkpad Z61m

Affected Operating Systems

  • Linux, all flavours. Tested with kernel 2.6.18, 2.6.19, 2.6.20.6