# hwclock issue (seems to be at boot time)

## whobanil80

I have done numerous searches and everyone else seems to have a different problem then I do. During boot, the clock fails to set. I can't really see the other things it says near it, as it scrolls too fast. Also, since I updated things, the screen auto-clears before bringing up the login and I can't scroll up to see what it says. My clock is off by hours. Not just a few min. It is eight hours behind. Min. are perfectly on. I have set the clock using gnome's clock settings. I have set the clock using the date command. Every time I boot, it unsets. So basic info:

During installation:

cp /usr/share/America/Los_Angeles /etc/localtime

echo "America/Los_Angeles" > /etc/timezone

Now if I run hwclock --directisa --show --debug I get:

hwclock from util-linux 2.20.1

hwclock: Open of /dev/rtc failed: No such file or directory

No usable clock interface found.

hwclock: Cannot access the Hardware Clock via any known method.

Other info that might be important.....I'm AMD64, using 3.1.10-r1 gentoo-sources kernel. Uhmmmmmm. IDK  what else. If more info is needed, just ask.

----------

## smlbstcbr

Are dual booting with another operating system? (namely, Windows), if so, the contents of /etc/conf.d/hwclock should be:

```
clock="local"

```

Also, from the messages of hwclock, it looks like you have not compiled rtc support in the kernel, especially:

```
   [*]   Set system time from RTC on startup and resume             │ │  

  │ │    (rtc0)  RTC used to set the system time                          │ │  

  │ │    [ ]   RTC debug support                                          │ │  

  │ │          *** RTC interfaces ***                                     │ │  

  │ │    [*]   /sys/class/rtc/rtcN (sysfs)                                │ │  

  │ │    [*]   /proc/driver/rtc (procfs for rtc0)                         │ │  

  │ │    [*]   /dev/rtcN (character devices)                              │ │  

  │ │    [ ]     RTC UIE emulation on dev interface  
```

and, this, especially, this:

```
 *** Platform RTC drivers ***                               │ │  

  │ │    <M>   PC-style 'CMOS'         
```

I have it as a module and works, just that executing hwclock seems to fail after a while for some obscure reason.

Could you please post the results of this:?

```
dmesg|grep rtc
```

----------

## Hu

You may be missing one or more kernel options required to get convenient access to the hardware clock.  What is the output of zgrep RTC /proc/config.gz?  Your clock being off by eight hours sounds correct for this type of problem, since you are in Pacific time (GMT-8).  Did you previously have Windows installed on the machine?

Automatic screen clearing is new in a recent upgrade of sys-apps/util-linux, as noted in the messages generated by that ebuild.  Add --noclear to the command line of the tty1 getty if you want to stop this behavior.

----------

## whobanil80

Oh yes, I forgot to mention that I am duel booting with windows. I do have it set local. I'll give you the resaults of those commands ASAP(on my iPad). I'll be back in maybe 30 mins...

----------

## Hu

If you dual boot Windows, then your hardware clock will be set to local time by Windows.  You should adjust /etc/conf.d/hwclock to clock="local" to advise Linux that it must correct for this.

----------

## whobanil80

Okay, I did see what it say to me at boot. it says:

hwclock: Cannot access the Hardware Clock via any known method.

hwclock: Use the --debug option to see the details of our search for an access method.

Anyway, I don't know about the kernel, I used genkernel. I only manually configured my wireless driver because it's a staging driver, I never touched any other setting.

@smlbstcbr: dmesg | grep rtc gives me:

...Nothing, That is weird.

@Hu zgrep RTC /proc/config.gz gives me:

# CONFIG_RTC is not set

# CONFIG_GEN_RTC is not set

# CONFIG_RTC_CLASS is not set

Hmmm that seems to be a problem lol.

I would look at my current kernel configuration, but I'm not sure how... It's probably my kernel isn't it?

----------

## whobanil80

 *Hu wrote:*   

> If you dual boot Windows, then your hardware clock will be set to local time by Windows.  You should adjust /etc/conf.d/hwclock to clock="local" to advise Linux that it must correct for this.

  It is

----------

## whobanil80

I'll just remake my kernel and make sure those options are set.

----------

## whobanil80

Okay, I just did the menuconfig and it looks like those options were not set. I am rebuilding now and will let you know.

----------

## whobanil80

Perfect. The kernel was the problem. Problem solved thanks!

----------

## smlbstcbr

Now that your problem has been solved, you have to tag the thread with [SOLVED]   :Very Happy: 

----------

## toralf

It is interesting, that I do not have any RTC wihtin my kernel config. nevertheless hwlock works :

