Dell laptop hwclock incompatibilities in Gentoo GNU/Linux

I’m installing Gentoo GNU/Linux on my Dell Inspiron 9400 laptop right now, and as usual, things never are as easy as they would seem. I finally found out about and installed the 915resolution package, which allows me to use the laptop’s display in its native widescreen resolution. Then I ran into a problem with the hardware clock. I couldn’t set it. I would get an error message at shutdown saying it could not set the hardware clock to the system clock. And since the hardware clock was set in localtime rather than UTC (because the previous installation was Windows), I would keep getting all of these timestamp errors about files being modified in the future. I had to reset the system clock manually after each boot.

So I looked into what was going on and it turns out the hwclock command wasn’t functioning. This is what is used to read and set the hwclock. Here is the error message I was getting:

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

A preliminary Google search didn’t turn up anything useful. So I relaxed the search terms and came upon a thread in the ArchLinux users forum. One of the users mentions incompatibility with Dell laptop motherboards, and suggests using the parameter --directisa to hwclock. Testing it out from the command line, I confirm that it works instantly, rather than freezing up for a few seconds and then timing out. So this allowed me to set the hardware clock manually by using the parameter.

But wait, I wasn’t finished yet. I was still going to get the same errors during shutdown that I got earlier, because the init.d script for hwclock wasn’t using that parameter. In addition to an annoying error message during shutdown, that means my hardware clock would slowly drift over time, and I would have to periodically reset it manually. That’s unacceptable. So I modified the /etc/init.d/clock init script as follows.

I changed the line

myopts="${myopts} ${CLOCK_OPTS}"

to

myopts="${myopts} ${CLOCK_OPTS} --directisa"

This line is located inside of the setupopts() function, which is called near the beginnings of both the start() and stop() functions. This is the simplest fix you can make to the clock init script so that hwclock is always called with the --directisa parameter, and thus, it always works.

And that’s it! The clock on my Dell Inspiron 9400 laptop is working perfectly now.

2 Responses to “Dell laptop hwclock incompatibilities in Gentoo GNU/Linux”

  1. Kaze Says:

    This fix also works for Dell Precision 390 desktops.

  2. St00 Says:

    Also worked on identical problem with Dell Optiplex GX270 desktop. Thanks for taking the time to throw the solution out there, muchly appreciated.