7

Having trouble with system date/time in GNU/Linux/Debian: Time goes too fast for date, time, cron. The sleep command works fine, file modification times are correct. The issue explained via commands:

$ date
Mon Sep 12 05:27:46 CEST 2011

$ time sleep 1
real    71m13.403s
user    0m0.008s
sys     0m0.012s

$ date
Fri Sep 16 22:00:02 CEST 2011

Seems like, while the command "sleep 1" ran, and the command "date" was typed, 4 days passed. Well actually didn't. Ideas about what is going on are welcome.

$ uname -a
Linux the_hostname 2.6.18-238.19.1.el5xen #1 SMP Fri Jul 15 08:16:59 EDT 2011 x86_64 GNU/Linux

And yes, it is in a virtual machine.

$ hwclock --debug
hwclock from util-linux-ng 2.13.1.1
hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
No usable clock interface found.
Cannot access the Hardware Clock via any known method.
  • Have you compiled your own kernel? What kind of hardware is it running on? – Chris S Aug 02 '11 at 17:09
  • 3
    Looks like a virtualized Linux, right? Some virtualization software has problems with emulating RTC and maybe the kernel gets it wrong. – mailq Aug 02 '11 at 17:13
  • 4
    Did you compile in the flux_capacitor module? :) – egorgry Aug 02 '11 at 17:15
  • 2
    Your server is clearly traveling through time. Proceed with caution. – MDMarra Aug 02 '11 at 17:19
  • 2
    The OP failed to mention this server is hosted on the TARDIS. – Bart Silverstrim Aug 02 '11 at 17:29
  • 2
    Some suggestions: 1. Virtual machine? Is time sync set up against the host? Is your kernel expecting ticks in a different rate from what the host sends? 2. Paravirtual? Do you have the right kernel versions? 3. Do you have NTP running? Does NTP seem to be sane? – pehrs Aug 02 '11 at 17:20
  • 1
    Yes, it is a virtual machine, and I'm currently trying to figure out how to bring back next weeks lottery numbers. – Buella Gábor Aug 02 '11 at 19:38

1 Answers1

1

does this still happen after setting the time with ntp? otherwise try to use the rtc. I also read somewhere in a forum that if it is a 64 bit pc problem, someone suggested using the noapictimer kernel option to fix it. would be interesting what system you use and which kernel version for better pinpointing the failure

EDIT: I think it has something to do with the xen kernel and time issues there. Check these pages:

(Time went backwards problem)

http://lists.xensource.com/archives/html/xen-users/2010-01/msg00037.html

(fast clock)

http://idolinux.blogspot.com/2009/02/xen-and-fast-clock.html

or google for xen kernel and time issues. there is quite a lot of discussion about this topic

Xtroce
  • 111
  • 3
  • Thank You, I have just installed ntp, no change so far. The hwclock command says `hwclock --debug hwclock from util-linux-ng 2.13.1.1 hwclock: Open of /dev/rtc failed, errno=2: No such file or directory. No usable clock interface found. Cannot access the Hardware Clock via any known method.` It is a virtual machine indeed. `uname -a Linux hostnameishere 2.6.18-238.19.1.el5xen #1 SMP Fri Jul 15 08:16:59 EDT 2011 x86_64 GNU/Linux` – Buella Gábor Aug 02 '11 at 19:43
  • Something interesting is, that it always sets back to the correct time after a while. Gets to somewhere around the middle of 2012, then it's august 2011 again. Like it would sync sometimes. The other weird thing is, file creation times are correct, and also the `uptime` command displays the correct time. – Buella Gábor Aug 02 '11 at 19:48
  • The resetting might be caused by NTP doing a lookup and resetting the time. The creation times being correct and the uptime though seems pretty odd though. I noticed some comments above asking if you were running in a VM. Is that what you are doing? – Mike Keller Aug 02 '11 at 20:14
  • Yes, it is running in a virtual machine – Buella Gábor Aug 02 '11 at 20:18
  • you can try to load the rtc via `modprobe rtc` but i think this won't work on a vm. if it's your amchine and you can access the system behind the vm install a kernelupdate, if not contact the owner and ask kindly if he would do that. ntp should update the time once in a while so this explains that behaviour. Just googled a bit and there seems to be something amiss in general with xen kernels and time between host and guest os. i also found some tips how to solve these problems when you can get to the xen kernel (you own the hw and can access the machine on which the vm runs). – Xtroce Aug 11 '11 at 15:50
  • Thank You, it is xen yes, but i cannot access the host machine. I asked the hosting provider, but they just said the problem doesn't appear for other vms, so basically they don't wish to help me. And `modprobe rtc` doesn't work. The file `/sys/devices/system/clocksource/clocksource0/available_clocksource` lists only `jiffies`. – Buella Gábor Aug 11 '11 at 17:04