```
n22 ~ # zgrep RTC /proc/config.gz 

# CONFIG_PM_TRACE_RTC is not set

# CONFIG_RTC is not set

# CONFIG_GEN_RTC is not set

# CONFIG_RTC_CLASS is not set

n22 ~ # hwclock -u; hwclock -v

Wed 21 Mar 2012 02:23:14 PM CET  -0.278044 seconds

hwclock from util-linux 2.20.1

```

OTOH I've 

```
n22 ~ # zgrep HPET /proc/config.gz 

CONFIG_HPET_TIMER=y

CONFIG_HPET=y

CONFIG_HPET_MMAP=y

```

----------

## apinsard

I have the same problem but the solution doesn't work for me.

```

  │ │        --- Real Time Clock                                                            │ │  

  │ │        [*]   Set system time from RTC on startup and resume                           │ │  

  │ │        (rtc0)  RTC used to set the system time                                        │ │  

  │ │        [ ]   RTC debug support                                                        │ │  

  │ │              *** RTC interfaces ***                                                   │ │  

  │ │        [*]   /sys/class/rtc/rtcN (sysfs)                                              │ │  

  │ │        [*]   /proc/driver/rtc (procfs for rtc0)                                       │ │  

  │ │        [*]   /dev/rtcN (character devices)                                            │ │  

  . .                                                                                       . .

  . .                                                                                       . .

  . .                                                                                       . .

  │ │              *** Platform RTC drivers ***                                             │ │  

  │ │        <*>   PC-style 'CMOS'                                                          │ │  

```

```
Coffee linux # hwclock --debug

hwclock from util-linux 2.20.1

hwclock: Open of /dev/rtc failed: No such file or directory

No usable clock interface found.

hwclock: Cannot access the Hardware Clock via any known method.
```

```
Coffee linux # zgrep RTC /proc/config.gz

# CONFIG_RTC is not set

# CONFIG_GEN_RTC is not set

# CONFIG_RTC_CLASS is not set

```

----------

## apinsard

No idea ?   :Neutral: 

----------

## Arkhelion

apinsard, you show us a menuconfig options tree with the correct options selected, but your kernel obviously (as /proc/config.gz show us) has not been compiled with these options. I'd say you have to recompile your kernel and make sure you boot the right kernel before checking if /dev/rtcN is created.

Unless these are other options, I have nothing here to check what these CONFIG mean.

----------

## apinsard

I'm sure I compiled the kernel !

I did "make && make modules_install" in /usr/src/linux/

And I don't remember any error, I'll redo it just to check.

----------

## dmpogo

 *apinsard wrote:*   

> I'm sure I compiled the kernel !
> 
> I did "make && make modules_install" in /usr/src/linux/
> 
> And I don't remember any error, I'll redo it just to check.

 

But did you copy the new  kernel (  arch/x86_64/boot/bzImage  )  into the boot directory ?

----------

## apinsard

Don't think so but, I did a lot of change in my kernel since I installed gentoo last week end and I didn't need to do anything else to get things work.

What am I supposed to do ? cp /usr/src/linux/arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86_64-3.2.12-gentoo ?

Edit. That was it. I'm very skeptical, when I configured the kernel for wireless support I didn't even mount my boot partition and it worked...

Anyway, thank you.

----------

## dmpogo

 *apinsard wrote:*   

> Don't think so but, I did a lot of change in my kernel since I installed gentoo last week end and I didn't need to do anything else to get things work.
> 
> What am I supposed to do ? cp /usr/src/linux/arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86_64-3.2.12-gentoo ?
> 
> Edit. That was it. I'm very skeptical, when I configured the kernel for wireless support I didn't even mount my boot partition and it worked...
> ...

 

If you used genkernel before (and by the name of the kernel it seems you did), it does install the kernel into the boot partition itself.     make menuconfig && make , on the other hand, do not, you have to do it manually   (make modules_install  just installs the modules).

Since you are becoming an expert in kernel compilation,   you should look how the names of the kernels to be booted are referred to in /boot/grub/grub.conf   (if your bootloader is grub, not lilo or grub2) and develop some policy for naming the kernels in /boot.    For example not to have 'genkernel' in the kernel name, if genkernel was not used to make this kernel. This willbe handy when you deal with more than one kernel version (at least it is prudent during the kernel upgrade to leave the previous working version available to boot with, at least temporarily)

----------

## Ant P.

```
make && make modules_install && make install
```

----------

## apinsard

Actually I just used genkernel to automatically configure the kernel since I didn't know which features I needed to get my system working.

On the other hand, I know which features I don't need. So I disable some drivers and else at odd times.

Thank you for your information, I will take it into account the next time I'll configure my kernel.

----------

