# [SOLVED] failed to set system clock

## jopeto

Hello,

I had a problem on my computer that when it was booting up, one of the messages showing was 

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

hwclock: use the --debug option to see th details of out serch for an access method

* Failed to set system clock
```

and when i typed the command

```
date
```

The time which was displayed was not the correct one. So I followed the advice in this thread 

https://forums.gentoo.org/viewtopic-p-6864216.html?sid=04b2ec55eb0c998ebbb6e30db97586f8

and enabled

```
Device Drivers -> Character devices -> <*> Generic /dev/rtc emulation 

 <*> Extended ETC operation
```

The error at boot time disappeared, however the time shown was still not the accurate one. So I also enabled

```
Devide Drivers -> Real Time Clock -> PC-style 'CMOS'
```

as a module.

Now, the time shown using the "date" command after booting is the accurate one, however when I boot up I get the same error message that the system clock failed to be set. I find that very strange. Should I worry about this or just leave it as it is?

Thanks a lot.Last edited by jopeto on Fri Aug 03, 2012 9:07 am; edited 1 time in total

----------

## Hypnos

Try the following kernel options (assuming you are on a PC platforml):

Processor type and features -.> High Resolution Timer Support

Device drivers -> Real Time Clock -> Set system time from RTC on startup and resume

You shouldn't need emulation once HPET is enabled ...

----------

## jopeto

I tried enabling Device Drivers -> Character devices -> HPET, but when I ran make && make module_install I got

```

make: *** No rule to make target `module_install'.  Stop.
```

Is that an error or not?

----------

## gorkypl

modules_install

----------

## Hypnos

It's modules_install , with an s

----------

## jopeto

Stupid me... I'll try again.

----------

## eccerr0r

About these clock problems, I've seen some PC hardware that doesn't like the "PC CMOS RTC" option even...  Still for some reason the time gets set somehow...

Anyway, it would be nice when posting about clock problems, to also post what hardware you're using, especially if not PC-based.  Seems there are some somewhat nonstandard clock systems out there even on PCs.  One would hope they all are compatible with the original PC/AT CMOS real time clock but...that's yet another legacy device...

----------

## jopeto

Sorry for the late reply, but I was traveling with no access to internet.

So I enabled in the kernel Device Drivers -> Character devices -> HPET and now the error on boot up disappeared, however when I type the "date" command, I get the wrong time again... Strange, it looks like that I can either make the error disappear, or the date to be correct, but not the two at the same time...

I am using amd64 version of Gentoo on an Intel B950 cpu. Please let me know if you need any more info on the hardware.

When you say "About these clock problems, I've seen some PC hardware that doesn't like the "PC CMOS RTC" option even." does that mean that I need to disable that from the kernel or enable a different option?

Thanks.

----------

## eccerr0r

I'm not entirely sure myself, I'm just worried that we're solving an issue for a non-PC platform (like Macintosh) machine with PC assumptions...  Then again there are PC compatible platforms that don't exactly work all the time... Unsure of the "correct" settings, very motherboard dependent...

----------

## jopeto

OK, so I set my hardware clock using the bios setup and now everything is working fine. I guess that my system is set up so that the system clock is changed according to the hardware clock and not the other way around. I guess I'll have to look into commands how to make which clock primary and secondary.

----------

## Hypnos

 *jopeto wrote:*   

> [..] I guess that my system is set up so that the system clock is changed according to the hardware clock and not the other way around. [...]

 

The usual practice is on bootup to retrieve the time from the hardware clock, and then on shutdown to set the hardware clock from the system clock.  This way the time is preserved while the system is not operating.

You can change this behavior in /etc/conf.d/hwclock .

----------

## jopeto

Thanks!

----------

## jopeto

OK, I think part of my troubles was that I didn't have ntp installed. Here's the wiki on this:

http://en.gentoo-wiki.com/wiki/NTP

I found out about ntp from the comments in the file /etc/conf.d/hwclock

----------

## eccerr0r

odd, it shouldn't be mandatory to have ntp running.  Machines with no network access would be stuck...

Hmm... I should look into this some more the next time I run into this....Weird...

----------

## jopeto

Sorry, I guess I wasn't clear enough in my previous post. Having ntp is not mandatory but it is recommended. Since I have internet access, I decided to install it and set it up.

The problem which I guess I had was that in /etc/conf.d/hwclock I had setting the hardware clock to the software clock on log out disabled. I guess things should work when enabling it even without ntp.

Sorry once again for the confusion.

----------

## Hypnos

If you are satisfied with the function of your system clock, please add "[SOLVED]" to the thread title (by editing the first post) in case someone else has the same problem.

----------

