Lately, I’ve noticed that the date and time of my xen guest is not accurate. I’ve decided to reset it using the date command.
This is the wrong date
debianguest:/home/pepesmith# date
Tue Feb 19 11:23:01 PHT 2008
To change it, i issued (the date should be 22 March 2008 11:28):
debianguest:/home/pepesmith# date "032211282008"
Sat Mar 22 11:28:00 PHT 2008
I really expects that the date command issued will take effect. So to confirm that the date really was changed I issued again a date command.
debianguest:/home/pepesmith# date
Tue Feb 19 11:24:01 PHT 2008
And to my surprise the time is still not changing!
I suspect that something is wrong with the setting thus I go to the Dom0, the host server. I observed that the time being used by the guest is similar to host systems clock. So I decided to changed the host systems time. I’ve checked again the systems time of the guest. This time I’ve realised that the guest time is very dependent on the host. A guest systems time may be changed but then after few minutes (seconds), it will use the host systems time.
Googling for some answers, I’ve stumbled across the answer from a mailing list.[1] It is saying that a command :
echo 1 > /proc/sys/xen/independent_wallclock
should be issued. And when I issued the command and observed the guest for a few minutes, the system clock stays the same as I expect it to be.
The only problem is that when a user reboots the guest, the value 1 of the file /proc/sys/xen/independent_wallclock returns to 0.
But i think the problem will be solved by a creating a startup script that updates that particular file.
[1] http://lists.xensource.com/archives/html/xen-users/2005-05/msg00169.html