I have Gentoo installed as guest OS. I have hardware clock synced with host system, but the clock of OS tend to be wrong after suspend.

The only solution I find out is run hwclock -s frequently via cron.

Any better method?

link|improve this question
feedback

3 Answers

VMware tools might do this for you, but Gentoo is not in the guest compatibility list so it may not work, or may take a lot of effort to get working.

You could use ntp to keep the clock up to date, or schedule ntpdate to run. I am not sure if these are better methods than hwclock -s.

One thing you may want to avoid is a method that simply changes the clock time - that will result in cron jobs being skipped. ntp speeds up the clock to get to the correct time. ntpdate changes the clock time.

link|improve this answer
For me, the only difference between ntpdate and hwclock -s is that ntpdate requires network, because the host is ntp-synced. But ntpd takes a long time to catch up after suspend for a day. :-( – leafduo Jul 23 '11 at 5:57
And, skipping cron jobs is not critical for me, this host is used for developing only. – leafduo Jul 23 '11 at 5:58
feedback
$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource
kvm-clock tsc hpet acpi_pm 

$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource
tsc

Can't rely on TSC http://en.wikipedia.org/wiki/Time_Stamp_Counter

Try hpet or acpi_pm

Plus kernel command line option clocksource=hpet (set inside boot loader configuration.)

See Documentation/kernel-parameters.txt in Linux source.

link|improve this answer
I don't have kvm-clock as an available clocksource, why? – leafduo Sep 9 '11 at 8:05
Last night I had just gotten in bed when the thought that timesource was the issue. I had to write it down or I'd forget. My only Gentoo-on-VMware fusion VM guest is miles away. I edited my comment this morning taking out some KVM-specific stuff. I am pretty KVM-centric. – Ken Stailey Sep 9 '11 at 11:16
kvm-clock would only work if you were using KVM not VMware Fusion. – Ken Stailey Sep 9 '11 at 11:17
feedback

I built a new Gentoo VM guest on VMware Fusion 3.1.3 on another Macbook and installed open-vm-tools which is in portage. I had to unmask two packages but they built OK.

The /usr/bin/vmtoolsd process keeps the guest clock in sync with the host clock. It does some other housekeeping too. Admittedly it may take a short while for it to bring the clock into sync but it does it for me.

To get accelerated I/O etc. you want to activate these kernel options too:

  • VMWARE_PVSCSI
  • VMXNET3
  • VMWARE_BALLOON

They don't require a "tools" package as the upstream kernel contains those drivers by default now. The open-vm-tools-kmod package contains additional driver modules. My config file is visible in this gist:

https://gist.github.com/1209749

I didn't actually read this wiki entry, I just installed the packages and configured the startup scripts and kernel options myself but it might be useful:

http://www.gentoo-wiki.info/HOWTO_Install_VMware_Tools_in_Gentoo

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.