Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.
share|improve this question

migrated from stackoverflow.com Aug 2 '11 at 17:03

This question came from our site for professional and enthusiast programmers.

3  
Looks like a virtualized Linux, right? Some virtualization software has problems with emulating RTC and maybe the kernel gets it wrong. –  mailq Aug 2 '11 at 17:13
4  
Did you compile in the flux_capacitor module? :) –  egorgry Aug 2 '11 at 17:15
2  
Your server is clearly traveling through time. Proceed with caution. –  MDMarra Aug 2 '11 at 17:19
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 2 '11 at 17:20
2  
The OP failed to mention this server is hosted on the TARDIS. –  Bart Silverstrim Aug 2 '11 at 17:29

1 Answer 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

share|improve this answer
    
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 2 '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 2 '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 2 '11 at 20:14
    
Yes, it is running in a virtual machine –  Buella Gábor Aug 2 '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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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